From 31bee4724d253220f761688c0a7b18187ebb31e9 Mon Sep 17 00:00:00 2001 From: Frederik Feichtmeier Date: Thu, 14 Nov 2024 19:09:13 +0100 Subject: [PATCH] feat: update theme packages and remove chip theme modifications (#1014) --- lib/common/view/theme.dart | 17 -------------- .../view/local_audio_control_panel.dart | 9 +------- .../podcast_collection_control_panel.dart | 10 +------- lib/radio/view/radio_lib_page.dart | 10 +------- .../view/sliver_podcast_filter_bar.dart | 9 +------- .../view/sliver_search_type_filter_bar.dart | 9 +------- pubspec.lock | 23 ++++++++++--------- pubspec.yaml | 7 ++++-- 8 files changed, 22 insertions(+), 72 deletions(-) diff --git a/lib/common/view/theme.dart b/lib/common/view/theme.dart index a8bf1b81b..9e0eba423 100644 --- a/lib/common/view/theme.dart +++ b/lib/common/view/theme.dart @@ -201,23 +201,6 @@ InputDecoration createYaruDecoration({ ); } -Color? chipColor(ColorScheme colorScheme) { - return yaruStyled - ? colorScheme.surface.scale(lightness: colorScheme.isDark ? 0.03 : -0.1) - : null; -} - -Color? chipBorder(bool loading) { - return yaruStyled ? (loading ? null : Colors.transparent) : null; -} - -TextStyle chipTextStyle(ColorScheme colorScheme) => - TextStyle(color: colorScheme.onSurface); - -Color? chipSelectionColor(ColorScheme colorScheme, bool loading) { - return yaruStyled ? (loading ? colorScheme.outline : null) : null; -} - double get iconSize => yaruStyled ? kYaruIconSize : isMobile diff --git a/lib/local_audio/view/local_audio_control_panel.dart b/lib/local_audio/view/local_audio_control_panel.dart index e12e3c27a..92d989cd8 100644 --- a/lib/local_audio/view/local_audio_control_panel.dart +++ b/lib/local_audio/view/local_audio_control_panel.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; -import '../../common/view/theme.dart'; -import '../../extensions/build_context_x.dart'; import '../../l10n/l10n.dart'; import '../local_audio_model.dart'; import 'local_audio_view.dart'; @@ -13,7 +11,6 @@ class LocalAudioControlPanel extends StatelessWidget with WatchItMixin { @override Widget build(BuildContext context) { - final colorScheme = context.colorScheme; final index = watchPropertyValue((LocalAudioModel m) => m.localAudioindex); return Align( @@ -21,17 +18,13 @@ class LocalAudioControlPanel extends StatelessWidget with WatchItMixin { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), child: YaruChoiceChipBar( - yaruChoiceChipBarStyle: YaruChoiceChipBarStyle.stack, - chipBackgroundColor: chipColor(colorScheme), - selectedChipBackgroundColor: chipSelectionColor(colorScheme, false), - borderColor: chipBorder(false), + style: YaruChoiceChipBarStyle.stack, selectedFirst: false, clearOnSelect: false, labels: LocalAudioView.values .map( (e) => Text( e.localize(context.l10n), - style: chipTextStyle(colorScheme), ), ) .toList(), diff --git a/lib/podcasts/view/podcast_collection_control_panel.dart b/lib/podcasts/view/podcast_collection_control_panel.dart index c5ca132f0..9def3a6a4 100644 --- a/lib/podcasts/view/podcast_collection_control_panel.dart +++ b/lib/podcasts/view/podcast_collection_control_panel.dart @@ -4,8 +4,6 @@ import 'package:yaru/yaru.dart'; import '../../app/connectivity_model.dart'; import '../../common/view/offline_page.dart'; -import '../../common/view/theme.dart'; -import '../../extensions/build_context_x.dart'; import '../../l10n/l10n.dart'; import '../podcast_model.dart'; @@ -14,7 +12,6 @@ class PodcastCollectionControlPanel extends StatelessWidget with WatchItMixin { @override Widget build(BuildContext context) { - final colorScheme = context.colorScheme; final model = di(); final isOnline = watchPropertyValue((ConnectivityModel m) => m.isOnline); @@ -27,20 +24,15 @@ class PodcastCollectionControlPanel extends StatelessWidget with WatchItMixin { watchPropertyValue((PodcastModel m) => m.downloadsOnly); return YaruChoiceChipBar( - chipBackgroundColor: chipColor(colorScheme), - selectedChipBackgroundColor: chipSelectionColor(colorScheme, loading), - borderColor: chipBorder(loading), - yaruChoiceChipBarStyle: YaruChoiceChipBarStyle.wrap, + style: YaruChoiceChipBarStyle.wrap, clearOnSelect: false, selectedFirst: false, labels: [ Text( context.l10n.newEpisodes, - style: chipTextStyle(colorScheme), ), Text( context.l10n.downloadsOnly, - style: chipTextStyle(colorScheme), ), ], isSelected: [ diff --git a/lib/radio/view/radio_lib_page.dart b/lib/radio/view/radio_lib_page.dart index 421cdc748..aa2642182 100644 --- a/lib/radio/view/radio_lib_page.dart +++ b/lib/radio/view/radio_lib_page.dart @@ -29,7 +29,6 @@ class RadioLibPage extends StatelessWidget with WatchItMixin { @override Widget build(BuildContext context) { - final colorScheme = context.colorScheme; final radioCollectionView = watchPropertyValue((RadioModel m) => m.radioCollectionView); final radioModel = di(); @@ -44,27 +43,20 @@ class RadioLibPage extends StatelessWidget with WatchItMixin { margin: filterPanelPadding, height: context.theme.appBarTheme.toolbarHeight, child: YaruChoiceChipBar( - chipBackgroundColor: chipColor(colorScheme), - selectedChipBackgroundColor: - chipSelectionColor(colorScheme, false), - borderColor: chipBorder(false), selectedFirst: false, clearOnSelect: false, onSelected: (index) => radioModel .setRadioCollectionView(RadioCollectionView.values[index]), - yaruChoiceChipBarStyle: YaruChoiceChipBarStyle.wrap, + style: YaruChoiceChipBarStyle.wrap, labels: [ Text( context.l10n.station, - style: chipTextStyle(colorScheme), ), Text( context.l10n.tags, - style: chipTextStyle(colorScheme), ), Text( context.l10n.hearingHistory, - style: chipTextStyle(colorScheme), ), ], isSelected: RadioCollectionView.values diff --git a/lib/search/view/sliver_podcast_filter_bar.dart b/lib/search/view/sliver_podcast_filter_bar.dart index b8cbf4254..30a4d7693 100644 --- a/lib/search/view/sliver_podcast_filter_bar.dart +++ b/lib/search/view/sliver_podcast_filter_bar.dart @@ -3,8 +3,6 @@ import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; import '../../common/data/podcast_genre.dart'; -import '../../common/view/theme.dart'; -import '../../extensions/build_context_x.dart'; import '../../l10n/l10n.dart'; import '../../settings/settings_model.dart'; import '../search_model.dart'; @@ -14,7 +12,6 @@ class SliverPodcastFilterBar extends StatelessWidget with WatchItMixin { @override Widget build(BuildContext context) { - final colorScheme = context.colorScheme; final searchModel = di(); final podcastGenre = watchPropertyValue((SearchModel m) => m.podcastGenre); @@ -29,15 +26,11 @@ class SliverPodcastFilterBar extends StatelessWidget with WatchItMixin { return Padding( padding: const EdgeInsets.symmetric(horizontal: 5), child: YaruChoiceChipBar( - chipBackgroundColor: chipColor(colorScheme), - selectedChipBackgroundColor: chipSelectionColor(colorScheme, false), - borderColor: chipBorder(false), - yaruChoiceChipBarStyle: YaruChoiceChipBarStyle.stack, + style: YaruChoiceChipBarStyle.stack, labels: genres .map( (e) => Text( e.localize(context.l10n), - style: chipTextStyle(colorScheme), ), ) .toList(), diff --git a/lib/search/view/sliver_search_type_filter_bar.dart b/lib/search/view/sliver_search_type_filter_bar.dart index 978e216e4..bccee2037 100644 --- a/lib/search/view/sliver_search_type_filter_bar.dart +++ b/lib/search/view/sliver_search_type_filter_bar.dart @@ -2,8 +2,6 @@ import 'package:flutter/material.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; -import '../../common/view/theme.dart'; -import '../../extensions/build_context_x.dart'; import '../../l10n/l10n.dart'; import '../../local_audio/local_audio_service.dart'; import '../search_model.dart'; @@ -14,7 +12,6 @@ class SearchTypeFilterBar extends StatelessWidget with WatchItMixin { @override Widget build(BuildContext context) { - final colorScheme = context.colorScheme; final searchModel = di(); final searchType = watchPropertyValue((SearchModel m) => m.searchType); final searchTypes = watchPropertyValue((SearchModel m) => m.searchTypes); @@ -25,10 +22,7 @@ class SearchTypeFilterBar extends StatelessWidget with WatchItMixin { return Padding( padding: const EdgeInsets.symmetric(horizontal: 5), child: YaruChoiceChipBar( - yaruChoiceChipBarStyle: YaruChoiceChipBarStyle.stack, - chipBackgroundColor: chipColor(colorScheme), - selectedChipBackgroundColor: chipSelectionColor(colorScheme, false), - borderColor: chipBorder(false), + style: YaruChoiceChipBarStyle.stack, clearOnSelect: false, selectedFirst: false, onSelected: (i) { @@ -44,7 +38,6 @@ class SearchTypeFilterBar extends StatelessWidget with WatchItMixin { localSearchResult: localSearchResult, searchQuery: searchQuery, ), - style: chipTextStyle(colorScheme), ), ) .toList(), diff --git a/pubspec.lock b/pubspec.lock index 7cbf18f8d..1c1ad4859 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -34,18 +34,18 @@ packages: dependency: transitive description: name: animated_vector - sha256: e15c6596549ca6e2e7491c11fbe168a1dead87475a828a4bc81cf104feca0432 + sha256: f1beb10e6fcfd8bd15abb788e20345def786d1c7391d7c1426bb2a1f2adf2132 url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.2.2" animated_vector_annotations: dependency: transitive description: name: animated_vector_annotations - sha256: baa6b4ed98407220f2c9634f7da3cfa5eedb46798e090466f441e666e2f7c8c0 + sha256: "07c1ea603a2096f7eb6f1c2b8f16c3c330c680843ea78b7782a3217c3c53f979" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.2.2" archive: dependency: transitive description: @@ -1105,8 +1105,8 @@ packages: dependency: "direct main" description: path: "." - ref: "0a122e798c87366d74a08bc1f1104e8aa0910ee3" - resolved-ref: "0a122e798c87366d74a08bc1f1104e8aa0910ee3" + ref: adbc04c8571a560ae0bae8afd10f95d4734c1ec5 + resolved-ref: adbc04c8571a560ae0bae8afd10f95d4734c1ec5 url: "https://github.com/ubuntu-flutter-community/phoenix_theme" source: git version: "1.0.1" @@ -1798,11 +1798,12 @@ packages: yaru: dependency: "direct main" description: - name: yaru - sha256: b226f045d3104422d7f4d87572cc57c75b7d5695adf6fa47dbab3bc664714e69 - url: "https://pub.dev" - source: hosted - version: "5.3.1" + path: "." + ref: "9d1558be124005c89c1e320f1a42d582e110693c" + resolved-ref: "9d1558be124005c89c1e320f1a42d582e110693c" + url: "https://github.com/ubuntu/yaru.dart" + source: git + version: "5.3.2" yaru_window: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index d7c4c0745..29c0745f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -59,7 +59,7 @@ dependencies: phoenix_theme: git: url: https://github.com/ubuntu-flutter-community/phoenix_theme - ref: 0a122e798c87366d74a08bc1f1104e8aa0910ee3 + ref: adbc04c8571a560ae0bae8afd10f95d4734c1ec5 pls: ^1.1.0 podcast_search: ^0.7.3 radio_browser_api: ^2.0.0 @@ -76,7 +76,10 @@ dependencies: win32: ^5.5.4 window_manager: ^0.4.2 xdg_directories: ^1.0.4 - yaru: ^5.2.1 + yaru: + git: + url: https://github.com/ubuntu/yaru.dart + ref: 9d1558be124005c89c1e320f1a42d582e110693c yaru_window: ^0.2.1+1 yaru_window_linux: ^0.2.0+1