1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +00:00

Expose AppBarCustomDropDownWidget state to programmatically close dropdown

This commit is contained in:
Pierre HUBERT 2020-05-07 18:12:11 +02:00
parent 1750d6079e
commit 24e08d63f8
2 changed files with 15 additions and 4 deletions

View File

@ -24,11 +24,11 @@ class AppBarCustomDropDownWidget extends StatefulWidget {
super(key: key);
@override
_AppBarCustomDropDownWidgetState createState() =>
_AppBarCustomDropDownWidgetState();
AppBarCustomDropDownWidgetState createState() =>
AppBarCustomDropDownWidgetState();
}
class _AppBarCustomDropDownWidgetState
class AppBarCustomDropDownWidgetState
extends State<AppBarCustomDropDownWidget> {
bool _visible = false;

View File

@ -22,6 +22,9 @@ class ComunicTabletAppBarWidget extends StatefulWidget
class _ComunicTabletAppBarWidgetState
extends SafeState<ComunicTabletAppBarWidget> {
final notificationsDropdownKey = GlobalKey<AppBarCustomDropDownWidgetState>();
final conversationsDropdownKey = GlobalKey<AppBarCustomDropDownWidgetState>();
var _unreadNotifications =
CountUnreadNotifications(notifications: 0, conversations: 0);
@ -56,14 +59,22 @@ class _ComunicTabletAppBarWidgetState
title: Text("Comunic"),
actions: <Widget>[
AppBarCustomDropDownWidget(
key: notificationsDropdownKey,
icon: Icon(Icons.notifications),
notificationsBadge: _unreadNotifications.notifications,
onBuildOverlay: (c) => buildCenteredProgressBar(),
),
AppBarCustomDropDownWidget(
key: conversationsDropdownKey,
icon: Icon(Icons.message),
notificationsBadge: _unreadNotifications.conversations,
onBuildOverlay: (c) => Text("hello world"),
onBuildOverlay: (c) => Center(
child: RaisedButton(
child: Text("Close"),
onPressed: () =>
conversationsDropdownKey.currentState.toggleOverlay(),
),
),
),
PopupMenuButton(itemBuilder: (c) => []),
],