color when hoverred, and seen updated
This commit is contained in:
parent
5d4854901e
commit
344029d0dd
@ -9,8 +9,8 @@ class EmailListScreen extends StatefulWidget {
|
||||
final String folder;
|
||||
final GlobalKey<_EmailListScreenState> key;
|
||||
|
||||
EmailListScreen({
|
||||
required this.key,
|
||||
EmailListScreen(
|
||||
{required this.key,
|
||||
required this.emails,
|
||||
required this.getEmailContent,
|
||||
required this.folder})
|
||||
@ -25,6 +25,7 @@ class _EmailListScreenState extends State<EmailListScreen> {
|
||||
late List<GetThreadResponse> selectedEmails =
|
||||
[]; // holds the emails that are selected i.e. the emails that got the checkbox on
|
||||
final Set<int> _hoveredRows = {}; //the row that is being hovered over atm
|
||||
bool bulkSelectMenu = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -42,9 +43,12 @@ class _EmailListScreenState extends State<EmailListScreen> {
|
||||
|
||||
bool selectAllChecks(bool selectionType) {
|
||||
setState(() {
|
||||
for (int email = 0; email < selectStates.length; email++) {
|
||||
selectStates[email] = selectionType;
|
||||
}
|
||||
if (selectionType) {
|
||||
bulkSelectMenu = true;
|
||||
}
|
||||
for (int email = 0; email < selectStates.length; email++) {
|
||||
selectStates[email] = selectionType;
|
||||
}
|
||||
});
|
||||
printTheSelected();
|
||||
return false;
|
||||
@ -62,8 +66,13 @@ class _EmailListScreenState extends State<EmailListScreen> {
|
||||
body: ListView.separated(
|
||||
itemCount: widget.emails.length,
|
||||
itemBuilder: (context, index) {
|
||||
Color seenColour;
|
||||
final email = widget.emails[index];
|
||||
|
||||
if (email.seen) {
|
||||
seenColour = ThemeData().highlightColor;
|
||||
} else {
|
||||
seenColour = Colors.transparent;
|
||||
}
|
||||
return MouseRegion(
|
||||
onEnter: (_) => setState(() => _hoveredRows.add(index)),
|
||||
onExit: (_) => setState(() => _hoveredRows.remove(index)),
|
||||
@ -88,6 +97,7 @@ class _EmailListScreenState extends State<EmailListScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [Text(email.subject)],
|
||||
),
|
||||
// tileColor: () ,
|
||||
trailing: _hoveredRows.contains(index)
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -107,10 +117,12 @@ class _EmailListScreenState extends State<EmailListScreen> {
|
||||
],
|
||||
)
|
||||
: Text(email.date.toString()),
|
||||
hoverColor: Colors.transparent,
|
||||
tileColor: seenColour,
|
||||
onTap: () async {
|
||||
List<String> emailContent = // list of the html
|
||||
await widget.getEmailContent(email.messages, widget.folder);
|
||||
|
||||
// print("thread id? $email.id"); yes
|
||||
print(email.messages); //email ids of the thread
|
||||
if (widget.folder == "Drafts") {
|
||||
print("IN DRAFTS MOVE THE CONTENT TO THE WRITING THING");
|
||||
@ -131,6 +143,7 @@ class _EmailListScreenState extends State<EmailListScreen> {
|
||||
),
|
||||
),
|
||||
);
|
||||
ApiService().markAsSeen(email.id);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -159,9 +172,9 @@ class EmailPageState extends State<EmailPage> {
|
||||
ValueNotifier<int> currentPageNotifier = ValueNotifier<int>(1);
|
||||
int page = 1;
|
||||
bool isBackDisabled = false;
|
||||
|
||||
final GlobalKey<_EmailListScreenState> emailListKey = GlobalKey<_EmailListScreenState>();
|
||||
|
||||
|
||||
final GlobalKey<_EmailListScreenState> emailListKey =
|
||||
GlobalKey<_EmailListScreenState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -227,7 +240,8 @@ class EmailPageState extends State<EmailPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(body: EmailListScreen(
|
||||
return Scaffold(
|
||||
body: EmailListScreen(
|
||||
key: emailListKey,
|
||||
emails: emails,
|
||||
// getEmailContent: apiService.fetchEmailContent,
|
||||
|
Loading…
Reference in New Issue
Block a user