From fe23ca5ecdabd698917c4e84915151fc32cb335e Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Sat, 24 Dec 2022 15:30:10 -0500 Subject: Rework temperature controls Rework the temperature controls to use NumberPicker widgets so they function more like a user would expect. The associated Riverpod providers have been updated to track the temperature value directly, and some minor layout tweaks have also been made. Bug-AGL: SPEC-4644 Signed-off-by: Scott Murray Change-Id: I069e0bd53c79d73cc7a60045309efdfeb9409fbc --- lib/Buttons/auto.dart | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'lib/Buttons') diff --git a/lib/Buttons/auto.dart b/lib/Buttons/auto.dart index 536a117..1bdb045 100644 --- a/lib/Buttons/auto.dart +++ b/lib/Buttons/auto.dart @@ -21,7 +21,8 @@ class Auto extends ConsumerStatefulWidget { _AutoState createState() => _AutoState(); } -class _AutoState extends ConsumerState with SingleTickerProviderStateMixin { +class _AutoState extends ConsumerState + with SingleTickerProviderStateMixin { late AnimationController _controller; late bool isAutoActive; late Animation _colorAnimation; @@ -39,11 +40,7 @@ class _AutoState extends ConsumerState with SingleTickerProviderStateMixin ColorTween(begin: Colors.lightBlueAccent, end: Colors.green) .animate(_controller); - _controller.addListener(() { - - }); - - + _controller.addListener(() {}); } // dismiss the animation when widget exits screen @@ -62,33 +59,30 @@ class _AutoState extends ConsumerState with SingleTickerProviderStateMixin return InkWell( child: AnimatedContainer( constraints: BoxConstraints( - maxHeight: SizeConfig.screenHeight*0.10, - maxWidth: SizeConfig.screenWidth*0.15, + maxHeight: SizeConfig.screenHeight * 0.10, + maxWidth: SizeConfig.screenWidth * 0.15, ), - - decoration: BoxDecoration( gradient: isAutoActive ? RadialGradient( - colors: [Colors.black, Colors.lightBlue], - radius: 2, - ) + colors: [Colors.black, Colors.lightBlue], + radius: 2, + ) : null, - - border: Border.all( color: Colors.white, width: 2, ), - borderRadius: BorderRadius.circular(SizeConfig.safeBlockVertical*2), + borderRadius: + BorderRadius.circular(SizeConfig.safeBlockVertical * 2), ), duration: Duration(seconds: 1), child: AnimatedContainer( duration: Duration(milliseconds: 100), - margin: EdgeInsets.all(SizeConfig.blockSizeVertical*2), + margin: EdgeInsets.all(SizeConfig.blockSizeVertical * 2), child: Container( - width: SizeConfig.screenWidth*0.15, - height: SizeConfig.screenHeight*0.10, + width: SizeConfig.screenWidth * 0.15, + height: SizeConfig.screenHeight * 0.10, child: FittedBox( fit: BoxFit.fill, child: Text( @@ -110,7 +104,6 @@ class _AutoState extends ConsumerState with SingleTickerProviderStateMixin .update(isAutoActive: !isAutoActive); }, ); - }); } } -- cgit 1.2.3-korg