reset unreadMessages
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
erinn 2021-05-12 18:22:05 -07:00
parent 16b1019099
commit 35417a8b24
2 changed files with 22 additions and 14 deletions

View File

@ -39,20 +39,27 @@ class _MessageViewState extends State<MessageView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
appBar: AppBar( onWillPop: _onWillPop,
title: Text(Provider.of<ContactInfoState>(context).nickname), child: Scaffold(
actions: [ appBar: AppBar(
IconButton(icon: Icon(Icons.chat), onPressed: _pushContactSettings), title: Text(Provider.of<ContactInfoState>(context).nickname),
IconButton(icon: Icon(Icons.list), onPressed: _pushContactSettings), actions: [
IconButton(icon: Icon(Icons.push_pin), onPressed: _pushContactSettings), IconButton(icon: Icon(Icons.chat), onPressed: _pushContactSettings),
IconButton(icon: Icon(Icons.settings), onPressed: _pushContactSettings), IconButton(icon: Icon(Icons.list), onPressed: _pushContactSettings),
IconButton(icon: Icon(Icons.bug_report_outlined), onPressed: _debugResetContact), IconButton(icon: Icon(Icons.push_pin), onPressed: _pushContactSettings),
], IconButton(icon: Icon(Icons.settings), onPressed: _pushContactSettings),
), IconButton(icon: Icon(Icons.bug_report_outlined), onPressed: _debugResetContact),
body: Padding(padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 108.0), child: MessageList()), ],
bottomSheet: _buildComposeBox(), ),
); body: Padding(padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 108.0), child: MessageList()),
bottomSheet: _buildComposeBox(),
));
}
Future<bool> _onWillPop() async {
Provider.of<ContactInfoState>(context, listen: false).unreadMessages = 0;
return true;
} }
void _debugResetContact() { void _debugResetContact() {

View File

@ -87,6 +87,7 @@ class _ContactRowState extends State<ContactRow> {
} }
void _pushMessageView(String handle) { void _pushMessageView(String handle) {
Provider.of<ProfileInfoState>(context).contactList.getContact(handle).unreadMessages = 0;
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute<void>( MaterialPageRoute<void>(
builder: (BuildContext builderContext) { builder: (BuildContext builderContext) {