mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Expose AppBarCustomDropDownWidget state to programmatically close dropdown
This commit is contained in:
parent
1750d6079e
commit
24e08d63f8
@ -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;
|
||||
|
||||
|
@ -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) => []),
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user