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,62 +95,64 @@ class PlayerView extends HookConsumerWidget {
},
child: IconTheme(
data: theme.iconTheme.copyWith(color: bodyTextColor),
child: Scaffold(
key: scaffoldKey,
appBar: PreferredSize(
preferredSize: Size.fromHeight(
kToolbarHeight + topPadding,
),
child: Padding(
padding: EdgeInsets.only(top: topPadding),
child: PageWindowTitleBar(
backgroundColor: Colors.transparent,
foregroundColor: titleTextColor,
toolbarOpacity: 1,
leading: IconButton(
icon: const Icon(SpotubeIcons.angleDown, size: 18),
onPressed: panelController.close,
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(
key: scaffoldKey,
backgroundColor: Colors.transparent,
appBar: PreferredSize(
preferredSize: Size.fromHeight(
kToolbarHeight + topPadding,
),
child: Padding(
padding: EdgeInsets.only(top: topPadding),
child: PageWindowTitleBar(
backgroundColor: Colors.transparent,
foregroundColor: titleTextColor,
toolbarOpacity: 1,
leading: IconButton(
icon: const Icon(SpotubeIcons.angleDown, size: 18),
onPressed: panelController.close,
),
actions: [
IconButton(
icon: const Icon(SpotubeIcons.info, size: 18),
tooltip: context.l10n.details,
style:
IconButton.styleFrom(foregroundColor: bodyTextColor),
onPressed: currentTrack == null
? null
: () {
showDialog(
context: context,
builder: (context) {
return TrackDetailsDialog(
track: currentTrack,
);
});
},
)
],
),
actions: [
IconButton(
icon: const Icon(SpotubeIcons.info, size: 18),
tooltip: context.l10n.details,
style: IconButton.styleFrom(foregroundColor: bodyTextColor),
onPressed: currentTrack == null
? null
: () {
showDialog(
context: context,
builder: (context) {
return TrackDetailsDialog(
track: currentTrack,
);
});
},
)
],
),
),
),
extendBodyBehindAppBar: true,
body: 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: SingleChildScrollView(
extendBodyBehindAppBar: true,
body: SingleChildScrollView(
child: Container(
alignment: Alignment.center,
width: double.infinity,

View File

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

View File

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

View File

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