🐛 Bug fixes

This commit is contained in:
LittleSheep 2024-10-05 03:38:30 +08:00
parent 8d79274b0c
commit ac60043ca7
4 changed files with 22 additions and 4 deletions

View File

@ -202,7 +202,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
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;

View File

@ -131,7 +131,7 @@ class _ChatScreenState extends State<ChatScreen> {
..._channels.directChannels
]),
selfId: selfId,
useReplace: true,
useReplace: false,
),
),
),

View File

@ -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<ScaffoldState> rootScaffoldKey = GlobalKey<ScaffoldState>();
@ -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: [

View File

@ -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<AppNavigationBottom> createState() => _AppNavigationBottomState();
@ -12,6 +14,14 @@ class AppNavigationBottom extends StatefulWidget {
class _AppNavigationBottomState extends State<AppNavigationBottom> {
int _currentIndex = 0;
@override
void initState() {
super.initState();
if (widget.initialIndex >= 0) {
_currentIndex = widget.initialIndex;
}
}
@override
Widget build(BuildContext context) {
return BottomNavigationBar(