Skip to content

Commit

Permalink
feat: libadwaita theming, track tile and PlayButtonCard play button i…
Browse files Browse the repository at this point in the history
…con fix
  • Loading branch information
KRTirtho committed Nov 6, 2022
1 parent 36c5e02 commit e795e23
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 27 deletions.
5 changes: 1 addition & 4 deletions lib/components/Home/Sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,7 @@ class Sidebar extends HookConsumerWidget {
const SizedBox(
width: 10,
),
Text(
"Spotube",
style: PlatformTheme.of(context).textTheme?.headline,
),
PlatformText.headline("Spotube"),
PlatformIconButton(
icon: const Icon(Icons.menu_rounded),
onPressed: toggleExtended,
Expand Down
7 changes: 6 additions & 1 deletion lib/components/Player/Player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ class Player extends HookConsumerWidget {
width: 1,
),
),
linux: null,
linux: Border(
top: BorderSide(
color: PlatformTheme.of(context).borderColor ?? Colors.transparent,
width: 1,
),
),
windows: null,
),
);
Expand Down
5 changes: 1 addition & 4 deletions lib/components/Search/Search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ class Search extends HookConsumerWidget {
onChanged: (value) {
ref.read(searchTermStateProvider.notifier).state = value;
},
suffix: PlatformFilledButton(
onPressed: onSearch,
child: const Icon(Icons.search_rounded),
),
prefixIcon: Icons.search_rounded,
placeholder: "Search...",
onSubmitted: (value) {
onSearch();
Expand Down
23 changes: 16 additions & 7 deletions lib/components/Shared/PlaybuttonCard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ class PlaybuttonCard extends HookWidget {
ios: null,
macos: null,
linux: BoxShadow(
blurRadius: 10,
offset: const Offset(0, 3),
spreadRadius: 5,
color: Theme.of(context).shadowColor,
blurRadius: 6,
color: Theme.of(context).shadowColor.withOpacity(0.3),
),
windows: null,
),
Expand Down Expand Up @@ -78,7 +76,10 @@ class PlaybuttonCard extends HookWidget {
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(
platform == TargetPlatform.windows ? 5 : 8,
[TargetPlatform.windows, TargetPlatform.linux]
.contains(platform)
? 5
: 8,
),
boxShadow: [
if (boxShadow != null) boxShadow,
Expand All @@ -104,7 +105,10 @@ class PlaybuttonCard extends HookWidget {
),
child: ClipRRect(
borderRadius: BorderRadius.circular(
platform == TargetPlatform.windows ? 5 : 8,
[TargetPlatform.windows, TargetPlatform.linux]
.contains(platform)
? 5
: 8,
),
child: UniversalImage(
path: imageUrl,
Expand All @@ -126,6 +130,11 @@ class PlaybuttonCard extends HookWidget {
),
child: PlatformIconButton(
onPressed: onPlaybuttonPressed,
backgroundColor:
PlatformTheme.of(context).primaryColor,
hoverColor: PlatformTheme.of(context)
.primaryColor
?.withOpacity(0.5),
icon: isLoading
? const SizedBox(
height: 23,
Expand All @@ -137,7 +146,7 @@ class PlaybuttonCard extends HookWidget {
isPlaying
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: backgroundColor,
color: Colors.white,
),
),
);
Expand Down
26 changes: 16 additions & 10 deletions lib/components/Shared/TrackTile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,22 @@ class TrackTile extends HookConsumerWidget {
),
),
),
PlatformIconButton(
icon: Icon(
playback.track?.id != null &&
playback.track?.id == track.value.id
? Icons.pause_circle_rounded
: Icons.play_circle_rounded,
color: PlatformTheme.of(context).primaryColor,
),
onPressed: () => onTrackPlayButtonPressed?.call(
track.value,
Padding(
padding: const EdgeInsets.all(8.0).copyWith(left: 0),
child: PlatformIconButton(
icon: Icon(
playback.track?.id != null &&
playback.track?.id == track.value.id
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: Colors.white,
),
backgroundColor: PlatformTheme.of(context).primaryColor,
hoverColor:
PlatformTheme.of(context).primaryColor?.withOpacity(0.5),
onPressed: () => onTrackPlayButtonPressed?.call(
track.value,
),
),
),
Expanded(
Expand Down
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
accentMaterialColor: accentMaterialColor,
backgroundMaterialColor: backgroundMaterialColor,
),
linuxTheme: linuxTheme,
linuxDarkTheme: linuxDarkTheme,
iosTheme: themeMode == ThemeMode.dark ? iosDarkTheme : iosTheme,
windowsTheme: windowsTheme,
windowsDarkTheme: windowsDarkTheme,
Expand Down
14 changes: 14 additions & 0 deletions lib/themes/light-theme.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:adwaita/adwaita.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:macos_ui/macos_ui.dart';
Expand Down Expand Up @@ -149,3 +150,16 @@ final macosDarkTheme = MacosThemeData.dark().copyWith(
);
const iosTheme = CupertinoThemeData(brightness: Brightness.light);
const iosDarkTheme = CupertinoThemeData(brightness: Brightness.dark);

final linuxTheme = AdwaitaThemeData.light().copyWith(
listTileTheme: ListTileThemeData(
iconColor: Colors.grey[900],
horizontalTitleGap: 0,
),
);
final linuxDarkTheme = AdwaitaThemeData.dark().copyWith(
listTileTheme: ListTileThemeData(
iconColor: Colors.grey[50],
horizontalTitleGap: 0,
),
);
58 changes: 57 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "47.0.0"
adwaita:
dependency: "direct main"
description:
name: adwaita
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.2"
analyzer:
dependency: transitive
description:
Expand Down Expand Up @@ -594,6 +601,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.42.0"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -639,6 +653,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
gsettings:
dependency: transitive
description:
name: gsettings
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
hive:
dependency: "direct main"
description:
Expand Down Expand Up @@ -737,6 +758,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
libadwaita:
dependency: "direct main"
description:
name: libadwaita
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
libadwaita_core:
dependency: transitive
description:
name: libadwaita_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.4"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -893,6 +928,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
path_provider:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1004,7 +1053,7 @@ packages:
path: "../platform_ui"
relative: true
source: path
version: "0.0.1"
version: "0.1.0"
plugin_platform_interface:
dependency: transitive
description:
Expand All @@ -1026,6 +1075,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.6+3"
popover_gtk:
dependency: transitive
description:
name: popover_gtk
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.6+3"
process:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ dependencies:
path: ../platform_ui
fluent_ui: ^4.0.3
macos_ui: ^1.7.5
libadwaita: ^1.2.5
adwaita: ^0.5.2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit e795e23

Please sign in to comment.