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