Skip to content

Commit

Permalink
feat: update theme packages and remove chip theme modifications (#1014)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Nov 14, 2024
1 parent 316adf5 commit 31bee47
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 72 deletions.
17 changes: 0 additions & 17 deletions lib/common/view/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions lib/local_audio/view/local_audio_control_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -13,25 +11,20 @@ class LocalAudioControlPanel extends StatelessWidget with WatchItMixin {

@override
Widget build(BuildContext context) {
final colorScheme = context.colorScheme;
final index = watchPropertyValue((LocalAudioModel m) => m.localAudioindex);

return Align(
alignment: Alignment.center,
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(),
Expand Down
10 changes: 1 addition & 9 deletions lib/podcasts/view/podcast_collection_control_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -14,7 +12,6 @@ class PodcastCollectionControlPanel extends StatelessWidget with WatchItMixin {

@override
Widget build(BuildContext context) {
final colorScheme = context.colorScheme;
final model = di<PodcastModel>();

final isOnline = watchPropertyValue((ConnectivityModel m) => m.isOnline);
Expand All @@ -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: [
Expand Down
10 changes: 1 addition & 9 deletions lib/radio/view/radio_lib_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<RadioModel>();
Expand All @@ -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
Expand Down
9 changes: 1 addition & 8 deletions lib/search/view/sliver_podcast_filter_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -14,7 +12,6 @@ class SliverPodcastFilterBar extends StatelessWidget with WatchItMixin {

@override
Widget build(BuildContext context) {
final colorScheme = context.colorScheme;
final searchModel = di<SearchModel>();

final podcastGenre = watchPropertyValue((SearchModel m) => m.podcastGenre);
Expand All @@ -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(),
Expand Down
9 changes: 1 addition & 8 deletions lib/search/view/sliver_search_type_filter_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -14,7 +12,6 @@ class SearchTypeFilterBar extends StatelessWidget with WatchItMixin {

@override
Widget build(BuildContext context) {
final colorScheme = context.colorScheme;
final searchModel = di<SearchModel>();
final searchType = watchPropertyValue((SearchModel m) => m.searchType);
final searchTypes = watchPropertyValue((SearchModel m) => m.searchTypes);
Expand All @@ -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) {
Expand All @@ -44,7 +38,6 @@ class SearchTypeFilterBar extends StatelessWidget with WatchItMixin {
localSearchResult: localSearchResult,
searchQuery: searchQuery,
),
style: chipTextStyle(colorScheme),
),
)
.toList(),
Expand Down
23 changes: 12 additions & 11 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 31bee47

Please sign in to comment.