fixes bugs 5

This commit is contained in:
mohammad
2024-09-24 11:15:29 +03:00
parent 9d8c40e44e
commit e3a6579819
2 changed files with 58 additions and 57 deletions

View File

@ -72,11 +72,12 @@ class DoorRecordsScreen extends StatelessWidget {
), ),
), ),
// List of records for the specific date // List of records for the specific date
DefaultContainer( DefaultContainer(
child: Column( child: Column(
children: [ children: [
...recordsForDate.map((record) { ...recordsForDate.asMap().entries.map((entry) {
final int idx = entry.key;
final DeviceEvent record = entry.value;
final DateTime eventDateTime = final DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch( DateTime.fromMillisecondsSinceEpoch(
record.eventTime!); record.eventTime!);
@ -107,9 +108,11 @@ class DoorRecordsScreen extends StatelessWidget {
subtitle: Text('$formattedTime'), subtitle: Text('$formattedTime'),
), ),
), ),
const Divider( // Only add Divider if it's not the last item
color: ColorsManager.graysColor, if (idx != recordsForDate.length - 1)
) const Divider(
color: ColorsManager.graysColor,
),
], ],
); );
}).toList(), }).toList(),

View File

@ -173,58 +173,56 @@ class TimerScheduleScreen extends StatelessWidget {
children: [ children: [
Center( Center(
child: Container( child: Column(
child: Column( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center, children: [
children: [ countNum > 0
countNum > 0 ? BodyLarge(
? BodyLarge( text: _formatDuration(
text: _formatDuration( countNum),
countNum), fontColor: ColorsManager
fontColor: ColorsManager .slidingBlueColor,
.slidingBlueColor, fontSize: 40,
fontSize: 40, )
) : CupertinoTimerPicker(
: CupertinoTimerPicker( mode:
mode: CupertinoTimerPickerMode
CupertinoTimerPickerMode .hm,
.hm, onTimerDurationChanged:
onTimerDurationChanged: (Duration
(Duration newDuration) {
newDuration) { duration = newDuration;
duration = newDuration; },
}, ),
), GestureDetector(
GestureDetector( onTap: () {
onTap: () { if (state
if (state is LoadingNewSate) {
is LoadingNewSate) { return;
return; }
} if (countNum > 0) {
if (countNum > 0) { twoGangBloc.add(
twoGangBloc.add( SetCounterValue(
SetCounterValue( deviceCode:
deviceCode: deviceCode,
deviceCode, duration: Duration
duration: Duration .zero));
.zero)); } else if (duration !=
} else if (duration != Duration.zero) {
Duration.zero) { twoGangBloc.add(
twoGangBloc.add( SetCounterValue(
SetCounterValue( deviceCode:
deviceCode: deviceCode,
deviceCode, duration:
duration: duration));
duration)); }
} },
}, child: SvgPicture.asset(
child: SvgPicture.asset( countNum > 0
countNum > 0 ? Assets.pauseIcon
? Assets.pauseIcon : Assets.playIcon)),
: Assets.playIcon)), ],
],
),
), ),
), ),
SizedBox( SizedBox(