From 1f166a7fc2b23415c1be9e1745465de572cfb412 Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su <30667958+hjiangsu@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:36:14 -0700 Subject: [PATCH] Fix theming issues with dependency upgrades (#1587) * fix: theming issues with upgrade to flex_color_scheme * fix: theming account switcher theming * fix: fix search bar elevation --- lib/account/widgets/profile_modal_body.dart | 10 +- lib/community/widgets/community_drawer.dart | 107 ++++++++++---------- lib/settings/pages/settings_page.dart | 5 +- lib/thunder/widgets/bottom_nav_bar.dart | 2 - pubspec.lock | 8 +- pubspec.yaml | 2 +- 6 files changed, 64 insertions(+), 70 deletions(-) diff --git a/lib/account/widgets/profile_modal_body.dart b/lib/account/widgets/profile_modal_body.dart index 2701a950f..9a8a3beed 100644 --- a/lib/account/widgets/profile_modal_body.dart +++ b/lib/account/widgets/profile_modal_body.dart @@ -185,7 +185,7 @@ class _ProfileSelectState extends State { ), ], child: Scaffold( - backgroundColor: theme.cardColor, + backgroundColor: Colors.transparent, body: CustomScrollView( slivers: [ SliverAppBar( @@ -193,6 +193,7 @@ class _ProfileSelectState extends State { centerTitle: false, scrolledUnderElevation: 0, pinned: false, + forceMaterialTransparency: true, actions: !widget.quickSelectMode ? [ if ((accounts?.length ?? 0) > 1) @@ -241,7 +242,7 @@ class _ProfileSelectState extends State { child: Padding( padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), child: Material( - color: currentAccountId == accounts![index].account.id ? selectedColor : null, + color: currentAccountId == accounts![index].account.id ? selectedColor : Colors.transparent, borderRadius: BorderRadius.circular(50), child: InkWell( onTap: (currentAccountId == accounts![index].account.id) @@ -429,7 +430,7 @@ class _ProfileSelectState extends State { if (accounts?.isNotEmpty != true) SliverToBoxAdapter( child: Padding( - padding: const EdgeInsets.only(left: 24.0), + padding: const EdgeInsets.only(left: 24.0, bottom: 16.0), child: Text( l10n.noAccountsAdded, style: theme.textTheme.bodyMedium?.copyWith( @@ -445,6 +446,7 @@ class _ProfileSelectState extends State { centerTitle: false, scrolledUnderElevation: 0, pinned: false, + forceMaterialTransparency: true, actions: !widget.quickSelectMode ? [ if ((anonymousInstances?.length ?? 0) > 1) @@ -494,7 +496,7 @@ class _ProfileSelectState extends State { padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), child: Material( elevation: anonymousInstanceBeingReorderedIndex == index ? 3 : 0, - color: currentAccountId == null && currentAnonymousInstance == anonymousInstances![index].anonymousInstance.instance ? selectedColor : null, + color: currentAccountId == null && currentAnonymousInstance == anonymousInstances![index].anonymousInstance.instance ? selectedColor : Colors.transparent, borderRadius: BorderRadius.circular(50), child: InkWell( onTap: (currentAccountId == null && currentAnonymousInstance == anonymousInstances![index].anonymousInstance.instance) diff --git a/lib/community/widgets/community_drawer.dart b/lib/community/widgets/community_drawer.dart index 005294f0d..a1ff83412 100644 --- a/lib/community/widgets/community_drawer.dart +++ b/lib/community/widgets/community_drawer.dart @@ -153,66 +153,61 @@ class UserDrawerItem extends StatelessWidget { bool isLoggedIn = context.watch().state.isLoggedIn; String? anonymousInstance = context.watch().state.currentAnonymousInstance; - return Material( - color: theme.colorScheme.surface, - elevation: 1.0, - surfaceTintColor: theme.colorScheme.surfaceTint, - shadowColor: Colors.transparent, - child: Padding( - padding: const EdgeInsets.fromLTRB(13.0, 16.0, 4.0, 0), - child: TextButton( - style: TextButton.styleFrom( - alignment: Alignment.centerLeft, - minimumSize: const Size.fromHeight(50), - ), - onPressed: () => navigateToAccount?.call(), - child: Row( - children: [ - UserAvatar( - person: isLoggedIn ? accountState.personView?.person : null, - radius: 16.0, - ), - const SizedBox(width: 16.0), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - if (!isLoggedIn) ...[ - Icon( - Icons.person_off_rounded, - color: theme.textTheme.bodyMedium?.color, - size: 15, - ), - const SizedBox(width: 5), - ], - Text( - isLoggedIn ? accountState.personView?.person.name ?? '' : l10n.anonymous, - style: theme.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500), - maxLines: 1, - overflow: TextOverflow.ellipsis, + return Container( + color: theme.colorScheme.surfaceContainerLow, + padding: const EdgeInsets.fromLTRB(13.0, 16.0, 4.0, 0), + child: TextButton( + style: TextButton.styleFrom( + alignment: Alignment.centerLeft, + minimumSize: const Size.fromHeight(50), + ), + onPressed: () => navigateToAccount?.call(), + child: Row( + children: [ + UserAvatar( + person: isLoggedIn ? accountState.personView?.person : null, + radius: 16.0, + ), + const SizedBox(width: 16.0), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + if (!isLoggedIn) ...[ + Icon( + Icons.person_off_rounded, + color: theme.textTheme.bodyMedium?.color, + size: 15, ), + const SizedBox(width: 5), ], - ), - Text( - isLoggedIn ? authState.account?.instance ?? '' : anonymousInstance ?? '', - style: theme.textTheme.bodyMedium, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ], - ), - const Expanded(child: SizedBox()), - IconButton( - icon: Icon( - Icons.more_vert_outlined, - color: theme.textTheme.bodyMedium?.color, - semanticLabel: l10n.openAccountSwitcher, + Text( + isLoggedIn ? accountState.personView?.person.name ?? '' : l10n.anonymous, + style: theme.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], ), - onPressed: () => showProfileModalSheet(context), + Text( + isLoggedIn ? authState.account?.instance ?? '' : anonymousInstance ?? '', + style: theme.textTheme.bodyMedium, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + const Expanded(child: SizedBox()), + IconButton( + icon: Icon( + Icons.more_vert_outlined, + color: theme.textTheme.bodyMedium?.color, + semanticLabel: l10n.openAccountSwitcher, ), - ], - ), + onPressed: () => showProfileModalSheet(context), + ), + ], ), ), ); diff --git a/lib/settings/pages/settings_page.dart b/lib/settings/pages/settings_page.dart index 5d9901d90..e91ff104c 100644 --- a/lib/settings/pages/settings_page.dart +++ b/lib/settings/pages/settings_page.dart @@ -60,7 +60,7 @@ class _SettingsPageState extends State { ), SliverToBoxAdapter( child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 18), + padding: const EdgeInsets.symmetric(horizontal: 18).copyWith(top: 16.0), child: FocusableActionDetector( onFocusChange: (focused) { if (focused) { @@ -70,9 +70,8 @@ class _SettingsPageState extends State { }, child: SearchAnchor.bar( searchController: _searchController, - barBackgroundColor: MaterialStatePropertyAll(Theme.of(context).colorScheme.surfaceVariant), - barElevation: MaterialStateProperty.all(0), barHintText: l10n.search, + barElevation: const WidgetStatePropertyAll(0.0), suggestionsBuilder: (BuildContext context, SearchController controller) { final List localSettings = LocalSettings.values .where((item) => diff --git a/lib/thunder/widgets/bottom_nav_bar.dart b/lib/thunder/widgets/bottom_nav_bar.dart index fda3797b7..b78f9b519 100644 --- a/lib/thunder/widgets/bottom_nav_bar.dart +++ b/lib/thunder/widgets/bottom_nav_bar.dart @@ -95,9 +95,7 @@ class _CustomBottomNavigationBarState extends State { onDoubleTap: state.bottomNavBarDoubleTapGestures == true ? () => _handleDoubleTap(context) : null, child: NavigationBar( selectedIndex: widget.selectedPageIndex, - backgroundColor: theme.colorScheme.surface, labelBehavior: state.showNavigationLabels ? NavigationDestinationLabelBehavior.alwaysShow : NavigationDestinationLabelBehavior.alwaysHide, - elevation: 1, destinations: [ NavigationDestination( icon: const Icon(Icons.dashboard_outlined), diff --git a/pubspec.lock b/pubspec.lock index aeb48a01a..a992f991b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -530,18 +530,18 @@ packages: dependency: "direct main" description: name: flex_color_scheme - sha256: "32914024a4f404d90ff449f58d279191675b28e7c08824046baf06826e99d984" + sha256: aab8db18233d4daf03336b2c22588820509a3a5261658c4042f029e8ed920c7d url: "https://pub.dev" source: hosted - version: "7.3.1" + version: "8.0.0-dev.2" flex_seed_scheme: dependency: transitive description: name: flex_seed_scheme - sha256: "4cee2f1d07259f77e8b36f4ec5f35499d19e74e17c7dce5b819554914082bc01" + sha256: "7639d2c86268eff84a909026eb169f008064af0fb3696a651b24b0fa24a40334" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "3.4.1" flutter: dependency: "direct main" description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index e92745841..a1dac1f1f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,7 @@ dependencies: expandable: "^5.0.1" extended_image: "^8.2.0" fading_edge_scrollview: "^4.1.1" - flex_color_scheme: "^7.1.2" + flex_color_scheme: "^8.0.0-dev.2" flutter_bloc: "^8.1.3" flutter_cache_manager: "^3.3.0" flutter_custom_tabs: "^2.0.0-beta.1"