File tree Expand file tree Collapse file tree
packages/flutter_chat/lib/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## 6.0.1
22- Added proper implementation for getAllUsersForChat in Firebase repository
33- Removed cast which throws an error in ChatProfileScreen
4+ - Added BackButton to ChatOverviewScreen when onExit is not null
45
56## 6.0.0
67- Added pending message repository to temporarily store messages that are not yet received by the backend
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ abstract class _BaseChatNavigatorUserstory extends HookWidget {
7878 final ChatOptions options;
7979
8080 /// Callback for when the user wants to navigate back.
81+ ///
82+ /// This will also show the back button in the appbar when not null
8183 final VoidCallback ? onExit;
8284
8385 /// Implemented by subclasses to provide the initial route of the userstory.
@@ -108,7 +110,7 @@ abstract class _BaseChatNavigatorUserstory extends HookWidget {
108110 service: service,
109111 popHandler: popHandler,
110112 child: NavigatorPopHandler (
111- onPop: () => popHandler.handlePop () ,
113+ onPop: popHandler.handlePop,
112114 child: Navigator (
113115 key: nestedNavigatorKey,
114116 onGenerateInitialRoutes: (_, __) => [
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class ChatScreen extends HookWidget {
4646
4747 if (options.builders.baseScreenBuilder == null ) {
4848 return Scaffold (
49- appBar: const _AppBar (),
49+ appBar: _AppBar (onExit ),
5050 body: _Body (
5151 onPressChat: onPressChat,
5252 onPressStartChat: onPressStartChat,
@@ -58,7 +58,7 @@ class ChatScreen extends HookWidget {
5858 return options.builders.baseScreenBuilder! .call (
5959 context,
6060 mapScreenType,
61- const _AppBar (),
61+ _AppBar (onExit ),
6262 translations.chatsTitle,
6363 _Body (
6464 onPressChat: onPressChat,
@@ -70,7 +70,9 @@ class ChatScreen extends HookWidget {
7070}
7171
7272class _AppBar extends StatelessWidget implements PreferredSizeWidget {
73- const _AppBar ();
73+ const _AppBar (this .onExit);
74+
75+ final VoidCallback ? onExit;
7476
7577 @override
7678 Widget build (BuildContext context) {
@@ -81,6 +83,11 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget {
8183 var theme = Theme .of (context);
8284
8385 return AppBar (
86+ leading: onExit != null
87+ ? BackButton (
88+ onPressed: () => onExit? .call (),
89+ )
90+ : null ,
8491 title: Text (
8592 translations.chatsTitle,
8693 ),
You can’t perform that action at this time.
0 commit comments