mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-24 23:32:27 +00:00
use copywith and final class for bookableSpaceConfig
This commit is contained in:
@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BookableSpaceConfig {
|
class BookableSpaceConfig {
|
||||||
String configUuid;
|
final String configUuid;
|
||||||
List<String> bookableDays;
|
final List<String> bookableDays;
|
||||||
TimeOfDay? bookingStartTime;
|
final TimeOfDay? bookingStartTime;
|
||||||
TimeOfDay? bookingEndTime;
|
final TimeOfDay? bookingEndTime;
|
||||||
int cost;
|
final int cost;
|
||||||
bool availability;
|
final bool availability;
|
||||||
BookableSpaceConfig({
|
BookableSpaceConfig({
|
||||||
required this.configUuid,
|
required this.configUuid,
|
||||||
required this.availability,
|
required this.availability,
|
||||||
|
@ -66,7 +66,8 @@ class BookingPeriodWidget extends StatelessWidget {
|
|||||||
throw Exception();
|
throw Exception();
|
||||||
} else {
|
} else {
|
||||||
setupBookableSpacesBloc.selectedBookableSpaces.forEach(
|
setupBookableSpacesBloc.selectedBookableSpaces.forEach(
|
||||||
(e) => e.spaceConfig!.bookingStartTime = timePicked,
|
(e) =>
|
||||||
|
e.spaceConfig!.copyWith(bookingStartTime: timePicked),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -99,7 +100,8 @@ class BookingPeriodWidget extends StatelessWidget {
|
|||||||
throw Exception();
|
throw Exception();
|
||||||
} else {
|
} else {
|
||||||
setupBookableSpacesBloc.selectedBookableSpaces.forEach(
|
setupBookableSpacesBloc.selectedBookableSpaces.forEach(
|
||||||
(e) => e.spaceConfig!.bookingEndTime = timePicked,
|
(e) =>
|
||||||
|
e.spaceConfig!.copyWith(bookingEndTime: timePicked),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -81,7 +81,7 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
.read<SetupBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.forEach(
|
.forEach(
|
||||||
(e) => e.spaceConfig!.cost = -1,
|
(e) => e.spaceConfig!.copyWith(cost: -1),
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
.read<SetupBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
@ -95,7 +95,7 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
.read<SetupBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.forEach(
|
.forEach(
|
||||||
(e) => e.spaceConfig!.cost = 0,
|
(e) => e.spaceConfig!.copyWith(cost: 0),
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
.read<SetupBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
@ -118,10 +118,10 @@ class _PointsPartWidgetState extends State<PointsPartWidget> {
|
|||||||
.read<SetupBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces
|
.selectedBookableSpaces
|
||||||
.forEach(
|
.forEach(
|
||||||
(e) => e.spaceConfig!.cost = int.parse(
|
(e) => e.spaceConfig!.copyWith(
|
||||||
widget.pointsController.text.isEmpty
|
cost: int.parse(widget.pointsController.text.isEmpty
|
||||||
? '0'
|
? '0'
|
||||||
: widget.pointsController.text,
|
: widget.pointsController.text),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
|
@ -60,7 +60,7 @@ class _WeekDaysCheckboxRowState extends State<WeekDaysCheckboxRow> {
|
|||||||
for (var space in context
|
for (var space in context
|
||||||
.read<SetupBookableSpacesBloc>()
|
.read<SetupBookableSpacesBloc>()
|
||||||
.selectedBookableSpaces) {
|
.selectedBookableSpaces) {
|
||||||
space.spaceConfig!.bookableDays = selectedDays;
|
space.spaceConfig!.copyWith(bookableDays: selectedDays);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user