Commit 27e435f9 authored by Nicolas Richard Walter Boeckh's avatar Nicolas Richard Walter Boeckh 💬
Browse files

Added routing between main and stats page (not one single page), added...

Added routing between main and stats page (not one single page), added animation, flutter upgrade compliant.
parent c154f30b
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-3.3.0\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.1.8\\\\","dependencies":[]}],"android":[{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.0\\\\","dependencies":[]},{"name":"permission_handler","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\permission_handler-3.3.0\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.1.8\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-02-03 15:00:43.179313","version":"1.14.7-pre.83"}
\ No newline at end of file
......@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- (UX) Swipe animation.
- (UI) Swipe header area down to reveal Statistics and Information widget.
- (UX) Carousel functionality.
- (UI) Carousel -> Added basic Map, Data and Social Widgets.
......
import 'package:flutter/material.dart';
class SlideUpRoute extends PageRouteBuilder {
final Widget page;
SlideUpRoute({this.page}) : super(
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, ) =>
page,
transitionsBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) =>
SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, -1),
end: Offset.zero,
).animate(animation),
child: child,
),
);
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:device_preview/device_preview.dart';
import 'package:logair_application/ui/home_view.dart';
import 'package:logair_application/routes/home.dart';
final bool displayMode = false;
......
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:logair_application/animation/custom_slide_animation.dart';
import 'package:logair_application/routes/stats.dart';
import 'package:logair_application/ui/base_widget.dart';
import 'package:logair_application/ui/data_widget.dart';
......@@ -14,7 +16,7 @@ class HomeView extends StatefulWidget {
}
class _HomeViewState extends State<HomeView> {
bool onCarousel = true;
bool shouldChange = false;
bool canChange = false;
double deltaSum = 0.0;
double gestureStartY = 0.0;
......@@ -25,69 +27,70 @@ class _HomeViewState extends State<HomeView> {
Widget build(BuildContext context) {
return BaseWidget(
builder: (context, sizingInfo) => GestureDetector(
onTap: () {
print('SIZING INFO : ${sizingInfo.toString()}');
print('SIZING INFO : ${sizingInfo.unnotchedHeight()}');
},
onVerticalDragStart: (details) {
gestureStartY = details.globalPosition.dy;
canChange = ((onCarousel && sizingInfo.screenSize.height * 0.1 >= gestureStartY) || (!onCarousel && sizingInfo.screenSize.height * 0.9 <= gestureStartY));
canChange = (sizingInfo.screenSize.height * 0.1 >= gestureStartY);
print('SIZING INFO : ${sizingInfo.toString()}');
},
onVerticalDragUpdate: (details) {
if (deltaSum <= -50 && onCarousel && canChange)
setState(() => onCarousel = false);
else if (deltaSum >= 50 && !onCarousel && canChange)
setState(() => onCarousel = true);
if (deltaSum <= -50 && canChange)
setState(() => shouldChange = true);
else
deltaSum -= details.delta.dy;
},
onVerticalDragEnd: (_) {
deltaSum = 0.0;
var change = shouldChange && canChange;
shouldChange = false;
canChange = false;
deltaSum = 0.0;
if (change)
Navigator.push(
context,
SlideUpRoute(
page: StatsView(),
),
);
},
child: AnimatedContainer(
duration: Duration(seconds: 2),
curve: Curves.fastOutSlowIn,
child: SafeArea(
child: Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
// Notch masking
Container(
color: Colors.black,
height: sizingInfo.padding.top,
),
// Header
BaseWidget(
builder: (context, sizingInfo) => Container(
height: onCarousel ? sizingInfo.screenSize.height * 0.1 : sizingInfo.screenSize.height - sizingInfo.padding.top,
child: Column(
children: [
Container(
height: onCarousel ? 0 : sizingInfo.screenSize.height * 0.9 - sizingInfo.padding.top,
width: sizingInfo.screenSize.width,
child: Center(child: Text("PLACEHOLDER: STATS"),),
),
Container(
color: Colors.amber,
height: sizingInfo.screenSize.height * 0.1,
width: sizingInfo.screenSize.width,
child: Center(child: Text("BATTERY INDIC"))
)
],
)
Expanded(
flex: 1,
child: Row(
children: [
Expanded(
flex: 1,
child: Center(child: Container(color: Colors.blue.shade100, child: Text("BATTERY INDIC 1"),),),
),
Expanded(
flex: 1,
child: Center(child: Container(color: Colors.blue.shade200, child: Text("BATTERY INDIC 2"),),),
),
],
),
),
// Carousel
Container(
color: Colors.blue,
Expanded(
flex: 9,
child: BaseWidget(
builder: (context, sizingInfo) => CarouselSlider(
height: onCarousel ? sizingInfo.screenSize.height * 0.9 - sizingInfo.padding.top : 0,
height: sizingInfo.unnotchedHeight(),
autoPlay: false,
enlargeCenterPage: false,
viewportFraction: 1.0,
initialPage: 1,
items: [MapWidget(), DataWidget(), SocialWidget()],
items: [
MapWidget(),
DataWidget(),
SocialWidget()
],
),
),
),
......@@ -99,4 +102,4 @@ class _HomeViewState extends State<HomeView> {
),
);
}
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:logair_application/ui/base_widget.dart';
class StatsView extends StatefulWidget {
StatsView({Key key}) : super(key: key);
@override
_StatsViewState createState() => _StatsViewState();
}
class _StatsViewState extends State<StatsView> {
bool shouldChange = false;
bool canChange = false;
double deltaSum = 0.0;
double gestureStartY = 0.0;
_StatsViewState({Key key});
@override
Widget build(BuildContext context) {
return BaseWidget(
builder: (context, sizingInfo) => GestureDetector(
onTap: () {
print('SIZING INFO : ${sizingInfo.toString()}');
print('SIZING INFO : ${sizingInfo.unnotchedHeight()}');
},
onVerticalDragStart: (details) {
gestureStartY = details.globalPosition.dy;
canChange = (sizingInfo.screenSize.height * 0.9 <= gestureStartY);
print('SIZING INFO : ${sizingInfo.toString()}');
},
onVerticalDragUpdate: (details) {
if (deltaSum >= 50 && canChange)
setState(() => shouldChange = true);
else
deltaSum -= details.delta.dy;
},
onVerticalDragEnd: (_) {
var change = shouldChange && canChange;
shouldChange = false;
canChange = false;
deltaSum = 0.0;
if (change)
Navigator.pop(context);
},
child: SafeArea(
child: Scaffold(
body: Center(
child: Column(
children: <Widget>[
// Carousel
Expanded(
flex: 9,
child: BaseWidget(
builder: (context, sizingInfo) => Container(
width: double.infinity,
height: double.infinity,
),
),
),
Expanded(
flex: 1,
child: Row(
children: [
Expanded(
flex: 1,
child: Center(child: Container(color: Colors.blue.shade100, child: Text("BATTERY INDIC 1"),),),
),
Expanded(
flex: 1,
child: Center(child: Container(color: Colors.blue.shade200, child: Text("BATTERY INDIC 2"),),),
),
],
),
),
],
),
),
),
),
),
);
}
}
\ No newline at end of file
import 'package:flutter/widgets.dart';
import 'package:logair_application/enums/device_screen_type.dart';
import 'dart:math';
class SizingInformation {
final Orientation orientation;
......@@ -16,6 +17,8 @@ class SizingInformation {
this.padding
});
double unnotchedHeight() => ((this.screenSize.height - this.padding.top) * 100).round().toDouble() / 100;
@override
String toString() {
return 'Orientation: $orientation, DeviceType: $deviceType, ScreenSize: $screenSize, LocalWidgetSize: $localWidgetSize, Padding: $padding';
......
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
ansicolor:
dependency: transitive
description:
name: ansicolor
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
version: "2.0.11"
args:
dependency: transitive
description:
......@@ -21,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
......@@ -29,6 +36,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
cached_network_image:
dependency: transitive
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
carousel_slider:
dependency: "direct main"
description:
......@@ -50,6 +64,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
console_log_handler:
dependency: transitive
description:
name: console_log_handler
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
convert:
dependency: transitive
description:
......@@ -83,6 +104,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
flutter_image:
dependency: transitive
description:
name: flutter_image
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
flutter_map:
dependency: "direct main"
description:
name: flutter_map
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.2"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -109,20 +151,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
latlong:
dependency: transitive
description:
name: latlong
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
version: "1.1.8"
path:
dependency: transitive
description:
......@@ -130,6 +193,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
pedantic:
dependency: transitive
description:
......@@ -137,6 +207,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.0"
petitparser:
dependency: transitive
description:
......@@ -144,6 +221,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
positioned_tap_detector:
dependency: transitive
description:
name: positioned_tap_detector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
provider:
dependency: "direct main"
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
quiver:
dependency: transitive
description:
......@@ -163,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
stack_trace:
dependency: transitive
description:
......@@ -184,6 +289,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
term_glyph:
dependency: transitive
description:
......@@ -197,7 +309,21 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
transparent_image:
dependency: transitive
description:
name: transparent_image
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
tuple:
dependency: transitive
description:
name: tuple
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
typed_data:
dependency: transitive
description:
......@@ -205,6 +331,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
validate:
dependency: transitive
description:
name: validate
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
vector_math:
dependency: transitive
description:
......@@ -220,4 +360,5 @@ packages:
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.6.0 <3.0.0"
flutter: ">=1.10.15 <2.0.0"
......@@ -11,10 +11,10 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
version: 0.0.1
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
......@@ -25,6 +25,9 @@ dependencies:
cupertino_icons: ^0.1.2
device_preview: ^0.1.9-beta
carousel_slider: ^1.4.1
permission_handler: ^3.1.0
provider:
flutter_map: ^0.8.2
dev_dependencies:
flutter_test:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment