🐛 Bug fixes on background image
This commit is contained in:
@ -178,6 +178,7 @@ abstract class AppRouter {
|
||||
final arguments = state.extra as ChannelDetailArguments;
|
||||
return TitleShell(
|
||||
state: state,
|
||||
isResponsive: true,
|
||||
child: ChannelDetailScreen(
|
||||
channel: arguments.channel,
|
||||
profile: arguments.profile,
|
||||
|
@ -12,7 +12,6 @@ import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/providers/content/attachment.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:solian/widgets/account/account_avatar.dart';
|
||||
import 'package:solian/widgets/root_container.dart';
|
||||
|
||||
class PersonalizeScreen extends StatefulWidget {
|
||||
const PersonalizeScreen({super.key});
|
||||
|
@ -231,7 +231,11 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_isBusy || _userinfo == null) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
return RootContainer(
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return RootContainer(
|
||||
@ -250,7 +254,11 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
|
||||
height: 56,
|
||||
child: Row(
|
||||
children: [
|
||||
AppBarLeadingButton.adaptive(context) ?? const Gap(8),
|
||||
AppBarLeadingButton.adaptive(
|
||||
context,
|
||||
forceBack: true,
|
||||
) ??
|
||||
const Gap(8),
|
||||
const Gap(8),
|
||||
if (_userinfo != null)
|
||||
AccountAvatar(content: _userinfo!.avatar, radius: 16),
|
||||
|
@ -11,7 +11,6 @@ import 'package:solian/providers/content/realm.dart';
|
||||
import 'package:solian/providers/relation.dart';
|
||||
import 'package:solian/providers/websocket.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:solian/widgets/root_container.dart';
|
||||
import 'package:solian/widgets/sized_container.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
|
@ -218,7 +218,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
|
||||
);
|
||||
}
|
||||
|
||||
return RootContainer(
|
||||
return ResponsiveRootContainer(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
|
@ -115,7 +115,7 @@ class _ChannelOrganizeScreenState extends State<ChannelOrganizeScreen> {
|
||||
),
|
||||
];
|
||||
|
||||
return RootContainer(
|
||||
return ResponsiveRootContainer(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: AppBarTitle('channelOrganizing'.tr),
|
||||
|
@ -27,7 +27,7 @@ class ChatScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const RootContainer(
|
||||
return const ResponsiveRootContainer(
|
||||
child: ChatList(),
|
||||
);
|
||||
}
|
||||
@ -140,7 +140,7 @@ class _ChatListState extends State<ChatList> {
|
||||
return Obx(
|
||||
() => DefaultTabController(
|
||||
length: 2 + realms.availableRealms.length,
|
||||
child: RootContainer(
|
||||
child: ResponsiveRootContainer(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: Obx(() {
|
||||
|
@ -10,6 +10,7 @@ import 'package:solian/widgets/root_container.dart';
|
||||
class TitleShell extends StatelessWidget {
|
||||
final bool showAppBar;
|
||||
final bool isCenteredTitle;
|
||||
final bool isResponsive;
|
||||
final String? title;
|
||||
final GoRouterState? state;
|
||||
final Widget child;
|
||||
@ -21,32 +22,37 @@ class TitleShell extends StatelessWidget {
|
||||
this.state,
|
||||
this.showAppBar = true,
|
||||
this.isCenteredTitle = false,
|
||||
this.isResponsive = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
assert(state != null || title != null);
|
||||
|
||||
return RootContainer(
|
||||
child: Scaffold(
|
||||
appBar: showAppBar
|
||||
? AppBar(
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle(
|
||||
title ?? (state!.topRoute?.name?.tr ?? 'page'.tr),
|
||||
final widget = Scaffold(
|
||||
appBar: showAppBar
|
||||
? AppBar(
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle(
|
||||
title ?? (state!.topRoute?.name?.tr ?? 'page'.tr),
|
||||
),
|
||||
centerTitle: isCenteredTitle,
|
||||
toolbarHeight: AppTheme.toolbarHeight(context),
|
||||
actions: [
|
||||
const BackgroundStateWidget(),
|
||||
SizedBox(
|
||||
width: AppTheme.isLargeScreen(context) ? 8 : 16,
|
||||
),
|
||||
centerTitle: isCenteredTitle,
|
||||
toolbarHeight: AppTheme.toolbarHeight(context),
|
||||
actions: [
|
||||
const BackgroundStateWidget(),
|
||||
SizedBox(
|
||||
width: AppTheme.isLargeScreen(context) ? 8 : 16,
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
body: child,
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
body: child,
|
||||
);
|
||||
|
||||
if (isResponsive) {
|
||||
return ResponsiveRootContainer(child: widget);
|
||||
} else {
|
||||
return RootContainer(child: widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
||||
const VisualDensity(horizontal: -4, vertical: -2),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
AppRouter.instance.goNamed(
|
||||
AppRouter.instance.pushNamed(
|
||||
'accountProfilePage',
|
||||
pathParameters: {'name': _userinfo!.name},
|
||||
);
|
||||
|
@ -1,28 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:solian/shells/root_shell.dart';
|
||||
|
||||
class AppBarLeadingButton extends StatelessWidget {
|
||||
const AppBarLeadingButton({super.key});
|
||||
final bool forceBack;
|
||||
|
||||
static Widget? adaptive(BuildContext context) {
|
||||
final hasContent =
|
||||
Navigator.canPop(context) || rootScaffoldKey.currentState!.hasDrawer;
|
||||
return hasContent ? const AppBarLeadingButton() : null;
|
||||
const AppBarLeadingButton({super.key, this.forceBack = false});
|
||||
|
||||
static Widget? adaptive(BuildContext context, {bool forceBack = false}) {
|
||||
final hasContent = Navigator.canPop(context) || forceBack;
|
||||
return hasContent ? AppBarLeadingButton(forceBack: forceBack) : null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (Navigator.canPop(context)) {
|
||||
if (Navigator.canPop(context) || forceBack) {
|
||||
return BackButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
);
|
||||
}
|
||||
if (rootScaffoldKey.currentState!.hasDrawer) {
|
||||
return DrawerButton(
|
||||
onPressed: () => rootScaffoldKey.currentState!.openDrawer(),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:solian/platform.dart';
|
||||
import 'package:solian/theme.dart';
|
||||
|
||||
class RootContainer extends StatelessWidget {
|
||||
final Widget? child;
|
||||
@ -46,3 +47,18 @@ class RootContainer extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ResponsiveRootContainer extends StatelessWidget {
|
||||
final Widget? child;
|
||||
|
||||
const ResponsiveRootContainer({super.key, this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (AppTheme.isLargeScreen(context)) {
|
||||
return child ?? SizedBox.shrink();
|
||||
} else {
|
||||
return RootContainer(child: child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ class EmptyPagePlaceholder extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RootContainer(
|
||||
return ResponsiveRootContainer(
|
||||
child: Center(
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
|
Reference in New Issue
Block a user