📱 Optimize the call experience on landscape device

This commit is contained in:
LittleSheep 2024-10-06 01:25:10 +08:00
parent 9e6829bd5a
commit 9c3d181deb
6 changed files with 14 additions and 69 deletions

View File

@ -392,7 +392,7 @@ class ChatCallProvider extends GetxController {
}
Future gotoScreen(BuildContext context) {
return Navigator.of(context, rootNavigator: true).push(
return Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const CallScreen()),
);
}

View File

@ -275,7 +275,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
channel: _channel!,
ongoingCall: _ongoingCall!,
onJoin: () {
if (!AppTheme.isLargeScreen(context)) {
if (!AppTheme.isUltraLargeScreen(context)) {
final ChatCallProvider call = Get.find();
call.gotoScreen(context);
}
@ -329,7 +329,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
Obx(() {
final ChatCallProvider call = Get.find();
if (call.isMounted.value && AppTheme.isLargeScreen(context)) {
if (call.isMounted.value &&
AppTheme.isUltraLargeScreen(context)) {
return const Expanded(
child: Row(children: [
VerticalDivider(width: 0.3, thickness: 0.3),

View File

@ -1,62 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
import 'package:solian/theme.dart';
import 'package:solian/widgets/app_bar_leading.dart';
import 'package:solian/widgets/app_bar_title.dart';
import 'package:solian/widgets/sidebar/sidebar_placeholder.dart';
class SidebarShell extends StatelessWidget {
final bool showAppBar;
final GoRouterState state;
final Widget child;
final bool sidebarFirst;
final Widget? sidebar;
const SidebarShell({
super.key,
required this.child,
required this.state,
this.showAppBar = true,
this.sidebarFirst = false,
this.sidebar,
});
List<Widget> buildContent(BuildContext context) {
return [
Flexible(
flex: 2,
child: child,
),
if (AppTheme.isExtraLargeScreen(context))
const VerticalDivider(thickness: 0.3, width: 1),
if (AppTheme.isExtraLargeScreen(context))
Flexible(
flex: 1,
child: sidebar ?? const SidebarPlaceholder(),
),
];
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: showAppBar
? AppBar(
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle(state.topRoute?.name?.tr ?? 'page'.tr),
centerTitle: false,
toolbarHeight: AppTheme.toolbarHeight(context),
)
: null,
body: AppTheme.isLargeScreen(context)
? Row(
children: sidebarFirst
? buildContent(context).reversed.toList()
: buildContent(context),
)
: child,
);
}
}

View File

@ -6,7 +6,10 @@ abstract class AppTheme {
MediaQuery.of(context).size.width > 640;
static bool isExtraLargeScreen(BuildContext context) =>
MediaQuery.of(context).size.width > 720;
MediaQuery.of(context).size.width > 920;
static bool isUltraLargeScreen(BuildContext context) =>
MediaQuery.of(context).size.width > 1200;
static bool isSpecializedMacOS(BuildContext context) =>
PlatformInfo.isMacOS && !AppTheme.isLargeScreen(context);

View File

@ -98,12 +98,12 @@ class ChannelCallIndicator extends StatelessWidget {
child: Text('callJoin'.tr),
);
} else if (call.channel.value?.id == channel.id &&
!AppTheme.isLargeScreen(context)) {
!AppTheme.isUltraLargeScreen(context)) {
return TextButton(
onPressed: () => onJoin(),
child: Text('callResume'.tr),
);
} else if (!AppTheme.isLargeScreen(context)) {
} else if (!AppTheme.isUltraLargeScreen(context)) {
return TextButton(
onPressed: null,
child: Text('callJoin'.tr),

View File

@ -8,8 +8,11 @@ class EmptyPagePlaceholder extends StatelessWidget {
return Material(
color: Theme.of(context).colorScheme.surface,
child: Center(
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(12)),
child: Image.asset('assets/logo.png', width: 80, height: 80),
),
),
);
}
}