fix homepage

This commit is contained in:
Salvatore Giordano
2021-07-01 08:55:12 +02:00
parent 9cd670b6a7
commit 52e19e9bc1
+8 -2
View File
@@ -10,19 +10,25 @@ class HomePageArgs {
HomePageArgs(this.chatClient); HomePageArgs(this.chatClient);
} }
class HomePage extends StatelessWidget { class HomePage extends StatefulWidget {
HomePage({ HomePage({
Key? key, Key? key,
required this.chatClient, required this.chatClient,
}) : super(key: key); }) : super(key: key);
final StreamChatClient chatClient; final StreamChatClient chatClient;
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final GlobalKey<NavigatorState> _navigatorKey = GlobalKey(); final GlobalKey<NavigatorState> _navigatorKey = GlobalKey();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StreamChat( return StreamChat(
client: chatClient, client: widget.chatClient,
child: WillPopScope( child: WillPopScope(
onWillPop: () async { onWillPop: () async {
final canPop = await _navigatorKey.currentState?.maybePop() ?? false; final canPop = await _navigatorKey.currentState?.maybePop() ?? false;