Skip to content
Snippets Groups Projects
Commit 2138afec authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Refresh data on pull down

parent ab2baf8b
No related branches found
No related tags found
1 merge request!28Resolve "Refresh on pull down"
Pipeline #4676 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.38
app.versionCode=38
app.versionName=0.0.39
app.versionCode=39
Update data on page pull down.
Mise à jour des données en tirant la page vers le bas.
......@@ -3,12 +3,18 @@ import 'package:flutter/material.dart';
import 'package:scrobbles/ui/widgets/cards/discoveries.dart';
class ScreenDiscoveries extends StatelessWidget {
const ScreenDiscoveries({super.key});
final Function() notifyParent;
const ScreenDiscoveries({super.key, required this.notifyParent});
@override
Widget build(BuildContext context) {
return Material(
color: Theme.of(context).colorScheme.background,
child: RefreshIndicator(
onRefresh: () async {
this.notifyParent();
},
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 4),
physics: const BouncingScrollPhysics(),
......@@ -18,6 +24,7 @@ class ScreenDiscoveries extends StatelessWidget {
const SizedBox(height: 36),
],
),
),
);
}
}
......@@ -6,12 +6,18 @@ import 'package:scrobbles/ui/widgets/cards/timeline.dart';
import 'package:scrobbles/ui/widgets/cards/top_artists.dart';
class ScreenHome extends StatelessWidget {
const ScreenHome({super.key});
final Function() notifyParent;
const ScreenHome({super.key, required this.notifyParent});
@override
Widget build(BuildContext context) {
return Material(
color: Theme.of(context).colorScheme.background,
child: RefreshIndicator(
onRefresh: () async {
this.notifyParent();
},
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 4),
physics: const BouncingScrollPhysics(),
......@@ -27,6 +33,7 @@ class ScreenHome extends StatelessWidget {
const SizedBox(height: 36),
],
),
),
);
}
}
......@@ -4,12 +4,18 @@ import 'package:scrobbles/ui/widgets/cards/counts_by_day.dart';
import 'package:scrobbles/ui/widgets/cards/counts_by_hour.dart';
class ScreenStatistics extends StatelessWidget {
const ScreenStatistics({super.key});
final Function() notifyParent;
const ScreenStatistics({super.key, required this.notifyParent});
@override
Widget build(BuildContext context) {
return Material(
color: Theme.of(context).colorScheme.background,
child: RefreshIndicator(
onRefresh: () async {
this.notifyParent();
},
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 4),
physics: const BouncingScrollPhysics(),
......@@ -21,6 +27,7 @@ class ScreenStatistics extends StatelessWidget {
const SizedBox(height: 36),
],
),
),
);
}
}
......@@ -20,10 +20,10 @@ class SkeletonScreen extends StatefulWidget {
class _SkeletonScreenState extends State<SkeletonScreen> {
@override
Widget build(BuildContext context) {
const List<Widget> pageNavigation = <Widget>[
const ScreenHome(),
const ScreenDiscoveries(),
const ScreenStatistics(),
List<Widget> pageNavigation = <Widget>[
ScreenHome(notifyParent: refresh),
ScreenDiscoveries(notifyParent: refresh),
ScreenStatistics(notifyParent: refresh),
const ScreenSettings(),
];
......@@ -53,6 +53,11 @@ class _SkeletonScreenState extends State<SkeletonScreen> {
}
refresh() {
setState(() {});
void rebuild(Element el) {
el.markNeedsBuild();
el.visitChildren(rebuild);
}
(context as Element).visitChildren(rebuild);
}
}
......@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
publish_to: 'none'
version: 0.0.38+38
version: 0.0.39+39
environment:
sdk: '^3.0.0'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment