Enhance navigation buttons in SmartPowerDeviceControl for better user… (#293)

… experience

<!--
  Thanks for contributing!

Provide a description of your changes below and a general summary in the
title

Please look at the following checklist to ensure that your PR can be
accepted quickly:
-->



## Description

<!--- Describe your changes in detail -->
Enhance navigation buttons in SmartPowerDeviceControl 

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ]  New feature (non-breaking change which adds functionality)
- [x] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ]  Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] 🧹 Code refactor
- [ ]  Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore
This commit is contained in:
mohammadnemer1
2025-06-25 09:13:33 +03:00
committed by GitHub

View File

@ -12,7 +12,8 @@ import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart'; import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
//Smart Power Clamp //Smart Power Clamp
class SmartPowerDeviceControl extends StatelessWidget with HelperResponsiveLayout { class SmartPowerDeviceControl extends StatelessWidget
with HelperResponsiveLayout {
final String deviceId; final String deviceId;
const SmartPowerDeviceControl({super.key, required this.deviceId}); const SmartPowerDeviceControl({super.key, required this.deviceId});
@ -145,13 +146,16 @@ class SmartPowerDeviceControl extends StatelessWidget with HelperResponsiveLayou
children: [ children: [
IconButton( IconButton(
icon: const Icon(Icons.arrow_left), icon: const Icon(Icons.arrow_left),
onPressed: () { onPressed: blocProvider.currentPage <= 0
blocProvider.add(SmartPowerArrowPressedEvent(-1)); ? null
pageController.previousPage( : () {
duration: const Duration(milliseconds: 300), blocProvider
curve: Curves.easeInOut, .add(SmartPowerArrowPressedEvent(-1));
); pageController.previousPage(
}, duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
},
), ),
Text( Text(
currentPage == 0 currentPage == 0
@ -165,13 +169,16 @@ class SmartPowerDeviceControl extends StatelessWidget with HelperResponsiveLayou
), ),
IconButton( IconButton(
icon: const Icon(Icons.arrow_right), icon: const Icon(Icons.arrow_right),
onPressed: () { onPressed: blocProvider.currentPage >= 3
blocProvider.add(SmartPowerArrowPressedEvent(1)); ? null
pageController.nextPage( : () {
duration: const Duration(milliseconds: 300), blocProvider
curve: Curves.easeInOut, .add(SmartPowerArrowPressedEvent(1));
); pageController.nextPage(
}, duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
},
), ),
], ],
), ),
@ -195,8 +202,8 @@ class SmartPowerDeviceControl extends StatelessWidget with HelperResponsiveLayou
blocProvider.add(SelectDateEvent(context: context)); blocProvider.add(SelectDateEvent(context: context));
blocProvider.add(FilterRecordsByDateEvent( blocProvider.add(FilterRecordsByDateEvent(
selectedDate: blocProvider.dateTime!, selectedDate: blocProvider.dateTime!,
viewType: viewType: blocProvider
blocProvider.views[blocProvider.currentIndex])); .views[blocProvider.currentIndex]));
}, },
widget: blocProvider.dateSwitcher(), widget: blocProvider.dateSwitcher(),
chartData: blocProvider.energyDataList.isNotEmpty chartData: blocProvider.energyDataList.isNotEmpty