Skip to content

Commit

Permalink
Fix theming issues with dependency upgrades (thunder-app#1587)
Browse files Browse the repository at this point in the history
* fix: theming issues with upgrade to flex_color_scheme

* fix: theming account switcher theming

* fix: fix search bar elevation
  • Loading branch information
hjiangsu authored Oct 29, 2024
1 parent 45ccc75 commit 1f166a7
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 70 deletions.
10 changes: 6 additions & 4 deletions lib/account/widgets/profile_modal_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,15 @@ class _ProfileSelectState extends State<ProfileSelect> {
),
],
child: Scaffold(
backgroundColor: theme.cardColor,
backgroundColor: Colors.transparent,
body: CustomScrollView(
slivers: [
SliverAppBar(
title: Text(widget.customHeading ?? l10n.account(2)),
centerTitle: false,
scrolledUnderElevation: 0,
pinned: false,
forceMaterialTransparency: true,
actions: !widget.quickSelectMode
? [
if ((accounts?.length ?? 0) > 1)
Expand Down Expand Up @@ -241,7 +242,7 @@ class _ProfileSelectState extends State<ProfileSelect> {
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)
Expand Down Expand Up @@ -429,7 +430,7 @@ class _ProfileSelectState extends State<ProfileSelect> {
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(
Expand All @@ -445,6 +446,7 @@ class _ProfileSelectState extends State<ProfileSelect> {
centerTitle: false,
scrolledUnderElevation: 0,
pinned: false,
forceMaterialTransparency: true,
actions: !widget.quickSelectMode
? [
if ((anonymousInstances?.length ?? 0) > 1)
Expand Down Expand Up @@ -494,7 +496,7 @@ class _ProfileSelectState extends State<ProfileSelect> {
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)
Expand Down
107 changes: 51 additions & 56 deletions lib/community/widgets/community_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,66 +153,61 @@ class UserDrawerItem extends StatelessWidget {
bool isLoggedIn = context.watch<AuthBloc>().state.isLoggedIn;
String? anonymousInstance = context.watch<ThunderBloc>().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),
),
],
),
),
);
Expand Down
5 changes: 2 additions & 3 deletions lib/settings/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _SettingsPageState extends State<SettingsPage> {
),
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) {
Expand All @@ -70,9 +70,8 @@ class _SettingsPageState extends State<SettingsPage> {
},
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 = LocalSettings.values
.where((item) =>
Expand Down
2 changes: 0 additions & 2 deletions lib/thunder/widgets/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {
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),
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1f166a7

Please sign in to comment.