diff --git a/wrestling_scoreboard_client/lib/view/screens/home/home.dart b/wrestling_scoreboard_client/lib/view/screens/home/home.dart index 3bda4272..8b9fda55 100644 --- a/wrestling_scoreboard_client/lib/view/screens/home/home.dart +++ b/wrestling_scoreboard_client/lib/view/screens/home/home.dart @@ -177,45 +177,53 @@ class HomeState extends ConsumerState { }, ), ), - Row(children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: SimpleDropdown( - options: [null, ...dataTypes..remove(ParticipantState)].map((type) => MapEntry( - type, - Text(type != null ? localizeType(context, type) : '${localizations.optionSelect} Type'), - )), - selected: searchType, - onChange: (value) { - setState(() { - searchType = value; - }); - }, - isExpanded: false, - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: - ManyConsumer(builder: (BuildContext context, List organizations) { - return SimpleDropdown( - options: [null, ...organizations].map((organization) => MapEntry( - organization, - Text(organization != null - ? organization.name - : '${localizations.optionSelect} ${localizations.organization}'), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: SimpleDropdown( + options: [null, ...dataTypes..remove(ParticipantState)].map((type) => MapEntry( + type, + Text(type != null ? localizeType(context, type) : '${localizations.optionSelect} Type'), )), - selected: searchOrganization, + selected: searchType, onChange: (value) { setState(() { - searchOrganization = value; + searchType = value; }); }, isExpanded: false, - ); - }), - ), - ]), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: ManyConsumer( + builder: (BuildContext context, List organizations) { + return SimpleDropdown( + options: [null, ...organizations].map((organization) => MapEntry( + organization, + Text(organization != null + ? organization.name + : '${localizations.optionSelect} ${localizations.organization}'), + )), + selected: searchOrganization, + onChange: (value) { + setState(() { + searchOrganization = value; + }); + }, + isExpanded: false, + ); + }, + onException: (context, exception, {stackTrace}) => SizedBox( + width: 250, + child: ExceptionInfo(AppLocalizations.of(context)!.notFoundException, stackTrace: stackTrace), + ), + ), + ), + ], + ), Padding( padding: const EdgeInsets.symmetric(vertical: 16), child: Text( diff --git a/wrestling_scoreboard_client/lib/view/widgets/consumer.dart b/wrestling_scoreboard_client/lib/view/widgets/consumer.dart index e6bd31ba..2fbbdaba 100644 --- a/wrestling_scoreboard_client/lib/view/widgets/consumer.dart +++ b/wrestling_scoreboard_client/lib/view/widgets/consumer.dart @@ -82,8 +82,9 @@ class ManyConsumer extends Consumer final List? initialData; final S? filterObject; final Widget Function(BuildContext context, List data) builder; + final Widget Function(BuildContext context, Object? exception, {StackTrace? stackTrace})? onException; - const ManyConsumer({required this.builder, this.initialData, this.filterObject, super.key}); + const ManyConsumer({required this.builder, this.onException, this.initialData, this.filterObject, super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -98,6 +99,7 @@ class ManyConsumer extends Consumer .onWebSocketConnection .sink .add(WebSocketConnectionState.connecting), + onException: onException, ); } }