diff --git a/lib/home_page.dart b/lib/home_page.dart index 1b277ce..ea472c7 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -19,6 +19,16 @@ class _HomeScreenState extends State with TickerProviderStateMixin { bool _isSidebarOpen = true; bool querySearches = false; String? _selectedOption = "INBOX"; + List _checkBulk = [ + "All", + "None", + "Read", + "Unread", + "Starred", + "Unstarred" + ]; + bool _checkboxState = false; + bool bulkOptionsState = false; List _tabs = ['Emails']; Map _tabWidgets = {}; @@ -307,6 +317,143 @@ class _HomeScreenState extends State with TickerProviderStateMixin { ], ), ), + Container( + padding: EdgeInsets.fromLTRB(0, 4, 0, 4), + color: Theme.of(context).colorScheme.onPrimary, + child: Row( + children: [ + Padding( + padding: + const EdgeInsets.fromLTRB(4, 0, 0, 0), + child: Checkbox( + value: _checkboxState, + onChanged: (value) { + setState(() { + _checkboxState = !_checkboxState; + }); + if (_checkboxState) { + // var a = _tabWidgets["Emails"].; + print(_emailPageKey.currentState! + .selectAllEmails( + true)); //now i got them all but how do i go down to select them all? + print("all"); + bulkOptionsState = true; + } else { + _emailPageKey.currentState! + .selectAllEmails(false); + bulkOptionsState = false; + print("none"); + } + }), + ), + const SizedBox( + width: 0, + ), + PopupMenuButton( + icon: const Icon( + Icons.arrow_drop_down_outlined), + itemBuilder: (BuildContext context) => + >[ + const PopupMenuItem( + child: Text("All")), + const PopupMenuItem( + child: Text("None")), + const PopupMenuItem( + child: Text("Read")), + const PopupMenuItem( + child: Text("Unread")), + const PopupMenuItem( + child: Text("Starred")), + const PopupMenuItem( + child: Text("Unstarred")), + ], + onSelected: (String result) { + print("result $result"); + }, + ), + if (bulkOptionsState) ...[ + IconButton( + onPressed: null, + icon: Icon(Icons.archive_outlined)), + IconButton( + onPressed: null, + icon: Icon(Icons.delete_outlined)), + IconButton( + onPressed: null, + icon: Icon( + Icons.mark_email_read_outlined)), + IconButton( + onPressed: null, + icon: Icon( + Icons.drive_file_move_outlined)), + ], + PopupMenuButton( + icon: const Icon(Icons.more_vert), + itemBuilder: (BuildContext context) { + if (!bulkOptionsState) { + return >[ + const PopupMenuItem( + child: Row( + children: [ + Icon(Icons + .mark_email_read_outlined), + const SizedBox( + width: 4.0, + ), + Text("Mark all as read") + ], + ), + ), + const PopupMenuDivider(), + PopupMenuItem( + child: Text( + "Select messages to see more actions", + style: TextStyle( + color: Colors + .blueGrey.shade300), + )) + ]; + } else { + return >[ + const PopupMenuItem( + child: Row( + children: [ + Icon(Icons + .mark_email_unread_outlined), + const SizedBox( + width: 4.0, + ), + Text("Mark as unread") + ], + ), + ), + const PopupMenuItem( + child: Row( + children: [ + Icon(Icons.snooze_outlined), + const SizedBox( + width: 4.0, + ), + Text("Snooze") + ], + ), + ), + const PopupMenuItem( + child: Row( + children: [ + Icon(Icons.star_border_outlined), + const SizedBox( + width: 4.0, + ), + Text("Add star") + ], + ), + ), + ]; + } + }), + ], + )), Container( color: Color.fromARGB(255, 131, 110, 143), child: TabBar(