mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-15 04:32:20 -04:00
more layout cleanup
This commit is contained in:
parent
68f7a26ed1
commit
67812b3c6f
12 changed files with 197 additions and 260 deletions
|
@ -2,6 +2,6 @@ export 'drawer_menu/drawer_menu.dart';
|
|||
export 'home_account_invalid.dart';
|
||||
export 'home_account_locked.dart';
|
||||
export 'home_account_missing.dart';
|
||||
export 'home_account_ready/home_account_ready.dart';
|
||||
export 'home_account_ready.dart';
|
||||
export 'home_no_active.dart';
|
||||
export 'home_screen.dart';
|
||||
|
|
|
@ -4,20 +4,20 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||
import 'package:flutter_translate/flutter_translate.dart';
|
||||
import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart';
|
||||
|
||||
import '../../../account_manager/account_manager.dart';
|
||||
import '../../../chat/chat.dart';
|
||||
import '../../../proto/proto.dart' as proto;
|
||||
import '../../../theme/theme.dart';
|
||||
import '../../account_manager/account_manager.dart';
|
||||
import '../../chat/chat.dart';
|
||||
import '../../proto/proto.dart' as proto;
|
||||
import '../../theme/theme.dart';
|
||||
import 'main_pager/main_pager.dart';
|
||||
|
||||
class HomeAccountReadyMain extends StatefulWidget {
|
||||
const HomeAccountReadyMain({super.key});
|
||||
class HomeAccountReady extends StatefulWidget {
|
||||
const HomeAccountReady({super.key});
|
||||
|
||||
@override
|
||||
State<HomeAccountReadyMain> createState() => _HomeAccountReadyMainState();
|
||||
State<HomeAccountReady> createState() => _HomeAccountReadyState();
|
||||
}
|
||||
|
||||
class _HomeAccountReadyMainState extends State<HomeAccountReadyMain> {
|
||||
class _HomeAccountReadyState extends State<HomeAccountReady> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -98,7 +98,6 @@ class _HomeAccountReadyMainState extends State<HomeAccountReadyMain> {
|
|||
phone: false,
|
||||
);
|
||||
|
||||
final w = MediaQuery.of(context).size.width;
|
||||
final theme = Theme.of(context);
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
final scaleConfig = theme.extension<ScaleConfig>()!;
|
||||
|
@ -111,51 +110,56 @@ class _HomeAccountReadyMainState extends State<HomeAccountReadyMain> {
|
|||
// _chatAnimationController.reset();
|
||||
// }
|
||||
|
||||
late final bool offstageLeft;
|
||||
late final bool offstageRight;
|
||||
late final double leftWidth;
|
||||
late final double rightWidth;
|
||||
if (isLarge) {
|
||||
leftWidth = 300;
|
||||
rightWidth = w - 300 - 2;
|
||||
offstageLeft = false;
|
||||
offstageRight = false;
|
||||
} else {
|
||||
leftWidth = w;
|
||||
rightWidth = w;
|
||||
if (hasActiveChat) {
|
||||
offstageLeft = true;
|
||||
offstageRight = false;
|
||||
} else {
|
||||
offstageLeft = false;
|
||||
offstageRight = true;
|
||||
}
|
||||
}
|
||||
return LayoutBuilder(builder: (context, constraints) {
|
||||
const leftColumnSize = 300.0;
|
||||
|
||||
return Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
|
||||
Offstage(
|
||||
offstage: offstageLeft,
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(minWidth: leftWidth, maxWidth: leftWidth),
|
||||
child: buildLeftPane(context))),
|
||||
Offstage(
|
||||
offstage: offstageLeft || offstageRight,
|
||||
child: SizedBox(
|
||||
width: 2,
|
||||
height: double.infinity,
|
||||
child: ColoredBox(
|
||||
color: scaleConfig.preferBorders
|
||||
? scale.primaryScale.subtleBorder
|
||||
: scale.primaryScale.subtleBackground))),
|
||||
Offstage(
|
||||
offstage: offstageRight,
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(minWidth: rightWidth, maxWidth: rightWidth),
|
||||
child: buildRightPane(context),
|
||||
)),
|
||||
]);
|
||||
late final bool visibleLeft;
|
||||
late final bool visibleRight;
|
||||
late final double leftWidth;
|
||||
late final double rightWidth;
|
||||
if (isLarge) {
|
||||
visibleLeft = true;
|
||||
visibleRight = true;
|
||||
leftWidth = leftColumnSize;
|
||||
rightWidth = constraints.maxWidth - leftColumnSize - 2;
|
||||
} else {
|
||||
if (hasActiveChat) {
|
||||
visibleLeft = false;
|
||||
visibleRight = true;
|
||||
leftWidth = leftColumnSize;
|
||||
rightWidth = constraints.maxWidth;
|
||||
} else {
|
||||
visibleLeft = true;
|
||||
visibleRight = false;
|
||||
leftWidth = constraints.maxWidth;
|
||||
rightWidth = 400; // whatever
|
||||
}
|
||||
}
|
||||
|
||||
return Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
|
||||
Offstage(
|
||||
offstage: !visibleLeft,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: leftWidth),
|
||||
child: buildLeftPane(context))),
|
||||
Offstage(
|
||||
offstage: !(visibleLeft && visibleRight),
|
||||
child: SizedBox(
|
||||
width: 2,
|
||||
height: double.infinity,
|
||||
child: ColoredBox(
|
||||
color: scaleConfig.preferBorders
|
||||
? scale.primaryScale.subtleBorder
|
||||
: scale.primaryScale.subtleBackground))),
|
||||
Offstage(
|
||||
offstage: !visibleRight,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: constraints.maxHeight, maxWidth: rightWidth),
|
||||
child: buildRightPane(context),
|
||||
)),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
|
@ -1,2 +0,0 @@
|
|||
export 'home_account_ready_chat.dart';
|
||||
export 'home_account_ready_main.dart';
|
|
@ -1,40 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../chat/chat.dart';
|
||||
|
||||
class HomeAccountReadyChat extends StatefulWidget {
|
||||
const HomeAccountReadyChat({super.key});
|
||||
|
||||
@override
|
||||
HomeAccountReadyChatState createState() => HomeAccountReadyChatState();
|
||||
}
|
||||
|
||||
class HomeAccountReadyChatState extends State<HomeAccountReadyChat> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget buildChatComponent(BuildContext context) {
|
||||
final activeChatLocalConversationKey =
|
||||
context.watch<ActiveChatCubit>().state;
|
||||
if (activeChatLocalConversationKey == null) {
|
||||
return const NoConversationWidget();
|
||||
}
|
||||
return ChatComponentWidget.builder(
|
||||
localConversationRecordKey: activeChatLocalConversationKey,
|
||||
key: ValueKey(activeChatLocalConversationKey));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SafeArea(
|
||||
bottom: false,
|
||||
child: buildChatComponent(context),
|
||||
);
|
||||
}
|
|
@ -13,7 +13,7 @@ import 'drawer_menu/drawer_menu.dart';
|
|||
import 'home_account_invalid.dart';
|
||||
import 'home_account_locked.dart';
|
||||
import 'home_account_missing.dart';
|
||||
import 'home_account_ready/home_account_ready.dart';
|
||||
import 'home_account_ready.dart';
|
||||
import 'home_no_active.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
|
@ -64,7 +64,7 @@ class HomeScreenState extends State<HomeScreen>
|
|||
|
||||
// Re-export all ready blocs to the account display subtree
|
||||
return perAccountCollectionState.provide(
|
||||
child: const HomeAccountReadyMain());
|
||||
child: const HomeAccountReady());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_translate/flutter_translate.dart';
|
||||
|
||||
import '../../../../contact_invitation/contact_invitation.dart';
|
||||
import '../../../../contacts/contacts.dart';
|
||||
import '../../../../theme/theme.dart';
|
||||
import '../../../contact_invitation/contact_invitation.dart';
|
||||
import '../../../contacts/contacts.dart';
|
||||
import '../../../theme/theme.dart';
|
||||
|
||||
class AccountPage extends StatefulWidget {
|
||||
const AccountPage({
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:awesome_extensions/awesome_extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../chat_list/chat_list.dart';
|
||||
import '../../../chat_list/chat_list.dart';
|
||||
|
||||
class ChatsPage extends StatefulWidget {
|
||||
const ChatsPage({super.key});
|
|
@ -10,9 +10,9 @@ import 'package:flutter_translate/flutter_translate.dart';
|
|||
import 'package:preload_page_view/preload_page_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../../chat/chat.dart';
|
||||
import '../../../../contact_invitation/contact_invitation.dart';
|
||||
import '../../../../theme/theme.dart';
|
||||
import '../../../chat/chat.dart';
|
||||
import '../../../contact_invitation/contact_invitation.dart';
|
||||
import '../../../theme/theme.dart';
|
||||
import 'account_page.dart';
|
||||
import 'bottom_sheet_action_button.dart';
|
||||
import 'chats_page.dart';
|
Loading…
Add table
Add a link
Reference in a new issue