fix(mobile): SafeArea bugs and back button color

This commit is contained in:
Kingkor Roy Tirtho 2022-11-24 12:12:55 +06:00
parent 3b6bf27a98
commit a8330ef2e1
6 changed files with 322 additions and 311 deletions

View File

@ -11,6 +11,7 @@ import 'package:spotube/components/Shared/Waypoint.dart';
import 'package:spotube/provider/SpotifyDI.dart';
import 'package:spotube/provider/SpotifyRequests.dart';
import 'package:spotube/provider/UserPreferences.dart';
import 'package:spotube/utils/platform.dart';
class Genres extends HookConsumerWidget {
const Genres({Key? key}) : super(key: key);
@ -43,7 +44,7 @@ class Genres extends HookConsumerWidget {
];
return PlatformScaffold(
appBar: PageWindowTitleBar(),
appBar: kIsDesktop ? PageWindowTitleBar() : null,
body: ListView.builder(
itemCount: categories.length,
itemBuilder: (context, index) {

View File

@ -23,7 +23,8 @@ class UserLibrary extends HookConsumerWidget {
const UserAlbums(),
][index.value];
return PlatformScaffold(
return SafeArea(
child: PlatformScaffold(
appBar: PageWindowTitleBar(
titleWidth: 347,
centerTitle: true,
@ -43,6 +44,7 @@ class UserLibrary extends HookConsumerWidget {
),
),
body: body,
),
);
}
}

View File

@ -81,7 +81,7 @@ class PlayerOverlay extends HookConsumerWidget {
),
Row(
children: [
PlatformIconButton(
IconButton(
icon: Icon(
Icons.skip_previous_rounded,
color: paletteColor.bodyTextColor,
@ -91,7 +91,7 @@ class PlayerOverlay extends HookConsumerWidget {
}),
Consumer(
builder: (context, ref, _) {
return PlatformIconButton(
return IconButton(
icon: Icon(
ref.read(playbackProvider).isPlaying
? Icons.pause_rounded
@ -105,7 +105,7 @@ class PlayerOverlay extends HookConsumerWidget {
);
},
),
PlatformIconButton(
IconButton(
icon: Icon(
Icons.skip_next_rounded,
color: paletteColor.bodyTextColor,

View File

@ -73,8 +73,9 @@ class Search extends HookConsumerWidget {
}
}
return PlatformScaffold(
appBar: !kIsMacOS ? PageWindowTitleBar() : null,
return SafeArea(
child: PlatformScaffold(
appBar: kIsDesktop && !kIsMacOS ? PageWindowTitleBar() : null,
body: auth.isAnonymous
? const AnonymousFallback()
: Column(
@ -86,11 +87,13 @@ class Search extends HookConsumerWidget {
),
child: PlatformTextField(
onChanged: (value) {
ref.read(searchTermStateProvider.notifier).state = value;
ref.read(searchTermStateProvider.notifier).state =
value;
},
prefixIcon: Icons.search_rounded,
prefixIconColor: PlatformProperty.only(
ios: PlatformTheme.of(context).textTheme?.caption?.color,
ios:
PlatformTheme.of(context).textTheme?.caption?.color,
other: null,
).resolve(platform!),
placeholder: "Search...",
@ -182,7 +185,8 @@ class Search extends HookConsumerWidget {
},
);
}),
if (searchTrack.hasNextPage && tracks.isNotEmpty)
if (searchTrack.hasNextPage &&
tracks.isNotEmpty)
Center(
child: PlatformTextButton(
onPressed: searchTrack.isFetchingNextPage
@ -204,8 +208,8 @@ class Search extends HookConsumerWidget {
.error?[searchPlaylist.pageParams.last])
else
ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(
behavior: ScrollConfiguration.of(context)
.copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
@ -225,7 +229,8 @@ class Search extends HookConsumerWidget {
...playlists.mapIndexed(
(i, playlist) {
if (i == playlists.length - 1 &&
searchPlaylist.hasNextPage) {
searchPlaylist
.hasNextPage) {
return Waypoint(
onEnter: () {
searchPlaylist
@ -256,8 +261,8 @@ class Search extends HookConsumerWidget {
.error?[searchArtist.pageParams.last])
else
ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(
behavior: ScrollConfiguration.of(context)
.copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
@ -285,8 +290,8 @@ class Search extends HookConsumerWidget {
);
}
return Container(
margin:
const EdgeInsets.symmetric(
margin: const EdgeInsets
.symmetric(
horizontal: 15),
child: ArtistCard(artist),
);
@ -301,7 +306,8 @@ class Search extends HookConsumerWidget {
if (albums.isNotEmpty)
PlatformText(
"Albums",
style: Theme.of(context).textTheme.headline5,
style:
Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10),
if (searchAlbum.isLoading &&
@ -312,8 +318,8 @@ class Search extends HookConsumerWidget {
.error?[searchAlbum.pageParams.last])
else
ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(
behavior: ScrollConfiguration.of(context)
.copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
@ -359,6 +365,7 @@ class Search extends HookConsumerWidget {
)
],
),
),
);
}
}

View File

@ -114,11 +114,7 @@ class TrackCollectionView<T> extends HookConsumerWidget {
? PageWindowTitleBar(
backgroundColor: color?.color,
foregroundColor: color?.titleTextColor,
leading: Row(
children: [
PlatformBackButton(color: color?.titleTextColor)
],
),
leading: PlatformBackButton(color: color?.titleTextColor),
)
: null,
body: CustomScrollView(
@ -130,6 +126,9 @@ class TrackCollectionView<T> extends HookConsumerWidget {
pinned: true,
expandedHeight: 400,
automaticallyImplyLeading: kIsMobile,
leading: kIsMobile
? PlatformBackButton(color: color?.titleTextColor)
: null,
iconTheme: IconThemeData(color: color?.titleTextColor),
primary: true,
backgroundColor: color?.color,

View File

@ -235,13 +235,15 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
macosTheme: macosTheme,
macosDarkTheme: macosDarkTheme,
themeMode: themeMode,
windowButtonConfig: PlatformWindowButtonConfig(
windowButtonConfig: kIsDesktop
? PlatformWindowButtonConfig(
isMaximized: () => appWindow.isMaximized,
onClose: appWindow.close,
onRestore: appWindow.restore,
onMaximize: appWindow.maximize,
onMinimize: appWindow.minimize,
),
)
: null,
shortcuts: PlatformProperty.all({
...WidgetsApp.defaultShortcuts.map((key, value) {
return MapEntry(