more messages work

This commit is contained in:
Christien Rioux 2024-02-11 14:17:10 -05:00
parent 634543910b
commit ff14969ffa
12 changed files with 226 additions and 192 deletions

View file

@ -56,8 +56,8 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
case AccountInfoStatus.accountLocked:
return const HomeAccountLocked();
case AccountInfoStatus.accountReady:
return Provider.value(
value: accountInfo.activeAccountInfo,
return Provider<ActiveAccountInfo>.value(
value: accountInfo.activeAccountInfo!,
child: BlocProvider(
create: (context) => AccountRecordCubit(
record: accountInfo.activeAccountInfo!.accountRecord),

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../chat/chat.dart';
import '../../../tools/tools.dart';
@ -31,10 +32,20 @@ class ChatOnlyPageState extends State<ChatOnlyPage>
super.dispose();
}
Widget buildChatComponent(BuildContext context) {
final activeChatRemoteConversationKey =
context.watch<ActiveChatCubit>().state;
if (activeChatRemoteConversationKey == null) {
return const EmptyChatWidget();
}
return ChatComponent.builder(
remoteConversationRecordKey: activeChatRemoteConversationKey);
}
@override
Widget build(BuildContext context) => SafeArea(
child: GestureDetector(
onTap: () => FocusScope.of(context).requestFocus(_unfocusNode),
child: const ChatComponent(),
child: buildChatComponent(context),
));
}

View file

@ -74,7 +74,15 @@ class HomeAccountReadyState extends State<HomeAccountReady>
builder: (context) =>
Material(color: Colors.transparent, child: buildUserPanel()));
Widget buildTabletRightPane(BuildContext context) => const ChatComponent();
Widget buildTabletRightPane(BuildContext context) {
final activeChatRemoteConversationKey =
context.watch<ActiveChatCubit>().state;
if (activeChatRemoteConversationKey == null) {
return const EmptyChatWidget();
}
return ChatComponent.builder(
remoteConversationRecordKey: activeChatRemoteConversationKey);
}
// ignore: prefer_expression_function_bodies
Widget buildTablet(BuildContext context) {
@ -106,7 +114,7 @@ class HomeAccountReadyState extends State<HomeAccountReady>
final accountData = context.watch<AccountRecordCubit>().state.data;
if (accountData == null) {
return waitingPage(context);
return waitingPage();
}
return MultiBlocProvider(

View file

@ -143,7 +143,7 @@ class MainPagerState extends State<MainPager> with TickerProviderStateMixin {
return _onNewChatBottomSheetBuilder(context);
} else {
// Unknown error
return waitingPage(context);
return debugPage('unknown page');
}
}

View file

@ -21,5 +21,5 @@ class HomeNoActiveState extends State<HomeNoActive> {
}
@override
Widget build(BuildContext context) => waitingPage(context);
Widget build(BuildContext context) => waitingPage();
}