clean up windows and loading state

This commit is contained in:
Christien Rioux 2024-02-28 20:32:37 -05:00
parent ad9a77d68f
commit d00722433d
13 changed files with 130 additions and 175 deletions

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../chat/chat.dart';
import '../../../tools/tools.dart';
class HomeAccountReadyChat extends StatefulWidget {
const HomeAccountReadyChat({super.key});
@ -16,6 +17,11 @@ class HomeAccountReadyChatState extends State<HomeAccountReadyChat> {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
await changeWindowSetup(
TitleBarStyle.normal, OrientationCapability.normal);
});
}
@override

View file

@ -10,9 +10,24 @@ import '../../../theme/theme.dart';
import '../../../tools/tools.dart';
import 'main_pager/main_pager.dart';
class HomeAccountReadyMain extends StatelessWidget {
class HomeAccountReadyMain extends StatefulWidget {
const HomeAccountReadyMain({super.key});
@override
State<HomeAccountReadyMain> createState() => _HomeAccountReadyMainState();
}
class _HomeAccountReadyMainState extends State<HomeAccountReadyMain> {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
await changeWindowSetup(
TitleBarStyle.normal, OrientationCapability.normal);
});
}
Widget buildUserPanel() => Builder(builder: (context) {
final account = context.watch<AccountRecordCubit>().state;
final theme = Theme.of(context);

View file

@ -135,9 +135,15 @@ class HomeAccountReadyShellState extends State<HomeAccountReadyShell> {
create: (context) => ContactListCubit(
activeAccountInfo: widget.activeAccountInfo,
account: account)),
BlocProvider(
create: (context) => ActiveChatCubit(null)
..withStateListen((event) {
widget.routerCubit.setHasActiveChat(event != null);
})),
BlocProvider(
create: (context) => ChatListCubit(
activeAccountInfo: widget.activeAccountInfo,
activeChatCubit: context.read<ActiveChatCubit>(),
account: account)),
BlocProvider(
create: (context) => ActiveConversationsBlocMapCubit(
@ -150,11 +156,6 @@ class HomeAccountReadyShellState extends State<HomeAccountReadyShell> {
activeAccountInfo: widget.activeAccountInfo,
)..followBloc(
context.read<ActiveConversationsBlocMapCubit>())),
BlocProvider(
create: (context) => ActiveChatCubit(null)
..withStateListen((event) {
widget.routerCubit.setHasActiveChat(event != null);
})),
BlocProvider(
create: (context) => WaitingInvitationsBlocMapCubit(
activeAccountInfo: widget.activeAccountInfo,