diff --git a/packages/neon/neon/lib/src/utils/sort_box_builder.dart b/packages/neon/neon/lib/src/utils/sort_box_builder.dart index 22c1ecc5..b9d96efc 100644 --- a/packages/neon/neon/lib/src/utils/sort_box_builder.dart +++ b/packages/neon/neon/lib/src/utils/sort_box_builder.dart @@ -17,14 +17,21 @@ class SortBoxBuilder extends StatelessWidget { final Widget Function(BuildContext, List?) builder; @override - Widget build(final BuildContext context) => OptionBuilder( - option: sortPropertyOption, - builder: (final context, final property) => OptionBuilder( - 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( + option: sortPropertyOption, + builder: (final context, final property) => OptionBuilder( + option: sortBoxOrderOption, + builder: (final context, final order) { + final box = Box(property, order); + + return builder(context, sortBox.sort(input!, box)); + }, + ), + ); + } }