remove additional navigator widget

This commit is contained in:
Salvatore Giordano
2020-05-14 10:30:56 +02:00
parent 2de3cc2b69
commit cb284f773b
17 changed files with 148 additions and 104 deletions
+1 -21
View File
@@ -61,7 +61,6 @@ class StreamChat extends StatefulWidget {
/// The current state of the StreamChat widget
class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
Client get client => widget.client;
final GlobalKey<NavigatorState> _navigatorKey = GlobalKey<NavigatorState>();
Timer _disconnectTimer;
@override
@@ -79,26 +78,7 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
accentColor: streamTheme.accentColor,
scaffoldBackgroundColor: streamTheme.backgroundColor,
),
child: WillPopScope(
onWillPop: () async {
if (_navigatorKey.currentState.canPop()) {
_navigatorKey.currentState.pop();
return false;
} else {
return true;
}
},
child: Navigator(
initialRoute: '/',
key: _navigatorKey,
onGenerateRoute: (settings) {
return MaterialPageRoute(
settings: settings,
builder: (_) => widget.child,
);
},
),
),
child: widget.child,
);
},
),