✨ Adaptive app bar leading
This commit is contained in:
parent
a2db9a7ae4
commit
156e6f1075
@ -130,7 +130,7 @@ class _ArticlePublishScreenState extends State<ArticlePublishScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle('articlePublish'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -56,7 +56,7 @@ class _CallScreenState extends State<CallScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
centerTitle: true,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
title: RichText(
|
||||
|
@ -193,7 +193,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle(title),
|
||||
centerTitle: false,
|
||||
titleSpacing: SolianTheme.titleSpacing(context),
|
||||
|
@ -44,7 +44,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle('chat'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -63,7 +63,7 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle('draftBox'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -64,7 +64,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
centerTitle: false,
|
||||
floating: true,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
actions: [
|
||||
const BackgroundStateWidget(),
|
||||
const NotificationButton(),
|
||||
|
@ -134,7 +134,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle('postPublish'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -59,7 +59,7 @@ class _RealmListScreenState extends State<RealmListScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle('realm'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -99,7 +99,7 @@ class _RealmOrganizeScreenState extends State<RealmOrganizeScreen> {
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle('realmOrganizing'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -91,7 +91,7 @@ class _RealmViewScreenState extends State<RealmViewScreen> {
|
||||
handle:
|
||||
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
sliver: SliverAppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: Text(_realm?.name ?? 'loading'.tr),
|
||||
centerTitle: false,
|
||||
actions: [
|
||||
|
@ -22,7 +22,7 @@ class CenteredShell extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: showAppBar
|
||||
? AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle(state.topRoute?.name?.tr ?? 'page'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -44,7 +44,7 @@ class SidebarShell extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: showAppBar
|
||||
? AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle(state.topRoute?.name?.tr ?? 'page'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -22,7 +22,7 @@ class TitleShell extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: showAppBar
|
||||
? AppBar(
|
||||
leading: const AppBarLeadingButton(),
|
||||
leading: AppBarLeadingButton.adaptive(context),
|
||||
title: AppBarTitle(state.topRoute?.name?.tr ?? 'page'.tr),
|
||||
centerTitle: false,
|
||||
toolbarHeight: SolianTheme.toolbarHeight(context),
|
||||
|
@ -4,6 +4,12 @@ import 'package:solian/shells/root_shell.dart';
|
||||
class AppBarLeadingButton extends StatelessWidget {
|
||||
const AppBarLeadingButton({super.key});
|
||||
|
||||
static Widget? adaptive(BuildContext context) {
|
||||
final hasContent =
|
||||
Navigator.canPop(context) || rootScaffoldKey.currentState!.hasDrawer;
|
||||
return hasContent ? const AppBarLeadingButton() : null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (Navigator.canPop(context)) {
|
||||
|
Loading…
Reference in New Issue
Block a user