mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix(android): dynamic status bar and safearea, playerview artist link, login success redirect
This commit is contained in:
parent
933b8d58e7
commit
8a72f62d14
@ -10,6 +10,7 @@ import 'package:spotube/components/Shared/PageWindowTitleBar.dart';
|
|||||||
import 'package:spotube/components/Shared/ReplaceDownloadedFileDialog.dart';
|
import 'package:spotube/components/Shared/ReplaceDownloadedFileDialog.dart';
|
||||||
import 'package:spotube/hooks/useUpdateChecker.dart';
|
import 'package:spotube/hooks/useUpdateChecker.dart';
|
||||||
import 'package:spotube/provider/Downloader.dart';
|
import 'package:spotube/provider/Downloader.dart';
|
||||||
|
import 'package:spotube/utils/platform.dart';
|
||||||
|
|
||||||
const _path = {
|
const _path = {
|
||||||
0: "/",
|
0: "/",
|
||||||
@ -66,21 +67,22 @@ class Shell extends HookConsumerWidget {
|
|||||||
final preferredSize =
|
final preferredSize =
|
||||||
allowedPath ? PageWindowTitleBar.staticPreferredSize : Size.zero;
|
allowedPath ? PageWindowTitleBar.staticPreferredSize : Size.zero;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
primary: true,
|
appBar: kIsDesktop
|
||||||
appBar: PreferredSize(
|
? PreferredSize(
|
||||||
preferredSize: preferredSize,
|
preferredSize: preferredSize,
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 250),
|
duration: const Duration(milliseconds: 250),
|
||||||
height:
|
height: allowedPath
|
||||||
allowedPath ? PageWindowTitleBar.staticPreferredSize.height : 0,
|
? PageWindowTitleBar.staticPreferredSize.height
|
||||||
child: AnimatedOpacity(
|
: 0,
|
||||||
duration: const Duration(milliseconds: 250),
|
child: AnimatedOpacity(
|
||||||
opacity: allowedPath ? 1 : 0,
|
duration: const Duration(milliseconds: 250),
|
||||||
child: PageWindowTitleBar(preferredSize: preferredSize),
|
opacity: allowedPath ? 1 : 0,
|
||||||
),
|
child: PageWindowTitleBar(preferredSize: preferredSize),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
extendBodyBehindAppBar: true,
|
)
|
||||||
|
: null,
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
Sidebar(
|
Sidebar(
|
||||||
|
@ -7,9 +7,11 @@ import 'package:metadata_god/metadata_god.dart';
|
|||||||
import 'package:mime/mime.dart';
|
import 'package:mime/mime.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:spotify/spotify.dart';
|
import 'package:spotify/spotify.dart';
|
||||||
import 'package:spotube/components/LoaderShimmers/ShimmerTrackTile.dart';
|
import 'package:spotube/components/LoaderShimmers/ShimmerTrackTile.dart';
|
||||||
import 'package:spotube/components/Shared/TrackTile.dart';
|
import 'package:spotube/components/Shared/TrackTile.dart';
|
||||||
|
import 'package:spotube/hooks/useAsyncEffect.dart';
|
||||||
import 'package:spotube/models/CurrentPlaylist.dart';
|
import 'package:spotube/models/CurrentPlaylist.dart';
|
||||||
import 'package:spotube/models/Logger.dart';
|
import 'package:spotube/models/Logger.dart';
|
||||||
import 'package:spotube/provider/Playback.dart';
|
import 'package:spotube/provider/Playback.dart';
|
||||||
@ -132,6 +134,18 @@ class UserLocalTracks extends HookConsumerWidget {
|
|||||||
final playback = ref.watch(playbackProvider);
|
final playback = ref.watch(playbackProvider);
|
||||||
final isPlaylistPlaying = playback.playlist?.id == "local";
|
final isPlaylistPlaying = playback.playlist?.id == "local";
|
||||||
final trackSnapshot = ref.watch(localTracksProvider);
|
final trackSnapshot = ref.watch(localTracksProvider);
|
||||||
|
|
||||||
|
useAsyncEffect(
|
||||||
|
() async {
|
||||||
|
if (!await Permission.storage.isGranted &&
|
||||||
|
!await Permission.storage.isLimited) {
|
||||||
|
await Permission.storage.request();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -38,7 +38,7 @@ class TokenLogin extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
TokenLoginForm(
|
TokenLoginForm(
|
||||||
onDone: () => ServiceUtils.navigate(context, "/"),
|
onDone: () => GoRouter.of(context).go("/"),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Wrap(
|
Wrap(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:spotube/provider/Auth.dart';
|
import 'package:spotube/provider/Auth.dart';
|
||||||
import 'package:spotube/utils/platform.dart';
|
import 'package:spotube/utils/platform.dart';
|
||||||
@ -61,7 +62,7 @@ class WebViewLogin extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
if (mounted()) {
|
if (mounted()) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
ServiceUtils.navigate(context, "/");
|
GoRouter.of(context).go("/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -100,6 +100,10 @@ class PlayerView extends HookConsumerWidget {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: paletteColor.bodyTextColor,
|
color: paletteColor.bodyTextColor,
|
||||||
),
|
),
|
||||||
|
onRouteChange: (route) {
|
||||||
|
GoRouter.of(context).pop();
|
||||||
|
GoRouter.of(context).push(route);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -49,7 +49,6 @@ class Settings extends HookConsumerWidget {
|
|||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: PageWindowTitleBar(
|
appBar: PageWindowTitleBar(
|
||||||
leading: const BackButton(),
|
|
||||||
center: Text(
|
center: Text(
|
||||||
"Settings",
|
"Settings",
|
||||||
style: Theme.of(context).textTheme.headline5,
|
style: Theme.of(context).textTheme.headline5,
|
||||||
|
@ -112,7 +112,7 @@ class TrackCollectionView extends HookConsumerWidget {
|
|||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: (kIsDesktop)
|
appBar: kIsDesktop
|
||||||
? PageWindowTitleBar(
|
? PageWindowTitleBar(
|
||||||
backgroundColor: color?.color,
|
backgroundColor: color?.color,
|
||||||
foregroundColor: color?.titleTextColor,
|
foregroundColor: color?.titleTextColor,
|
||||||
|
@ -5,10 +5,12 @@ import 'dart:io';
|
|||||||
import 'package:flutter/widgets.dart' hide Image;
|
import 'package:flutter/widgets.dart' hide Image;
|
||||||
import 'package:metadata_god/metadata_god.dart' hide Image;
|
import 'package:metadata_god/metadata_god.dart' hide Image;
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
import 'package:spotube/components/Shared/AnchorButton.dart';
|
||||||
import 'package:spotube/components/Shared/LinkText.dart';
|
import 'package:spotube/components/Shared/LinkText.dart';
|
||||||
import 'package:spotify/spotify.dart';
|
import 'package:spotify/spotify.dart';
|
||||||
import 'package:spotube/models/SpotubeTrack.dart';
|
import 'package:spotube/models/SpotubeTrack.dart';
|
||||||
import 'package:spotube/utils/primitive_utils.dart';
|
import 'package:spotube/utils/primitive_utils.dart';
|
||||||
|
import 'package:spotube/utils/service_utils.dart';
|
||||||
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
|
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
|
||||||
|
|
||||||
enum ImagePlaceholder {
|
enum ImagePlaceholder {
|
||||||
@ -46,6 +48,7 @@ abstract class TypeConversionUtils {
|
|||||||
WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.center,
|
WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.center,
|
||||||
WrapAlignment mainAxisAlignment = WrapAlignment.center,
|
WrapAlignment mainAxisAlignment = WrapAlignment.center,
|
||||||
TextStyle textStyle = const TextStyle(),
|
TextStyle textStyle = const TextStyle(),
|
||||||
|
void Function(String route)? onRouteChange,
|
||||||
}) {
|
}) {
|
||||||
return Wrap(
|
return Wrap(
|
||||||
crossAxisAlignment: crossAxisAlignment,
|
crossAxisAlignment: crossAxisAlignment,
|
||||||
@ -54,14 +57,25 @@ abstract class TypeConversionUtils {
|
|||||||
.asMap()
|
.asMap()
|
||||||
.entries
|
.entries
|
||||||
.map(
|
.map(
|
||||||
(artist) => LinkText(
|
(artist) => Builder(builder: (context) {
|
||||||
(artist.key != artists.length - 1)
|
return AnchorButton(
|
||||||
? "${artist.value.name}, "
|
(artist.key != artists.length - 1)
|
||||||
: artist.value.name!,
|
? "${artist.value.name}, "
|
||||||
"/artist/${artist.value.id}",
|
: artist.value.name!,
|
||||||
overflow: TextOverflow.ellipsis,
|
onTap: () {
|
||||||
style: textStyle,
|
if (onRouteChange != null) {
|
||||||
),
|
onRouteChange("/artist/${artist.value.id}");
|
||||||
|
} else {
|
||||||
|
ServiceUtils.navigate(
|
||||||
|
context,
|
||||||
|
"/artist/${artist.value.id}",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: textStyle,
|
||||||
|
);
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user