From be6da389e358a733801487954689b40192faadd3 Mon Sep 17 00:00:00 2001 From: Yong Date: Thu, 1 Aug 2024 15:40:07 +0800 Subject: [PATCH] upgrade code version --- lib/components/explore_content_widget.dart | 42 +++++--- lib/components/explore_widget.dart | 32 +++--- lib/components/map_button.dart | 39 ++++--- lib/components/menu_widget.dart | 90 +++++++++++----- lib/components/recent_search_widget.dart | 6 +- lib/components/search_back_widget.dart | 6 +- lib/components/search_menu_widget.dart | 3 +- lib/components/search_widget.dart | 21 ++-- lib/helper/ui_helper.dart | 4 +- lib/home_page.dart | 117 ++++++++++++++------- pubspec.yaml | 34 +++--- 11 files changed, 257 insertions(+), 137 deletions(-) diff --git a/lib/components/explore_content_widget.dart b/lib/components/explore_content_widget.dart index d3eb889..7cc4861 100644 --- a/lib/components/explore_content_widget.dart +++ b/lib/components/explore_content_widget.dart @@ -3,14 +3,20 @@ import 'package:flutter_challenge_googlemaps/helper/ui_helper.dart'; class ExploreContentWidget extends StatelessWidget { final double currentExplorePercent; - final placeName = const ["Authentic\nrestaurant", "Famous\nmonuments", "Weekend\ngetaways"]; - const ExploreContentWidget({Key key, this.currentExplorePercent}) : super(key: key); + final placeName = const [ + "Authentic\nrestaurant", + "Famous\nmonuments", + "Weekend\ngetaways" + ]; + const ExploreContentWidget({Key? key, required this.currentExplorePercent}) + : super(key: key); @override Widget build(BuildContext context) { if (currentExplorePercent != 0) { return Positioned( - top: realH(standardHeight + (162 - standardHeight) * currentExplorePercent), + top: realH( + standardHeight + (162 - standardHeight) * currentExplorePercent), width: screenWidth, child: Container( height: screenHeight, @@ -25,7 +31,8 @@ class ExploreContentWidget extends StatelessWidget { children: [ Expanded( child: Transform.translate( - offset: Offset(screenWidth / 3 * (1 - currentExplorePercent), + offset: Offset( + screenWidth / 3 * (1 - currentExplorePercent), screenWidth / 3 / 2 * (1 - currentExplorePercent)), child: Image.asset( "assets/icon_1.png", @@ -43,7 +50,8 @@ class ExploreContentWidget extends StatelessWidget { ), Expanded( child: Transform.translate( - offset: Offset(-screenWidth / 3 * (1 - currentExplorePercent), + offset: Offset( + -screenWidth / 3 * (1 - currentExplorePercent), screenWidth / 3 / 2 * (1 - currentExplorePercent)), child: Image.asset( "assets/icon_3.png", @@ -56,12 +64,14 @@ class ExploreContentWidget extends StatelessWidget { ), ), Transform.translate( - offset: Offset(0, realH(23 + 380 * (1 - currentExplorePercent))), + offset: + Offset(0, realH(23 + 380 * (1 - currentExplorePercent))), child: Opacity( opacity: currentExplorePercent, child: Container( width: screenWidth, - height: realH(172 + (172 * 4 * (1 - currentExplorePercent))), + height: realH( + 172 + (172 * 4 * (1 - currentExplorePercent))), child: ListView( physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, @@ -79,7 +89,8 @@ class ExploreContentWidget extends StatelessWidget { ), ))), Transform.translate( - offset: Offset(0, realH(58 + 570 * (1 - currentExplorePercent))), + offset: + Offset(0, realH(58 + 570 * (1 - currentExplorePercent))), child: Opacity( opacity: currentExplorePercent, child: Padding( @@ -91,8 +102,10 @@ class ExploreContentWidget extends StatelessWidget { Padding( padding: EdgeInsets.only(left: realW(22)), child: Text("EVENTS", - style: - const TextStyle(color: Colors.white54, fontSize: 13, fontWeight: FontWeight.bold)), + style: const TextStyle( + color: Colors.white54, + fontSize: 13, + fontWeight: FontWeight.bold)), ), Stack( children: [ @@ -104,12 +117,17 @@ class ExploreContentWidget extends StatelessWidget { left: realW(24), child: Text( "Marshmello Live in Concert", - style: TextStyle(color: Colors.white, fontSize: realW(16)), + style: TextStyle( + color: Colors.white, + fontSize: realW(16)), )) ], ), Transform.translate( - offset: Offset(0, realH(30 - 30 * (currentExplorePercent - 0.75) * 4)), + offset: Offset( + 0, + realH(30 - + 30 * (currentExplorePercent - 0.75) * 4)), child: Row( children: [ Expanded( diff --git a/lib/components/explore_widget.dart b/lib/components/explore_widget.dart index 2b6db9b..21588c2 100644 --- a/lib/components/explore_widget.dart +++ b/lib/components/explore_widget.dart @@ -14,20 +14,22 @@ class ExploreWidget extends StatelessWidget { final bool isExploreOpen; const ExploreWidget( - {Key key, - this.currentSearchPercent, - this.currentExplorePercent, - this.animateExplore, - this.isExploreOpen, - this.onVerticalDragUpdate, - this.onPanDown}) + {Key? key, + required this.currentSearchPercent, + required this.currentExplorePercent, + required this.animateExplore, + required this.isExploreOpen, + required this.onVerticalDragUpdate, + required this.onPanDown}) : super(key: key); @override Widget build(BuildContext context) { return Positioned( bottom: realH(-122 * currentSearchPercent), - left: (screenWidth - realW(159 + (standardWidth - 159) * currentExplorePercent)) / 2, + left: (screenWidth - + realW(159 + (standardWidth - 159) * currentExplorePercent)) / + 2, child: GestureDetector( onTap: () { animateExplore(!isExploreOpen); @@ -49,8 +51,10 @@ class ExploreWidget extends StatelessWidget { Color(0xFF8739E5), ]), borderRadius: BorderRadius.only( - topLeft: Radius.circular(realW(80 + (50 - 80) * currentExplorePercent)), - topRight: Radius.circular(realW(80 + (50 - 80) * currentExplorePercent)))), + topLeft: Radius.circular( + realW(80 + (50 - 80) * currentExplorePercent)), + topRight: Radius.circular( + realW(80 + (50 - 80) * currentExplorePercent)))), child: Stack( children: [ Positioned( @@ -58,7 +62,10 @@ class ExploreWidget extends StatelessWidget { left: realW(49 + (91 - 49) * currentExplorePercent), child: Text( "Explore", - style: TextStyle(color: Colors.white, fontSize: realW(18 + (32 - 18) * currentExplorePercent)), + style: TextStyle( + color: Colors.white, + fontSize: + realW(18 + (32 - 18) * currentExplorePercent)), )), Positioned( top: realH(20 + (60 - 20) * currentExplorePercent), @@ -71,7 +78,8 @@ class ExploreWidget extends StatelessWidget { Positioned( top: realH(currentExplorePercent < 0.9 ? realH(-35) - : realH(-35 + (6 + 35) * (currentExplorePercent - 0.9) * 8)), + : realH(-35 + + (6 + 35) * (currentExplorePercent - 0.9) * 8)), left: realW(63 + (170 - 63) * currentExplorePercent), child: GestureDetector( onTap: () { diff --git a/lib/components/map_button.dart b/lib/components/map_button.dart index a2aa244..be65740 100644 --- a/lib/components/map_button.dart +++ b/lib/components/map_button.dart @@ -16,17 +16,17 @@ class MapButton extends StatelessWidget { final Gradient gradient; const MapButton( - {Key key, - this.currentSearchPercent, - this.currentExplorePercent, - this.bottom, - this.offsetX, - this.width, - this.height, - this.icon, - this.iconColor, + {Key? key, + required this.currentSearchPercent, + required this.currentExplorePercent, + required this.bottom, + required this.offsetX, + required this.width, + required this.height, + required this.icon, + required this.iconColor, this.isRight = true, - this.gradient}) + required this.gradient}) : assert(currentExplorePercent != null), assert(currentExplorePercent != null), assert(bottom != null), @@ -40,8 +40,12 @@ class MapButton extends StatelessWidget { Widget build(BuildContext context) { return Positioned( bottom: realH(bottom), - left: !isRight ? realW(offsetX * (currentExplorePercent + currentSearchPercent)) : null, - right: isRight ? realW(offsetX * (currentExplorePercent + currentSearchPercent)) : null, + left: !isRight + ? realW(offsetX * (currentExplorePercent + currentSearchPercent)) + : null, + right: isRight + ? realW(offsetX * (currentExplorePercent + currentSearchPercent)) + : null, child: Opacity( opacity: 1 - (currentSearchPercent + currentExplorePercent), child: Container( @@ -58,10 +62,15 @@ class MapButton extends StatelessWidget { color: gradient == null ? Colors.white : null, gradient: gradient, borderRadius: isRight - ? BorderRadius.only(bottomLeft: Radius.circular(realW(36)), topLeft: Radius.circular(realW(36))) - : BorderRadius.only(bottomRight: Radius.circular(realW(36)), topRight: Radius.circular(realW(36))), + ? BorderRadius.only( + bottomLeft: Radius.circular(realW(36)), + topLeft: Radius.circular(realW(36))) + : BorderRadius.only( + bottomRight: Radius.circular(realW(36)), + topRight: Radius.circular(realW(36))), boxShadow: [ - BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)), + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)), ]), ), ), diff --git a/lib/components/menu_widget.dart b/lib/components/menu_widget.dart index 51be63b..7531ab8 100644 --- a/lib/components/menu_widget.dart +++ b/lib/components/menu_widget.dart @@ -3,18 +3,28 @@ import 'package:flutter_challenge_googlemaps/helper/ui_helper.dart'; /// Drawer Menu class MenuWidget extends StatelessWidget { - final menuItems = ['Home', 'Saved', 'Timeline', 'Contributions', 'Messages', 'Sharing', 'Drive Mode']; + final menuItems = [ + 'Home', + 'Saved', + 'Timeline', + 'Contributions', + 'Messages', + 'Sharing', + 'Drive Mode' + ]; - final num currentMenuPercent; + final double currentMenuPercent; final Function(bool) animateMenu; - MenuWidget({Key key, this.currentMenuPercent, this.animateMenu}) : super(key: key); + MenuWidget( + {Key? key, required this.currentMenuPercent, required this.animateMenu}) + : super(key: key); @override Widget build(BuildContext context) { return currentMenuPercent != 0 ? Positioned( - left: realW(-358 + 358 * currentMenuPercent), + left: realW(-358.toDouble() + 358 * currentMenuPercent), width: realW(358), height: screenHeight, child: Opacity( @@ -22,16 +32,19 @@ class MenuWidget extends StatelessWidget { child: Container( decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.only(topRight: Radius.circular(realW(50))), + borderRadius: + BorderRadius.only(topRight: Radius.circular(realW(50))), boxShadow: [ - BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.16), blurRadius: realW(20)), + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.16), + blurRadius: realW(20)), ], ), child: Stack( children: [ NotificationListener( onNotification: (notification) { - notification.disallowGlow(); + return true; }, child: CustomScrollView( physics: NeverScrollableScrollPhysics(), @@ -40,11 +53,14 @@ class MenuWidget extends StatelessWidget { child: Container( height: realH(236), decoration: BoxDecoration( - borderRadius: BorderRadius.only(topRight: Radius.circular(realW(50))), - gradient: const LinearGradient(begin: Alignment.topLeft, colors: [ - Color(0xFF59C2FF), - Color(0xFF1270E3), - ])), + borderRadius: BorderRadius.only( + topRight: Radius.circular(realW(50))), + gradient: const LinearGradient( + begin: Alignment.topLeft, + colors: [ + Color(0xFF59C2FF), + Color(0xFF1270E3), + ])), child: Stack( children: [ Positioned( @@ -72,21 +88,28 @@ class MenuWidget extends StatelessWidget { style: TextStyle(color: Colors.white), child: Column( mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( "implemented by ditclear", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: realW(18)), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: realW(18)), ), Padding( - padding: EdgeInsets.symmetric(vertical: realH(11.0)), + padding: EdgeInsets.symmetric( + vertical: realH(11.0)), child: FittedBox( fit: BoxFit.scaleDown, child: Text.rich( TextSpan( - text: "https://github.com/ditclear", + text: + "https://github.com/ditclear", style: TextStyle( - fontSize: realW(16), decoration: TextDecoration.underline), + fontSize: realW(16), + decoration: TextDecoration + .underline), ), ), ), @@ -95,7 +118,8 @@ class MenuWidget extends StatelessWidget { children: [ Text( "公众号:ditclear", - style: TextStyle(fontSize: realW(14)), + style: TextStyle( + fontSize: realW(14)), ), Icon( Icons.arrow_right, @@ -113,10 +137,14 @@ class MenuWidget extends StatelessWidget { ), ), SliverPadding( - padding: EdgeInsets.only(top: realH(34), bottom: realH(50), right: realW(37)), + padding: EdgeInsets.only( + top: realH(34), + bottom: realH(50), + right: realW(37)), sliver: SliverFixedExtentList( itemExtent: realH(56), - delegate: new SliverChildBuilderDelegate((BuildContext context, int index) { + delegate: new SliverChildBuilderDelegate( + (BuildContext context, int index) { //创建列表项 return Container( width: realW(321), @@ -124,15 +152,21 @@ class MenuWidget extends StatelessWidget { padding: EdgeInsets.only(left: realW(20)), decoration: index == 0 ? BoxDecoration( - color: Color(0xFF379BF2).withOpacity(0.2), + color: Color(0xFF379BF2) + .withOpacity(0.2), borderRadius: BorderRadius.only( - topRight: Radius.circular(realW(50)), - bottomRight: Radius.circular(realW(50)))) + topRight: + Radius.circular(realW(50)), + bottomRight: + Radius.circular(realW(50)))) : null, child: Text( menuItems[index], - style: - TextStyle(color: index == 0 ? Colors.blue : Colors.black, fontSize: realW(20)), + style: TextStyle( + color: index == 0 + ? Colors.blue + : Colors.black, + fontSize: realW(20)), ), ); }, childCount: menuItems.length), @@ -143,7 +177,8 @@ class MenuWidget extends StatelessWidget { sliver: SliverToBoxAdapter( child: Text( 'Settings', - style: TextStyle(color: Colors.black, fontSize: realW(20)), + style: TextStyle( + color: Colors.black, fontSize: realW(20)), ), ), ) @@ -171,7 +206,8 @@ class MenuWidget extends StatelessWidget { decoration: BoxDecoration( color: Color(0xFFFB5E74).withOpacity(0.2), borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(realW(36)), topLeft: Radius.circular(realW(36))), + bottomLeft: Radius.circular(realW(36)), + topLeft: Radius.circular(realW(36))), ), ), ), diff --git a/lib/components/recent_search_widget.dart b/lib/components/recent_search_widget.dart index 823697a..ce70af6 100644 --- a/lib/components/recent_search_widget.dart +++ b/lib/components/recent_search_widget.dart @@ -4,13 +4,15 @@ import 'package:flutter_challenge_googlemaps/helper/ui_helper.dart'; class RecentSearchWidget extends StatelessWidget { final double currentSearchPercent; - const RecentSearchWidget({Key key, this.currentSearchPercent}) : super(key: key); + const RecentSearchWidget({Key? key, required this.currentSearchPercent}) + : super(key: key); @override Widget build(BuildContext context) { return currentSearchPercent != 0 ? Positioned( - top: realH(-(75.0 + 494.0) + (75 + 75.0 + 494.0) * currentSearchPercent), + top: realH( + -(75.0 + 494.0) + (75 + 75.0 + 494.0) * currentSearchPercent), left: realW((standardWidth - 320) / 2), width: realW(320), height: realH(494), diff --git a/lib/components/search_back_widget.dart b/lib/components/search_back_widget.dart index 0dd86f2..78243b8 100644 --- a/lib/components/search_back_widget.dart +++ b/lib/components/search_back_widget.dart @@ -6,7 +6,11 @@ class SearchBackWidget extends StatelessWidget { final Function(bool) animateSearch; - const SearchBackWidget({Key key, this.currentSearchPercent, this.animateSearch}) : super(key: key); + const SearchBackWidget( + {Key? key, + required this.currentSearchPercent, + required this.animateSearch}) + : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/components/search_menu_widget.dart b/lib/components/search_menu_widget.dart index 0d16ec0..af936a1 100644 --- a/lib/components/search_menu_widget.dart +++ b/lib/components/search_menu_widget.dart @@ -4,7 +4,8 @@ import 'package:flutter_challenge_googlemaps/helper/ui_helper.dart'; class SearchMenuWidget extends StatelessWidget { final double currentSearchPercent; - const SearchMenuWidget({Key key, this.currentSearchPercent}) : super(key: key); + const SearchMenuWidget({Key? key, required this.currentSearchPercent}) + : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/components/search_widget.dart b/lib/components/search_widget.dart index 89328ae..326f196 100644 --- a/lib/components/search_widget.dart +++ b/lib/components/search_widget.dart @@ -15,20 +15,22 @@ class SearchWidget extends StatelessWidget { final Function() onPanDown; const SearchWidget( - {Key key, - this.currentExplorePercent, - this.currentSearchPercent, - this.animateSearch, - this.isSearchOpen, - this.onHorizontalDragUpdate, - this.onPanDown}) + {Key? key, + required this.currentExplorePercent, + required this.currentSearchPercent, + required this.animateSearch, + required this.isSearchOpen, + required this.onHorizontalDragUpdate, + required this.onPanDown}) : super(key: key); @override Widget build(BuildContext context) { return Positioned( bottom: realH(53), - right: realW((68.0 - 320) - (68.0 * currentExplorePercent) + (347 - 68.0) * currentSearchPercent), + right: realW((68.0 - 320) - + (68.0 * currentExplorePercent) + + (347 - 68.0) * currentSearchPercent), child: GestureDetector( onTap: () { animateSearch(!isSearchOpen); @@ -54,7 +56,8 @@ class SearchWidget extends StatelessWidget { color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(realW(36))), boxShadow: [ - BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)), + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)), ]), ), ), diff --git a/lib/helper/ui_helper.dart b/lib/helper/ui_helper.dart index dc3a3e9..136ea63 100644 --- a/lib/helper/ui_helper.dart +++ b/lib/helper/ui_helper.dart @@ -5,8 +5,8 @@ final standardWidth = 375.0; final standardHeight = 815.0; /// late init -double screenWidth; -double screenHeight; +double screenWidth = 0.0; +double screenHeight = 0.0; /// scale [height] by [standardHeight] double realH(double height) { diff --git a/lib/home_page.dart b/lib/home_page.dart index ab10328..b006adc 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -17,17 +17,19 @@ class GoogleMapPage extends StatefulWidget { } } -class _GoogleMapState extends State with TickerProviderStateMixin { - AnimationController animationControllerExplore; - AnimationController animationControllerSearch; - AnimationController animationControllerMenu; - CurvedAnimation curve; - Animation animation; - Animation animationW; - Animation animationR; +class _GoogleMapState extends State + with TickerProviderStateMixin { + late AnimationController animationControllerExplore; + late AnimationController animationControllerSearch; + late AnimationController animationControllerMenu; + late CurvedAnimation curve; + late Animation animation; + late Animation animationW; + late Animation animationR; /// get currentOffset percent - get currentExplorePercent => max(0.0, min(1.0, offsetExplore / (760.0 - 122.0))); + get currentExplorePercent => + max(0.0, min(1.0, offsetExplore / (760.0 - 122.0))); get currentSearchPercent => max(0.0, min(1.0, offsetSearch / (347 - 68.0))); get currentMenuPercent => max(0.0, min(1.0, offsetMenu / 358)); @@ -68,10 +70,17 @@ class _GoogleMapState extends State with TickerProviderStateMixin void animateExplore(bool open) { animationControllerExplore = AnimationController( duration: Duration( - milliseconds: 1 + (800 * (isExploreOpen ? currentExplorePercent : (1 - currentExplorePercent))).toInt()), + milliseconds: 1 + + (800 * + (isExploreOpen + ? currentExplorePercent + : (1 - currentExplorePercent))) + .toInt()), vsync: this); - curve = CurvedAnimation(parent: animationControllerExplore, curve: Curves.ease); - animation = Tween(begin: offsetExplore, end: open ? 760.0 - 122 : 0.0).animate(curve) + curve = + CurvedAnimation(parent: animationControllerExplore, curve: Curves.ease); + animation = Tween(begin: offsetExplore, end: open ? 760.0 - 122 : 0.0) + .animate(curve) ..addListener(() { setState(() { offsetExplore = animation.value; @@ -88,10 +97,17 @@ class _GoogleMapState extends State with TickerProviderStateMixin void animateSearch(bool open) { animationControllerSearch = AnimationController( duration: Duration( - milliseconds: 1 + (800 * (isSearchOpen ? currentSearchPercent : (1 - currentSearchPercent))).toInt()), + milliseconds: 1 + + (800 * + (isSearchOpen + ? currentSearchPercent + : (1 - currentSearchPercent))) + .toInt()), vsync: this); - curve = CurvedAnimation(parent: animationControllerSearch, curve: Curves.ease); - animation = Tween(begin: offsetSearch, end: open ? 347.0 - 68.0 : 0.0).animate(curve) + curve = + CurvedAnimation(parent: animationControllerSearch, curve: Curves.ease); + animation = Tween(begin: offsetSearch, end: open ? 347.0 - 68.0 : 0.0) + .animate(curve) ..addListener(() { setState(() { offsetSearch = animation.value; @@ -106,19 +122,22 @@ class _GoogleMapState extends State with TickerProviderStateMixin } void animateMenu(bool open) { - animationControllerMenu = AnimationController(duration: Duration(milliseconds: 500), vsync: this); - curve = CurvedAnimation(parent: animationControllerMenu, curve: Curves.ease); - animation = Tween(begin: open ? 0.0 : 358.0, end: open ? 358.0 : 0.0).animate(curve) - ..addListener(() { - setState(() { - offsetMenu = animation.value; - }); - }) - ..addStatusListener((status) { - if (status == AnimationStatus.completed) { - isMenuOpen = open; - } - }); + animationControllerMenu = + AnimationController(duration: Duration(milliseconds: 500), vsync: this); + curve = + CurvedAnimation(parent: animationControllerMenu, curve: Curves.ease); + animation = + Tween(begin: open ? 0.0 : 358.0, end: open ? 358.0 : 0.0).animate(curve) + ..addListener(() { + setState(() { + offsetMenu = animation.value; + }); + }) + ..addStatusListener((status) { + if (status == AnimationStatus.completed) { + isMenuOpen = open; + } + }); animationControllerMenu.forward(); } @@ -150,9 +169,12 @@ class _GoogleMapState extends State with TickerProviderStateMixin //blur offsetSearch != 0 ? BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10 * currentSearchPercent, sigmaY: 10 * currentSearchPercent), + filter: ImageFilter.blur( + sigmaX: 10.toDouble() * currentSearchPercent, + sigmaY: 10.toDouble() * currentSearchPercent), child: Container( - color: Colors.white.withOpacity(0.1 * currentSearchPercent), + color: + Colors.white.withOpacity(0.1 * currentSearchPercent), width: screenWidth, height: screenHeight, ), @@ -174,14 +196,15 @@ class _GoogleMapState extends State with TickerProviderStateMixin bottom: realH(88), left: realW((standardWidth - 320) / 2), width: realW(320), - height: realH(135 * currentSearchPercent), + height: realH(135.toDouble() * currentSearchPercent), child: Opacity( opacity: currentSearchPercent, child: DecoratedBox( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( - topLeft: Radius.circular(realW(33)), topRight: Radius.circular(realW(33)))), + topLeft: Radius.circular(realW(33)), + topRight: Radius.circular(realW(33)))), ), ), ) @@ -216,6 +239,11 @@ class _GoogleMapState extends State with TickerProviderStateMixin height: 71, isRight: false, icon: Icons.layers, + iconColor: Colors.white, + gradient: const LinearGradient(colors: [ + Color(0xFF59C2FF), + Color(0xFF1270E3), + ]), ), //directions button MapButton( @@ -241,18 +269,24 @@ class _GoogleMapState extends State with TickerProviderStateMixin width: 68, height: 71, icon: Icons.my_location, - iconColor: Colors.blue, + iconColor: Colors.white, + gradient: const LinearGradient(colors: [ + Color(0xFF59C2FF), + Color(0xFF1270E3), + ]), ), //menu button Positioned( bottom: realH(53), - left: realW(-71 * (currentExplorePercent + currentSearchPercent)), + left: realW(-71.toDouble() * + (currentExplorePercent + currentSearchPercent)), child: GestureDetector( onTap: () { animateMenu(true); }, child: Opacity( - opacity: 1 - (currentSearchPercent + currentExplorePercent), + opacity: 1.toDouble() - + (currentSearchPercent + currentExplorePercent), child: Container( width: realW(71), height: realH(71), @@ -265,16 +299,21 @@ class _GoogleMapState extends State with TickerProviderStateMixin decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( - bottomRight: Radius.circular(realW(36)), topRight: Radius.circular(realW(36))), + bottomRight: Radius.circular(realW(36)), + topRight: Radius.circular(realW(36))), boxShadow: [ - BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.3), blurRadius: realW(36)), + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.3), + blurRadius: realW(36)), ]), ), ), ), ), //menu - MenuWidget(currentMenuPercent: currentMenuPercent, animateMenu: animateMenu), + MenuWidget( + currentMenuPercent: currentMenuPercent, + animateMenu: animateMenu), ], ), ), @@ -284,7 +323,7 @@ class _GoogleMapState extends State with TickerProviderStateMixin @override void initState() { super.initState(); - SystemChrome.setEnabledSystemUIOverlays([]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); } @override diff --git a/pubspec.yaml b/pubspec.yaml index 2bcb1ae..926e56f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ description: rework the UI of the Google Maps in uplabs by Flutter. version: 1.0.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <4.0.0" dependencies: flutter: @@ -22,7 +22,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + cupertino_icons: ^1.0.8 dev_dependencies: flutter_test: @@ -42,21 +42,21 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - - arrow.png - - banner_1.png - - banner_2.png - - banner_3.png - - banner_4.png - - banner_5.png - - dj.png - - icon_1.png - - icon_2.png - - icon_3.png - - map.png - - recent.png - - search.png - - avatar.png - - lable.png + - assets/arrow.png + - assets/banner_1.png + - assets/banner_2.png + - assets/banner_3.png + - assets/banner_4.png + - assets/banner_5.png + - assets/dj.png + - assets/icon_1.png + - assets/icon_2.png + - assets/icon_3.png + - assets/map.png + - assets/recent.png + - assets/search.png + - assets/avatar.png + - assets/lable.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.