From 6bee5378e7bfce47e29657d6dfe05ffd9086aa0f Mon Sep 17 00:00:00 2001 From: Jonasz Bigda Date: Mon, 11 Jan 2021 11:20:14 +0100 Subject: [PATCH] filters --- lib/components/mapView.dart | 24 +++++++++++++ lib/components/searchResults.dart | 57 +++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/lib/components/mapView.dart b/lib/components/mapView.dart index 155d667..1687b53 100644 --- a/lib/components/mapView.dart +++ b/lib/components/mapView.dart @@ -77,6 +77,30 @@ class MapViewState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ + Expanded( + child: Row( + children: [ + RaisedButton( + color: Colors.grey[900], + elevation: 0, + padding: EdgeInsets.symmetric( + vertical: 12, horizontal: 4), + onPressed: () { + Navigator.pop(context); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.arrow_back_ios_rounded, + color: Colors.orange, + ), + ], + ), + ), + ], + ), + ), RaisedButton( color: Colors.grey[900], elevation: 0, diff --git a/lib/components/searchResults.dart b/lib/components/searchResults.dart index 9a7e21c..196378f 100644 --- a/lib/components/searchResults.dart +++ b/lib/components/searchResults.dart @@ -21,8 +21,52 @@ class SearchResults extends StatefulWidget { _SearchResultsState createState() => _SearchResultsState(); } -class _SearchResultsState extends State { +class _SearchResultsState extends State + with SingleTickerProviderStateMixin { GlobalKey _drawerKey = GlobalKey(); + bool expand; + AnimationController animationController; + Animation animation; + + void prepareAnimations() { + animationController = + AnimationController(vsync: this, duration: Duration(milliseconds: 500)); + animation = CurvedAnimation( + parent: animationController, curve: Curves.fastOutSlowIn); + } + + void checkExpand() { + print('Check Expand'); + if (expand) { + animationController.forward(); + print('Open'); + } else { + animationController.reverse(); + print('Close'); + } + } + + @override + void didUpdateWidget(SearchResults oldWidget) { + print('Widget Did Update'); + super.didUpdateWidget(oldWidget); + checkExpand(); + } + + @override + void initState() { + print("Init State"); + super.initState(); + expand = false; + prepareAnimations(); + checkExpand(); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } @override Widget build(BuildContext context) { @@ -35,6 +79,13 @@ class _SearchResultsState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ + SizeTransition( + sizeFactor: animation, + child: Container( + decoration: BoxDecoration(color: Colors.blue), + child: Text("Dupa"), + ), + ), Container( decoration: BoxDecoration(color: Colors.grey[850]), child: Column( @@ -118,7 +169,9 @@ class _SearchResultsState extends State { icon: Icons.filter_alt_rounded, text: "Filtruj", onPressed: () { - _drawerKey.currentState.openDrawer(); + setState(() { + expand = !expand; + }); }, ), ],