Skip to content
Snippets Groups Projects
Commit 1bd551a8 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

add: reload page animation

parent 35b1d6f6
No related branches found
No related tags found
1 merge request!12Clhp map
import 'dart:async';
import 'package:app/server_requests/fetch_relation.dart';
import 'package:flutter/material.dart';
import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';
import '../consts.dart';
import '../data_classes.dart';
......@@ -27,35 +28,15 @@ class _DefaultPageState extends State<DefaultPage> {
super.dispose();
}
/// Display message to user
void showConnectionMessage() {
showDialog(
context: context,
builder: (context) => AlertDialog(
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("Ok"),
)
],
title: const Center(
child: Text("No server connection")
),
contentPadding: const EdgeInsets.all(10.0),
content: const Text(
"The app may display outdated information. Use with caution!",
textAlign: TextAlign.center, // Align text center
),
),
);
Future<void> _handleRefresh() async {
return await Future.delayed(const Duration(seconds: 2));
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.grey[900],
appBar: AppBar(
backgroundColor: Colors.black87,
leading: IconButton(
......@@ -101,16 +82,24 @@ class _DefaultPageState extends State<DefaultPage> {
),
],
),
body: Container( // Return container with list view and background color
color: const Color(0xff151515),
child: ListView(
children: [
MapContainerWidget(
markerList: selectedMarkerList,
relation: selectedRelation,
serverConnection: serverConnection,
),
],
body: LiquidPullToRefresh(
color: Colors.grey[900],
height: 200,
backgroundColor: Colors.grey[600],
onRefresh: _handleRefresh,
animSpeedFactor: 3,
showChildOpacityTransition: false,
child: Container( // Return main container with map and stats widget
color: const Color(0xff151515),
child: ListView(
children: [
MapContainerWidget(
markerList: selectedMarkerList,
relation: selectedRelation,
serverConnection: serverConnection,
),
],
),
),
),
),
......
......@@ -248,6 +248,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
liquid_pull_to_refresh:
dependency: "direct main"
description:
name: liquid_pull_to_refresh
sha256: "11e4cd8c5460085a31b479ec4e1cd063eb8e599f35684d57a44dafa1fd1f67f3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lists:
dependency: transitive
description:
......
......@@ -22,6 +22,7 @@ dependencies:
fuzzy: any # Search algorithm
connectivity_plus: ^3.0.3 # Check internet connection
get: ^4.6.5
liquid_pull_to_refresh: ^3.0.0 # Pull to refresh
dev_dependencies:
flutter_test:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment