menu's for selecting emails

This commit is contained in:
Juan Marulanda De Los Rios 2025-08-11 17:35:29 -04:00
parent 344029d0dd
commit 1c6d3d6920

View File

@ -19,6 +19,16 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
bool _isSidebarOpen = true;
bool querySearches = false;
String? _selectedOption = "INBOX";
List<String> _checkBulk = [
"All",
"None",
"Read",
"Unread",
"Starred",
"Unstarred"
];
bool _checkboxState = false;
bool bulkOptionsState = false;
List<String> _tabs = ['Emails'];
Map<String, Widget> _tabWidgets = {};
@ -307,6 +317,143 @@ class _HomeScreenState extends State<HomeScreen> 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<String>(
icon: const Icon(
Icons.arrow_drop_down_outlined),
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
const PopupMenuItem<String>(
child: Text("All")),
const PopupMenuItem<String>(
child: Text("None")),
const PopupMenuItem<String>(
child: Text("Read")),
const PopupMenuItem<String>(
child: Text("Unread")),
const PopupMenuItem<String>(
child: Text("Starred")),
const PopupMenuItem<String>(
child: Text("Unstarred")),
],
onSelected: (String result) {
print("result $result");
},
),
if (bulkOptionsState) ...<Widget>[
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<String>(
icon: const Icon(Icons.more_vert),
itemBuilder: (BuildContext context) {
if (!bulkOptionsState) {
return <PopupMenuEntry<String>>[
const PopupMenuItem<String>(
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 <PopupMenuEntry<String>>[
const PopupMenuItem<String>(
child: Row(
children: [
Icon(Icons
.mark_email_unread_outlined),
const SizedBox(
width: 4.0,
),
Text("Mark as unread")
],
),
),
const PopupMenuItem<String>(
child: Row(
children: [
Icon(Icons.snooze_outlined),
const SizedBox(
width: 4.0,
),
Text("Snooze")
],
),
),
const PopupMenuItem<String>(
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(