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 'dart:async';
import 'package:app/server_requests/fetch_relation.dart'; import 'package:app/server_requests/fetch_relation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';
import '../consts.dart'; import '../consts.dart';
import '../data_classes.dart'; import '../data_classes.dart';
...@@ -27,35 +28,15 @@ class _DefaultPageState extends State<DefaultPage> { ...@@ -27,35 +28,15 @@ class _DefaultPageState extends State<DefaultPage> {
super.dispose(); super.dispose();
} }
/// Display message to user Future<void> _handleRefresh() async {
void showConnectionMessage() { return await Future.delayed(const Duration(seconds: 2));
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
),
),
);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
backgroundColor: Colors.grey[900],
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.black87, backgroundColor: Colors.black87,
leading: IconButton( leading: IconButton(
...@@ -101,16 +82,24 @@ class _DefaultPageState extends State<DefaultPage> { ...@@ -101,16 +82,24 @@ class _DefaultPageState extends State<DefaultPage> {
), ),
], ],
), ),
body: Container( // Return container with list view and background color body: LiquidPullToRefresh(
color: const Color(0xff151515), color: Colors.grey[900],
child: ListView( height: 200,
children: [ backgroundColor: Colors.grey[600],
MapContainerWidget( onRefresh: _handleRefresh,
markerList: selectedMarkerList, animSpeedFactor: 3,
relation: selectedRelation, showChildOpacityTransition: false,
serverConnection: serverConnection, 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: ...@@ -248,6 +248,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" 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: lists:
dependency: transitive dependency: transitive
description: description:
......
...@@ -22,6 +22,7 @@ dependencies: ...@@ -22,6 +22,7 @@ dependencies:
fuzzy: any # Search algorithm fuzzy: any # Search algorithm
connectivity_plus: ^3.0.3 # Check internet connection connectivity_plus: ^3.0.3 # Check internet connection
get: ^4.6.5 get: ^4.6.5
liquid_pull_to_refresh: ^3.0.0 # Pull to refresh
dev_dependencies: dev_dependencies:
flutter_test: 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