From a90ad978fcf45f7a76d6e257ae03aa12de3a986c Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Thu, 29 Aug 2024 12:45:25 -0400 Subject: [PATCH] Only add Circle/Group/Channel section if not empty --- lib/screens/home.dart | 96 +++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 796c366..23fd8d6 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -137,57 +137,63 @@ class _HomeScreenState extends ConsumerState { ...standardTypes .map((t) => TimelineIdentifiers(timeline: t)) .map((e) => DropdownMenuItem(value: e, child: Text(e.toLabel()))), - const DropdownMenuItem( - value: null, - enabled: false, - child: Divider(), - ), - const DropdownMenuItem( + if (circles.isNotEmpty) ...[ + const DropdownMenuItem( value: null, enabled: false, - child: Text( - 'Circles', - style: TextStyle( - fontWeight: FontWeight.bold, - fontStyle: FontStyle.italic, - decoration: TextDecoration.underline, - ), - )), - ..._timelineGroupingListDataCollectionToDropdown(circles), - const DropdownMenuItem( - value: null, - enabled: false, - child: Divider(), - ), - const DropdownMenuItem( + child: Divider(), + ), + const DropdownMenuItem( + value: null, + enabled: false, + child: Text( + 'Circles', + style: TextStyle( + fontWeight: FontWeight.bold, + fontStyle: FontStyle.italic, + decoration: TextDecoration.underline, + ), + )), + ..._timelineGroupingListDataCollectionToDropdown(circles), + ], + if (groups.isNotEmpty) ...[ + const DropdownMenuItem( value: null, enabled: false, - child: Text( - 'Groups', - style: TextStyle( - fontWeight: FontWeight.bold, - fontStyle: FontStyle.italic, - decoration: TextDecoration.underline, - ), - )), - ..._timelineGroupingListDataCollectionToDropdown(groups), - const DropdownMenuItem( - value: null, - enabled: false, - child: Divider(), - ), - const DropdownMenuItem( + child: Divider(), + ), + const DropdownMenuItem( + value: null, + enabled: false, + child: Text( + 'Groups', + style: TextStyle( + fontWeight: FontWeight.bold, + fontStyle: FontStyle.italic, + decoration: TextDecoration.underline, + ), + )), + ..._timelineGroupingListDataCollectionToDropdown(groups), + ], + if (channels.isNotEmpty) ...[ + const DropdownMenuItem( value: null, enabled: false, - child: Text( - 'Channels', - style: TextStyle( - fontWeight: FontWeight.bold, - fontStyle: FontStyle.italic, - decoration: TextDecoration.underline, - ), - )), - ..._timelineGroupingListDataCollectionToDropdown(channels), + child: Divider(), + ), + const DropdownMenuItem( + value: null, + enabled: false, + child: Text( + 'Channels', + style: TextStyle( + fontWeight: FontWeight.bold, + fontStyle: FontStyle.italic, + decoration: TextDecoration.underline, + ), + )), + ..._timelineGroupingListDataCollectionToDropdown(channels), + ], ]; if (items.where((i) => i.value == currentTimeline).isEmpty) {