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",
"args": [
"--flavor",
"nightly"
"dev"
]
},
{

View File

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

View File

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