From 70ec8a79a121471a004e7e4c23157d10157e136f Mon Sep 17 00:00:00 2001 From: Lisandro Pérez Meyer Date: Tue, 14 Nov 2023 17:20:58 -0300 Subject: Initial cleanup push. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on agldemo2024 on commit 2a5dc04d801134338150c3f6afc67eaa65599763 Disable device preview. Disable Lottie animation. The original commit was b3c493c340fcb4bb0a937692838fc830bec3e9ea but I am just keeping this change, because the json did not really needed to change. I think. Signed-off-by: Lisandro Pérez Meyer --- lib/presentation/common_widget/fan_bar.dart | 188 ++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 lib/presentation/common_widget/fan_bar.dart (limited to 'lib/presentation/common_widget/fan_bar.dart') diff --git a/lib/presentation/common_widget/fan_bar.dart b/lib/presentation/common_widget/fan_bar.dart new file mode 100644 index 0000000..e119089 --- /dev/null +++ b/lib/presentation/common_widget/fan_bar.dart @@ -0,0 +1,188 @@ +import '../../export.dart'; +import 'package:flutter_ics_homescreen/presentation/custom_icons/custom_icons.dart'; + +enum FanMode { off, min, medium, max } + +class FanBar extends ConsumerStatefulWidget { + const FanBar({super.key}); + + @override + FanBarState createState() => FanBarState(); +} + +class FanBarState extends ConsumerState { + int selectedFanSpeed = 0; + + @override + Widget build(BuildContext context) { + final vehicle = ref.watch(vehicleProvider.select((vehicle) => vehicle)); + selectedFanSpeed = vehicle.fanSpeed; + + return Column(children: [ + Container( + padding: EdgeInsets.zero, + //width: 80, + height: 256, + decoration: const ShapeDecoration( + // gradient: RadialGradient( + // colors: [Color.fromARGB(255, 19, 24, 75), Colors.black], + // stops: [0, 0.9], + // radius: 1, + // ), + color: AGLDemoColors.buttonFillEnabledColor, + shape: StadiumBorder( + side: BorderSide( + color: Color(0xFF5477D4), + width: 1, + )), + ), + //alignment: Alignment.topLeft, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Material( + color: Colors.transparent, + child: SizedBox( + width: 80, + height: 64, + child: IconButton( + isSelected: selectedFanSpeed == 3, + padding: EdgeInsets.zero, + color: AGLDemoColors.periwinkleColor, + onPressed: () { + ref.read(vehicleProvider.notifier).updateFanSpeed(3); + }, + icon: selectedFanSpeed == 3 + ? Stack( + alignment: Alignment.center, + children: [ + SvgPicture.asset('assets/fanButtonBg.svg'), + const Icon( + CustomIcons.fan_on_enabled, + color: Colors.white, + size: 40, + ), + ], + ) + : const Icon( + CustomIcons.fan_on_enabled, + size: 40, + ), + ), + ), + ), + Material( + color: Colors.transparent, + child: SizedBox( + width: 64, + height: 64, + child: IconButton( + isSelected: selectedFanSpeed == 2, + padding: EdgeInsets.zero, + color: AGLDemoColors.periwinkleColor, + onPressed: () { + ref.read(vehicleProvider.notifier).updateFanSpeed(2); + }, + icon: selectedFanSpeed == 2 + ? Stack( + alignment: Alignment.center, + children: [ + SvgPicture.asset('assets/fanButtonBg.svg'), + const Icon( + CustomIcons.fan_on_enabled, + color: Colors.white, + size: 28, + ), + ], + ) + : const Icon( + CustomIcons.fan_on_enabled, + size: 28, + ), + ), + ), + ), + Material( + color: Colors.transparent, + child: SizedBox( + width: 64, + height: 64, + child: IconButton( + isSelected: selectedFanSpeed == 1, + iconSize: 20, + padding: EdgeInsets.zero, + color: AGLDemoColors.periwinkleColor, + onPressed: () { + ref.read(vehicleProvider.notifier).updateFanSpeed(1); + }, + icon: selectedFanSpeed == 1 + ? Stack( + alignment: Alignment.center, + children: [ + SvgPicture.asset('assets/fanButtonBg.svg'), + const Icon( + CustomIcons.fan_on_enabled, + color: Colors.white, + size: 20, + ), + ], + ) + : const Icon( + CustomIcons.fan_on_enabled, + size: 20, + ), + ), + ), + ), + ], + ), + ), + const SizedBox(height: 10), + Container( + width: 80, + height: 80, + decoration: const ShapeDecoration( + // gradient: RadialGradient( + // colors: [Color.fromARGB(255, 19, 24, 75), Colors.black], + // stops: [0, 0.9], + // radius: 1, + // ), + color: AGLDemoColors.buttonFillEnabledColor, + shape: StadiumBorder( + side: BorderSide( + color: Color(0xFF5477D4), + width: 1, + )), + ), + //alignment: Alignment.topLeft, + child: Material( + color: Colors.transparent, + child: IconButton( + isSelected: selectedFanSpeed == 0, + padding: EdgeInsets.zero, + color: AGLDemoColors.periwinkleColor, + onPressed: () { + ref.read(vehicleProvider.notifier).updateFanSpeed(0); + }, + icon: selectedFanSpeed == 0 + ? Stack( + alignment: Alignment.center, + children: [ + SvgPicture.asset('assets/fanButtonBg.svg'), + const Icon( + Icons.mode_fan_off, + color: Colors.white, + size: 28.4, + ), + ], + ) + : const Icon( + Icons.mode_fan_off, + size: 28.4, + ), + ), + )), + ]); + } +} -- cgit