mark as read, and fix bugs
This commit is contained in:
parent
0bfc869e74
commit
b79d68c7a2
@ -29,6 +29,8 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
];
|
||||
bool _checkboxState = false;
|
||||
bool bulkOptionsState = false;
|
||||
List<GetThreadResponse> selectedThreads =
|
||||
[]; //this should store the emails that are being stored downstream too
|
||||
|
||||
List<String> _tabs = ['Emails'];
|
||||
Map<String, Widget> _tabWidgets = {};
|
||||
@ -40,6 +42,11 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
_tabController = TabController(length: _tabs.length, vsync: this);
|
||||
_tabWidgets['Emails'] = EmailPage(
|
||||
key: _emailPageKey,
|
||||
onSelectionChanged: (updatedList) {
|
||||
setState(() {
|
||||
selectedThreads = updatedList;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -354,24 +361,45 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
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>(
|
||||
PopupMenuItem<String>(
|
||||
//select all
|
||||
child: Text("All"),
|
||||
onTap: () {
|
||||
_emailPageKey.currentState!
|
||||
.selectAllEmails(true);
|
||||
},
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
child: Text("None"),
|
||||
onTap: () {
|
||||
_emailPageKey.currentState!
|
||||
.selectAllEmails(false);
|
||||
},
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
child: Text("Read"),
|
||||
onTap: () {
|
||||
//select the read
|
||||
},
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
//select the unread
|
||||
child: Text("Unread"),
|
||||
onTap: () {
|
||||
//select the unread
|
||||
},
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
child: Text("Starred")),
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
child: Text("Unstarred")),
|
||||
],
|
||||
onSelected: (String result) {
|
||||
print("result $result");
|
||||
},
|
||||
),
|
||||
if (bulkOptionsState) ...<Widget>[
|
||||
if (selectedThreads.isNotEmpty) ...<Widget>[
|
||||
//this needs to know if anything got selected,
|
||||
IconButton(
|
||||
onPressed: null,
|
||||
icon: Icon(Icons.archive_outlined)),
|
||||
@ -379,7 +407,11 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
onPressed: null,
|
||||
icon: Icon(Icons.delete_outlined)),
|
||||
IconButton(
|
||||
onPressed: null,
|
||||
onPressed: () {
|
||||
_emailPageKey.currentState!
|
||||
.markSelectedAsRead(
|
||||
true); //mark as read
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.mark_email_read_outlined)),
|
||||
IconButton(
|
||||
@ -390,9 +422,10 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (BuildContext context) {
|
||||
if (!bulkOptionsState) {
|
||||
if (selectedThreads.isEmpty) {
|
||||
//why tf?
|
||||
return <PopupMenuEntry<String>>[
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons
|
||||
@ -403,19 +436,28 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
Text("Mark all as read")
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
_emailPageKey.currentState!
|
||||
.selectAllEmails(true);
|
||||
_emailPageKey.currentState!
|
||||
.markSelectedAsRead(true);
|
||||
_emailPageKey.currentState!
|
||||
.selectAllEmails(false);
|
||||
},
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
child: Text(
|
||||
"Select messages to see more actions",
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.blueGrey.shade300),
|
||||
))
|
||||
child: Text(
|
||||
"Select messages to see more actions",
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.blueGrey.shade300),
|
||||
),
|
||||
)
|
||||
];
|
||||
} else {
|
||||
return <PopupMenuEntry<String>>[
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons
|
||||
@ -426,28 +468,34 @@ class _HomeScreenState extends State<HomeScreen> with TickerProviderStateMixin {
|
||||
Text("Mark as unread")
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
_emailPageKey.currentState!
|
||||
.markSelectedAsRead(
|
||||
false);
|
||||
},
|
||||
),
|
||||
const PopupMenuItem<String>(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.snooze_outlined),
|
||||
const SizedBox(
|
||||
width: 4.0,
|
||||
),
|
||||
Text("Snooze")
|
||||
],
|
||||
),
|
||||
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")
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons
|
||||
.star_border_outlined),
|
||||
const SizedBox(
|
||||
width: 4.0,
|
||||
),
|
||||
Text("Add star")
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user