-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
Describe the bug
I have a variable in my AppState, and I would like to change an icon depending on this variable, after a setState().
It seems the icon is changing only if I go to another page...
To Reproduce
Steps to reproduce the behavior:
- Have a variable in your AppState (here it's
List<Message> newMessages) - Have an Icon based on this variable :
List<BottomBarWithSheetItem> lstItems = [
BottomBarWithSheetItem(
icon: container.state.newMessages?.isEmpty ? Icons.mail_outline : Icons.mark_email_unread_outlined,
label: 'MESSAGES'),
//...
];
return SafeArea(
child: BottomBarWithSheet(
controller: _bottomBarController,
// ...
items: lstItems,
)
- Have an action to update your variable, and setState()
void checkNewMessages() async {
//...
this.setState(() {
state.newMessages.add(msg);
});
}
Expected behavior
After calling checkNewMessages, the Icon should be mark_email_unread_outlined, but it says mail_outline.
Maybe it's not a bug, maybe It's my code the bug, but I've not find anything in your documentation regarding this...
Thanks
Metadata
Metadata
Assignees
Labels
No labels