Browse Source

neon: cleanup SortBoxBuilder

pull/428/head
Nikolas Rimikis 2 years ago
parent
commit
d5ac8bee1e
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 27
      packages/neon/neon/lib/src/utils/sort_box_builder.dart

27
packages/neon/neon/lib/src/utils/sort_box_builder.dart

@ -17,14 +17,21 @@ class SortBoxBuilder<T extends Enum, R> extends StatelessWidget {
final Widget Function(BuildContext, List<R>?) builder;
@override
Widget build(final BuildContext context) => OptionBuilder<T>(
option: sortPropertyOption,
builder: (final context, final property) => OptionBuilder<SortBoxOrder>(
option: sortBoxOrderOption,
builder: (final context, final order) => builder(
context,
input == null ? null : sortBox.sort(input!, Box(property, order)),
),
),
);
Widget build(final BuildContext context) {
if (input == null || (input?.isEmpty ?? false)) {
return builder(context, null);
}
return OptionBuilder<T>(
option: sortPropertyOption,
builder: (final context, final property) => OptionBuilder<SortBoxOrder>(
option: sortBoxOrderOption,
builder: (final context, final order) {
final box = Box(property, order);
return builder(context, sortBox.sort(input!, box));
},
),
);
}
}

Loading…
Cancel
Save