refactor home page

This commit is contained in:
Salvatore Giordano
2021-06-22 12:52:11 +02:00
parent 3638e36471
commit 6acaf96466
12 changed files with 647 additions and 650 deletions
@@ -1,3 +1,4 @@
import 'package:example/channel_list_page.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
@@ -28,7 +29,10 @@ class AppRoutes {
return MaterialPageRoute(
settings: const RouteSettings(name: Routes.HOME),
builder: (_) {
return HomePage();
final homePageArgs = args as HomePageArgs;
return HomePage(
chatClient: homePageArgs.chatClient,
);
});
case Routes.CHOOSE_USER:
return MaterialPageRoute(
@@ -92,6 +96,12 @@ class AppRoutes {
messageTheme: StreamChatTheme.of(context).ownMessageTheme,
);
});
case Routes.CHANNEL_LIST_PAGE:
return MaterialPageRoute(
settings: const RouteSettings(name: Routes.CHANNEL_LIST_PAGE),
builder: (context) {
return ChannelListPage();
});
// Default case, should not reach here.
default:
return null;
@@ -10,4 +10,5 @@ class Routes {
static const String NEW_GROUP_CHAT_DETAILS = '/new_group_chat_details';
static const String CHAT_INFO_SCREEN = '/chat_info_screen';
static const String GROUP_INFO_SCREEN = '/group_info_screen';
static const String CHANNEL_LIST_PAGE = '/channel_list_page';
}