chore: use updated fl_query offline management

This commit is contained in:
Kingkor Roy Tirtho 2023-10-14 17:28:22 +06:00
parent 0eb9ee8648
commit d39667bfb9
4 changed files with 104 additions and 72 deletions

View File

@ -95,8 +95,26 @@ class PlayerView extends HookConsumerWidget {
}, },
child: IconTheme( child: IconTheme(
data: theme.iconTheme.copyWith(color: bodyTextColor), data: theme.iconTheme.copyWith(color: bodyTextColor),
child: AnimateGradient(
animateAlignments: true,
primaryBegin: Alignment.topLeft,
primaryEnd: Alignment.bottomLeft,
secondaryBegin: Alignment.bottomRight,
secondaryEnd: Alignment.topRight,
duration: const Duration(seconds: 15),
primaryColors: [
palette.dominantColor?.color ?? theme.colorScheme.primary,
palette.mutedColor?.color ?? theme.colorScheme.secondary,
],
secondaryColors: [
(palette.darkVibrantColor ?? palette.lightVibrantColor)?.color ??
theme.colorScheme.primaryContainer,
(palette.darkMutedColor ?? palette.lightMutedColor)?.color ??
theme.colorScheme.secondaryContainer,
],
child: Scaffold( child: Scaffold(
key: scaffoldKey, key: scaffoldKey,
backgroundColor: Colors.transparent,
appBar: PreferredSize( appBar: PreferredSize(
preferredSize: Size.fromHeight( preferredSize: Size.fromHeight(
kToolbarHeight + topPadding, kToolbarHeight + topPadding,
@ -115,7 +133,8 @@ class PlayerView extends HookConsumerWidget {
IconButton( IconButton(
icon: const Icon(SpotubeIcons.info, size: 18), icon: const Icon(SpotubeIcons.info, size: 18),
tooltip: context.l10n.details, tooltip: context.l10n.details,
style: IconButton.styleFrom(foregroundColor: bodyTextColor), style:
IconButton.styleFrom(foregroundColor: bodyTextColor),
onPressed: currentTrack == null onPressed: currentTrack == null
? null ? null
: () { : () {
@ -133,24 +152,7 @@ class PlayerView extends HookConsumerWidget {
), ),
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: AnimateGradient( body: SingleChildScrollView(
animateAlignments: true,
primaryBegin: Alignment.topLeft,
primaryEnd: Alignment.bottomLeft,
secondaryBegin: Alignment.bottomRight,
secondaryEnd: Alignment.topRight,
duration: const Duration(seconds: 15),
primaryColors: [
palette.dominantColor?.color ?? theme.colorScheme.primary,
palette.mutedColor?.color ?? theme.colorScheme.secondary,
],
secondaryColors: [
(palette.darkVibrantColor ?? palette.lightVibrantColor)?.color ??
theme.colorScheme.primaryContainer,
(palette.darkMutedColor ?? palette.lightMutedColor)?.color ??
theme.colorScheme.secondaryContainer,
],
child: SingleChildScrollView(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width: double.infinity, width: double.infinity,

View File

@ -9,12 +9,22 @@ class FlQueryInternetConnectionCheckerAdapter extends ConnectivityAdapter
final _connectionStreamController = StreamController<bool>.broadcast(); final _connectionStreamController = StreamController<bool>.broadcast();
FlQueryInternetConnectionCheckerAdapter() : super() { FlQueryInternetConnectionCheckerAdapter() : super() {
Timer.periodic(const Duration(minutes: 3), (timer) async { Timer? timer;
if (WidgetsBinding.instance.lifecycleState == AppLifecycleState.paused) {
onConnectivityChanged.listen((connected) {
if (!connected && timer == null) {
timer = Timer.periodic(const Duration(seconds: 30), (timer) async {
if (WidgetsBinding.instance.lifecycleState ==
AppLifecycleState.paused) {
return; return;
} }
await isConnected; await isConnected;
}); });
} else {
timer?.cancel();
timer = null;
}
});
} }
@override @override

View File

@ -580,26 +580,29 @@ packages:
fl_query: fl_query:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_query path: "packages/fl_query"
sha256: a97bd9234c3e8aefe43735d0ac6b7153154ea7aeeac123b0621afb0e4dca3291 ref: HEAD
url: "https://pub.dev" resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7
source: hosted url: "https://github.com/KRTirtho/fl-query.git"
source: git
version: "1.0.0-alpha.5" version: "1.0.0-alpha.5"
fl_query_devtools: fl_query_devtools:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_query_devtools path: "packages/fl_query_devtools"
sha256: e827512a8601ba57272a9171581e789ffb68375a8a86c994750b45f8cdc0a993 ref: HEAD
url: "https://pub.dev" resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7
source: hosted url: "https://github.com/KRTirtho/fl-query.git"
source: git
version: "0.1.0-alpha.3" version: "0.1.0-alpha.3"
fl_query_hooks: fl_query_hooks:
dependency: "direct main" dependency: "direct main"
description: description:
name: fl_query_hooks path: "packages/fl_query_hooks"
sha256: "97ad03d0d2d506353d8f3de62ac2aa0b465d85827d15641e3e4b76b16e0a5bbd" ref: HEAD
url: "https://pub.dev" resolved-ref: a817713a0bb0c486e908e9ed74467c4f7f58bea7
source: hosted url: "https://github.com/KRTirtho/fl-query.git"
source: git
version: "1.0.0-alpha.5" version: "1.0.0-alpha.5"
fluentui_system_icons: fluentui_system_icons:
dependency: "direct main" dependency: "direct main"

View File

@ -32,9 +32,18 @@ dependencies:
duration: ^3.0.12 duration: ^3.0.12
envied: ^0.3.0 envied: ^0.3.0
file_selector: ^1.0.1 file_selector: ^1.0.1
fl_query: ^1.0.0-alpha.5 fl_query:
fl_query_hooks: ^1.0.0-alpha.5 git:
fl_query_devtools: ^0.1.0-alpha.3 url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query
fl_query_hooks:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query_hooks
fl_query_devtools:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query_devtools
fluentui_system_icons: ^1.1.189 fluentui_system_icons: ^1.1.189
flutter: flutter:
sdk: flutter sdk: flutter
@ -124,6 +133,14 @@ dev_dependencies:
dependency_overrides: dependency_overrides:
http: ^1.1.0 http: ^1.1.0
system_tray: 2.0.2 system_tray: 2.0.2
fl_query:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query
fl_query_hooks:
git:
url: https://github.com/KRTirtho/fl-query.git
path: packages/fl_query_hooks
flutter: flutter:
generate: true generate: true