From 5d5547ffef3014bbd1af53937f5a2bbb55eb3386 Mon Sep 17 00:00:00 2001 From: 21pages Date: Fri, 19 Apr 2024 12:44:52 +0800 Subject: [PATCH] put andriod custom client logo to settings section list (#7768) Signed-off-by: 21pages --- flutter/lib/mobile/pages/home_page.dart | 4 ++- flutter/lib/mobile/pages/settings_page.dart | 30 +++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/flutter/lib/mobile/pages/home_page.dart b/flutter/lib/mobile/pages/home_page.dart index 0f3e7b20a..078e2b2f7 100644 --- a/flutter/lib/mobile/pages/home_page.dart +++ b/flutter/lib/mobile/pages/home_page.dart @@ -26,8 +26,9 @@ class HomePageState extends State { var _selectedIndex = 0; int get selectedIndex => _selectedIndex; final List _pages = []; + int _chatPageTabIndex = -1; bool get isChatPageCurrentTab => isAndroid - ? _selectedIndex == 1 + ? _selectedIndex == _chatPageTabIndex : false; // change this when ios have chat page void refreshPages() { @@ -46,6 +47,7 @@ class HomePageState extends State { _pages.clear(); if (!bind.isIncomingOnly()) _pages.add(ConnectionPage()); if (isAndroid && !bind.isOutgoingOnly()) { + _chatPageTabIndex = _pages.length; _pages.addAll([ChatPage(type: ChatPageType.mobileMain), ServerPage()]); } _pages.add(SettingsPage()); diff --git a/flutter/lib/mobile/pages/settings_page.dart b/flutter/lib/mobile/pages/settings_page.dart index e79310650..9477cbe6a 100644 --- a/flutter/lib/mobile/pages/settings_page.dart +++ b/flutter/lib/mobile/pages/settings_page.dart @@ -219,6 +219,20 @@ class _SettingsState extends State with WidgetsBindingObserver { Widget build(BuildContext context) { Provider.of(context); final outgoingOnly = bind.isOutgoingOnly(); + final customClientSection = CustomSettingsSection( + child: Column( + children: [ + if (bind.isCustomClient()) + Align( + alignment: Alignment.center, + child: loadPowered(context), + ), + Align( + alignment: Alignment.center, + child: loadLogo(), + ) + ], + )); final List enhancementsTiles = []; final List shareScreenTiles = [ SettingsTile.switchTile( @@ -452,6 +466,7 @@ class _SettingsState extends State with WidgetsBindingObserver { final disabledSettings = bind.isDisableSettings(); final settings = SettingsList( sections: [ + customClientSection, if (!bind.isDisableAccount()) SettingsSection( title: Text(translate('Account')), @@ -582,20 +597,7 @@ class _SettingsState extends State with WidgetsBindingObserver { ), ], ); - return Column( - children: [ - if (bind.isCustomClient()) - Align( - alignment: Alignment.center, - child: loadPowered(context), - ), - Align( - alignment: Alignment.center, - child: loadLogo(), - ), - settings - ], - ); + return settings; } Future canStartOnBoot() async {