feat: libadwaita theming, track tile and PlayButtonCard play button icon fix

This commit is contained in:
Kingkor Roy Tirtho 2022-11-06 14:48:13 +06:00
parent 36c5e02f18
commit e795e23e42
9 changed files with 115 additions and 27 deletions

View File

@ -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,

View File

@ -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,
),
);

View File

@ -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();

View File

@ -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,
),
@ -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,
@ -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,
@ -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,
@ -137,7 +146,7 @@ class PlaybuttonCard extends HookWidget {
isPlaying
? Icons.pause_rounded
: Icons.play_arrow_rounded,
color: backgroundColor,
color: Colors.white,
),
),
);

View File

@ -214,18 +214,24 @@ class TrackTile extends HookConsumerWidget {
),
),
),
PlatformIconButton(
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_circle_rounded
: Icons.play_circle_rounded,
color: PlatformTheme.of(context).primaryColor,
? 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(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -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,

View File

@ -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';
@ -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,
),
);

View File

@ -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:
@ -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
@ -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:
@ -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:
@ -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:
@ -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:
@ -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:

View File

@ -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: