diff --git a/lib/screens/channel/channel_chat.dart b/lib/screens/channel/channel_chat.dart index 2d1697d..af986ca 100644 --- a/lib/screens/channel/channel_chat.dart +++ b/lib/screens/channel/channel_chat.dart @@ -202,7 +202,7 @@ class _ChannelChatScreenState extends State String? placeholder; final otherside = - _channel!.members!.where((e) => e.account.id != _accountId).firstOrNull; + _channel?.members!.where((e) => e.account.id != _accountId).firstOrNull; if (_channel?.type == 1 && otherside != null) { title = otherside.account.nick; diff --git a/lib/screens/chat.dart b/lib/screens/chat.dart index 7264e83..3295652 100644 --- a/lib/screens/chat.dart +++ b/lib/screens/chat.dart @@ -131,7 +131,7 @@ class _ChatScreenState extends State { ..._channels.directChannels ]), selfId: selfId, - useReplace: true, + useReplace: false, ), ), ), diff --git a/lib/shells/root_shell.dart b/lib/shells/root_shell.dart index e0b361d..f70fef5 100644 --- a/lib/shells/root_shell.dart +++ b/lib/shells/root_shell.dart @@ -2,6 +2,7 @@ import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:solian/theme.dart'; +import 'package:solian/widgets/navigation/app_navigation.dart'; import 'package:solian/widgets/navigation/app_navigation_bottom.dart'; final GlobalKey rootScaffoldKey = GlobalKey(); @@ -39,9 +40,16 @@ class RootShell extends StatelessWidget { ); } + final destNames = AppNavigation.destinations.map((x) => x.page).toList(); + final showBottomNavigation = destNames.contains(routeName); + return Scaffold( key: rootScaffoldKey, - bottomNavigationBar: const AppNavigationBottom(), + bottomNavigationBar: showBottomNavigation + ? AppNavigationBottom( + initialIndex: destNames.indexOf(routeName ?? 'page'), + ) + : null, body: AppTheme.isLargeScreen(context) ? Row( children: [ diff --git a/lib/widgets/navigation/app_navigation_bottom.dart b/lib/widgets/navigation/app_navigation_bottom.dart index 163ac3e..8b70922 100644 --- a/lib/widgets/navigation/app_navigation_bottom.dart +++ b/lib/widgets/navigation/app_navigation_bottom.dart @@ -3,7 +3,9 @@ import 'package:solian/router.dart'; import 'package:solian/widgets/navigation/app_navigation.dart'; class AppNavigationBottom extends StatefulWidget { - const AppNavigationBottom({super.key}); + final int initialIndex; + + const AppNavigationBottom({super.key, this.initialIndex = 0}); @override State createState() => _AppNavigationBottomState(); @@ -12,6 +14,14 @@ class AppNavigationBottom extends StatefulWidget { class _AppNavigationBottomState extends State { int _currentIndex = 0; + @override + void initState() { + super.initState(); + if (widget.initialIndex >= 0) { + _currentIndex = widget.initialIndex; + } + } + @override Widget build(BuildContext context) { return BottomNavigationBar(