fix(android): system navigator back doesn't close player

This commit is contained in:
Kingkor Roy Tirtho 2023-10-01 10:08:24 +06:00
parent e5d0aaf80d
commit 20d70927c9
3 changed files with 242 additions and 226 deletions

2
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"program": "lib/main.dart", "program": "lib/main.dart",
"args": [ "args": [
"--flavor", "--flavor",
"nightly" "dev"
] ]
}, },
{ {

View File

@ -82,6 +82,12 @@ android {
applicationIdSuffix ".nightly" applicationIdSuffix ".nightly"
versionNameSuffix "-nightly" versionNameSuffix "-nightly"
} }
dev {
dimension "default"
resValue "string", "app_name", "Spotube Dev"
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
}
stable { stable {
dimension "default" dimension "default"
resValue "string", "app_name", "Spotube" resValue "string", "app_name", "Spotube"

View File

@ -75,7 +75,12 @@ class PlayerView extends HookConsumerWidget {
noSetBGColor: true, noSetBGColor: true,
); );
return IconTheme( return WillPopScope(
onWillPop: () async {
onClosePage();
return false;
},
child: IconTheme(
data: theme.iconTheme.copyWith(color: bodyTextColor), data: theme.iconTheme.copyWith(color: bodyTextColor),
child: Scaffold( child: Scaffold(
appBar: PreferredSize( appBar: PreferredSize(
@ -183,7 +188,8 @@ class PlayerView extends HookConsumerWidget {
), ),
if (isLocalTrack) if (isLocalTrack)
Text( Text(
TypeConversionUtils.artists_X_String<Artist>( TypeConversionUtils.artists_X_String<
Artist>(
currentTrack?.artists ?? [], currentTrack?.artists ?? [],
), ),
style: theme.textTheme.bodyMedium!.copyWith( style: theme.textTheme.bodyMedium!.copyWith(
@ -192,7 +198,8 @@ class PlayerView extends HookConsumerWidget {
), ),
) )
else else
TypeConversionUtils.artists_X_ClickableArtists( TypeConversionUtils
.artists_X_ClickableArtists(
currentTrack?.artists ?? [], currentTrack?.artists ?? [],
textStyle: textStyle:
theme.textTheme.bodyMedium!.copyWith( theme.textTheme.bodyMedium!.copyWith(
@ -243,7 +250,8 @@ class PlayerView extends HookConsumerWidget {
BorderRadius.circular(10), BorderRadius.circular(10),
), ),
constraints: BoxConstraints( constraints: BoxConstraints(
maxHeight: MediaQuery.of(context) maxHeight:
MediaQuery.of(context)
.size .size
.height * .height *
.7, .7,
@ -283,8 +291,9 @@ class PlayerView extends HookConsumerWidget {
), ),
), ),
constraints: BoxConstraints( constraints: BoxConstraints(
maxHeight: maxHeight: MediaQuery.of(context)
MediaQuery.of(context).size.height * .size
.height *
0.8, 0.8,
), ),
builder: (context) => builder: (context) =>
@ -324,6 +333,7 @@ class PlayerView extends HookConsumerWidget {
), ),
), ),
), ),
),
); );
} }
} }