1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

Flutter 3.29 beta (#2571)

This commit is contained in:
Eric Windmill
2025-02-12 18:08:01 -05:00
committed by GitHub
parent d62c784789
commit 719fd72c38
685 changed files with 76244 additions and 53721 deletions

View File

@@ -22,9 +22,9 @@ class BookingCreateUseCase {
required DestinationRepository destinationRepository,
required ActivityRepository activityRepository,
required BookingRepository bookingRepository,
}) : _destinationRepository = destinationRepository,
_activityRepository = activityRepository,
_bookingRepository = bookingRepository;
}) : _destinationRepository = destinationRepository,
_activityRepository = activityRepository,
_bookingRepository = bookingRepository;
final DestinationRepository _destinationRepository;
final ActivityRepository _activityRepository;
@@ -38,8 +38,9 @@ class BookingCreateUseCase {
_log.warning('Destination is not set');
return Result.error(Exception('Destination is not set'));
}
final destinationResult =
await _fetchDestination(itineraryConfig.destination!);
final destinationResult = await _fetchDestination(
itineraryConfig.destination!,
);
switch (destinationResult) {
case Ok<Destination>():
_log.fine('Destination loaded: ${destinationResult.value.ref}');
@@ -62,11 +63,12 @@ class BookingCreateUseCase {
return Result.error(activitiesResult.error);
case Ok<List<Activity>>():
}
final activities = activitiesResult.value
.where(
(activity) => itineraryConfig.activities.contains(activity.ref),
)
.toList();
final activities =
activitiesResult.value
.where(
(activity) => itineraryConfig.activities.contains(activity.ref),
)
.toList();
_log.fine('Activities loaded (${activities.length})');
// Check if dates are set
@@ -100,8 +102,9 @@ class BookingCreateUseCase {
final result = await _destinationRepository.getDestinations();
switch (result) {
case Ok<List<Destination>>():
final destination = result.value
.firstWhere((destination) => destination.ref == destinationRef);
final destination = result.value.firstWhere(
(destination) => destination.ref == destinationRef,
);
return Result.ok(destination);
case Error<List<Destination>>():
return Result.error(result.error);

View File

@@ -28,7 +28,8 @@ class BookingShareUseCase {
final _log = Logger('BookingShareUseCase');
Future<Result<void>> shareBooking(Booking booking) async {
final text = 'Trip to ${booking.destination.name}\n'
final text =
'Trip to ${booking.destination.name}\n'
'on ${dateFormatStartEnd(DateTimeRange(start: booking.startDate, end: booking.endDate))}\n'
'Activities:\n'
'${booking.activity.map((a) => ' - ${a.name}').join('\n')}.';