Browse Source

neon: cleanup SortBoxBuilder

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

17
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; final Widget Function(BuildContext, List<R>?) builder;
@override @override
Widget build(final BuildContext context) => OptionBuilder<T>( Widget build(final BuildContext context) {
if (input == null || (input?.isEmpty ?? false)) {
return builder(context, null);
}
return OptionBuilder<T>(
option: sortPropertyOption, option: sortPropertyOption,
builder: (final context, final property) => OptionBuilder<SortBoxOrder>( builder: (final context, final property) => OptionBuilder<SortBoxOrder>(
option: sortBoxOrderOption, option: sortBoxOrderOption,
builder: (final context, final order) => builder( builder: (final context, final order) {
context, final box = Box(property, order);
input == null ? null : sortBox.sort(input!, Box(property, order)),
), return builder(context, sortBox.sort(input!, box));
},
), ),
); );
}
} }

Loading…
Cancel
Save