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

Compass app (#2446)

This commit is contained in:
Eric Windmill
2024-09-27 18:49:27 -04:00
committed by GitHub
parent fcf2552cda
commit 46b5a26b26
326 changed files with 53272 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'activity.freezed.dart';
part 'activity.g.dart';
enum TimeOfDay {
any,
morning,
afternoon,
evening,
night,
}
@freezed
class Activity with _$Activity {
const factory Activity({
/// e.g. 'Glacier Trekking and Ice Climbing'
required String name,
/// e.g. 'Embark on a thrilling adventure exploring the awe-inspiring glaciers of Alaska. Hike across the icy terrain, marvel at the deep blue crevasses, and even try your hand at ice climbing for an unforgettable experience.'
required String description,
/// e.g. 'Matanuska Glacier or Mendenhall Glacier'
required String locationName,
/// Duration in days.
/// e.g. 8
required int duration,
/// e.g. 'morning'
required TimeOfDay timeOfDay,
/// e.g. false
required bool familyFriendly,
/// e.g. 4
required int price,
/// e.g. 'alaska'
required String destinationRef,
/// e.g. 'glacier-trekking-and-ice-climbing'
required String ref,
/// e.g. 'https://storage.googleapis.com/tripedia-images/activities/alaska_glacier-trekking-and-ice-climbing.jpg'
required String imageUrl,
}) = _Activity;
factory Activity.fromJson(Map<String, Object?> json) =>
_$ActivityFromJson(json);
}

View File

@@ -0,0 +1,425 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'activity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Activity _$ActivityFromJson(Map<String, dynamic> json) {
return _Activity.fromJson(json);
}
/// @nodoc
mixin _$Activity {
/// e.g. 'Glacier Trekking and Ice Climbing'
String get name => throw _privateConstructorUsedError;
/// e.g. 'Embark on a thrilling adventure exploring the awe-inspiring glaciers of Alaska. Hike across the icy terrain, marvel at the deep blue crevasses, and even try your hand at ice climbing for an unforgettable experience.'
String get description => throw _privateConstructorUsedError;
/// e.g. 'Matanuska Glacier or Mendenhall Glacier'
String get locationName => throw _privateConstructorUsedError;
/// Duration in days.
/// e.g. 8
int get duration => throw _privateConstructorUsedError;
/// e.g. 'morning'
TimeOfDay get timeOfDay => throw _privateConstructorUsedError;
/// e.g. false
bool get familyFriendly => throw _privateConstructorUsedError;
/// e.g. 4
int get price => throw _privateConstructorUsedError;
/// e.g. 'alaska'
String get destinationRef => throw _privateConstructorUsedError;
/// e.g. 'glacier-trekking-and-ice-climbing'
String get ref => throw _privateConstructorUsedError;
/// e.g. 'https://storage.googleapis.com/tripedia-images/activities/alaska_glacier-trekking-and-ice-climbing.jpg'
String get imageUrl => throw _privateConstructorUsedError;
/// Serializes this Activity to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Activity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ActivityCopyWith<Activity> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ActivityCopyWith<$Res> {
factory $ActivityCopyWith(Activity value, $Res Function(Activity) then) =
_$ActivityCopyWithImpl<$Res, Activity>;
@useResult
$Res call(
{String name,
String description,
String locationName,
int duration,
TimeOfDay timeOfDay,
bool familyFriendly,
int price,
String destinationRef,
String ref,
String imageUrl});
}
/// @nodoc
class _$ActivityCopyWithImpl<$Res, $Val extends Activity>
implements $ActivityCopyWith<$Res> {
_$ActivityCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Activity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? description = null,
Object? locationName = null,
Object? duration = null,
Object? timeOfDay = null,
Object? familyFriendly = null,
Object? price = null,
Object? destinationRef = null,
Object? ref = null,
Object? imageUrl = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
locationName: null == locationName
? _value.locationName
: locationName // ignore: cast_nullable_to_non_nullable
as String,
duration: null == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int,
timeOfDay: null == timeOfDay
? _value.timeOfDay
: timeOfDay // ignore: cast_nullable_to_non_nullable
as TimeOfDay,
familyFriendly: null == familyFriendly
? _value.familyFriendly
: familyFriendly // ignore: cast_nullable_to_non_nullable
as bool,
price: null == price
? _value.price
: price // ignore: cast_nullable_to_non_nullable
as int,
destinationRef: null == destinationRef
? _value.destinationRef
: destinationRef // ignore: cast_nullable_to_non_nullable
as String,
ref: null == ref
? _value.ref
: ref // ignore: cast_nullable_to_non_nullable
as String,
imageUrl: null == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ActivityImplCopyWith<$Res>
implements $ActivityCopyWith<$Res> {
factory _$$ActivityImplCopyWith(
_$ActivityImpl value, $Res Function(_$ActivityImpl) then) =
__$$ActivityImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String name,
String description,
String locationName,
int duration,
TimeOfDay timeOfDay,
bool familyFriendly,
int price,
String destinationRef,
String ref,
String imageUrl});
}
/// @nodoc
class __$$ActivityImplCopyWithImpl<$Res>
extends _$ActivityCopyWithImpl<$Res, _$ActivityImpl>
implements _$$ActivityImplCopyWith<$Res> {
__$$ActivityImplCopyWithImpl(
_$ActivityImpl _value, $Res Function(_$ActivityImpl) _then)
: super(_value, _then);
/// Create a copy of Activity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? description = null,
Object? locationName = null,
Object? duration = null,
Object? timeOfDay = null,
Object? familyFriendly = null,
Object? price = null,
Object? destinationRef = null,
Object? ref = null,
Object? imageUrl = null,
}) {
return _then(_$ActivityImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
locationName: null == locationName
? _value.locationName
: locationName // ignore: cast_nullable_to_non_nullable
as String,
duration: null == duration
? _value.duration
: duration // ignore: cast_nullable_to_non_nullable
as int,
timeOfDay: null == timeOfDay
? _value.timeOfDay
: timeOfDay // ignore: cast_nullable_to_non_nullable
as TimeOfDay,
familyFriendly: null == familyFriendly
? _value.familyFriendly
: familyFriendly // ignore: cast_nullable_to_non_nullable
as bool,
price: null == price
? _value.price
: price // ignore: cast_nullable_to_non_nullable
as int,
destinationRef: null == destinationRef
? _value.destinationRef
: destinationRef // ignore: cast_nullable_to_non_nullable
as String,
ref: null == ref
? _value.ref
: ref // ignore: cast_nullable_to_non_nullable
as String,
imageUrl: null == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ActivityImpl implements _Activity {
const _$ActivityImpl(
{required this.name,
required this.description,
required this.locationName,
required this.duration,
required this.timeOfDay,
required this.familyFriendly,
required this.price,
required this.destinationRef,
required this.ref,
required this.imageUrl});
factory _$ActivityImpl.fromJson(Map<String, dynamic> json) =>
_$$ActivityImplFromJson(json);
/// e.g. 'Glacier Trekking and Ice Climbing'
@override
final String name;
/// e.g. 'Embark on a thrilling adventure exploring the awe-inspiring glaciers of Alaska. Hike across the icy terrain, marvel at the deep blue crevasses, and even try your hand at ice climbing for an unforgettable experience.'
@override
final String description;
/// e.g. 'Matanuska Glacier or Mendenhall Glacier'
@override
final String locationName;
/// Duration in days.
/// e.g. 8
@override
final int duration;
/// e.g. 'morning'
@override
final TimeOfDay timeOfDay;
/// e.g. false
@override
final bool familyFriendly;
/// e.g. 4
@override
final int price;
/// e.g. 'alaska'
@override
final String destinationRef;
/// e.g. 'glacier-trekking-and-ice-climbing'
@override
final String ref;
/// e.g. 'https://storage.googleapis.com/tripedia-images/activities/alaska_glacier-trekking-and-ice-climbing.jpg'
@override
final String imageUrl;
@override
String toString() {
return 'Activity(name: $name, description: $description, locationName: $locationName, duration: $duration, timeOfDay: $timeOfDay, familyFriendly: $familyFriendly, price: $price, destinationRef: $destinationRef, ref: $ref, imageUrl: $imageUrl)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ActivityImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.locationName, locationName) ||
other.locationName == locationName) &&
(identical(other.duration, duration) ||
other.duration == duration) &&
(identical(other.timeOfDay, timeOfDay) ||
other.timeOfDay == timeOfDay) &&
(identical(other.familyFriendly, familyFriendly) ||
other.familyFriendly == familyFriendly) &&
(identical(other.price, price) || other.price == price) &&
(identical(other.destinationRef, destinationRef) ||
other.destinationRef == destinationRef) &&
(identical(other.ref, ref) || other.ref == ref) &&
(identical(other.imageUrl, imageUrl) ||
other.imageUrl == imageUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
name,
description,
locationName,
duration,
timeOfDay,
familyFriendly,
price,
destinationRef,
ref,
imageUrl);
/// Create a copy of Activity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ActivityImplCopyWith<_$ActivityImpl> get copyWith =>
__$$ActivityImplCopyWithImpl<_$ActivityImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ActivityImplToJson(
this,
);
}
}
abstract class _Activity implements Activity {
const factory _Activity(
{required final String name,
required final String description,
required final String locationName,
required final int duration,
required final TimeOfDay timeOfDay,
required final bool familyFriendly,
required final int price,
required final String destinationRef,
required final String ref,
required final String imageUrl}) = _$ActivityImpl;
factory _Activity.fromJson(Map<String, dynamic> json) =
_$ActivityImpl.fromJson;
/// e.g. 'Glacier Trekking and Ice Climbing'
@override
String get name;
/// e.g. 'Embark on a thrilling adventure exploring the awe-inspiring glaciers of Alaska. Hike across the icy terrain, marvel at the deep blue crevasses, and even try your hand at ice climbing for an unforgettable experience.'
@override
String get description;
/// e.g. 'Matanuska Glacier or Mendenhall Glacier'
@override
String get locationName;
/// Duration in days.
/// e.g. 8
@override
int get duration;
/// e.g. 'morning'
@override
TimeOfDay get timeOfDay;
/// e.g. false
@override
bool get familyFriendly;
/// e.g. 4
@override
int get price;
/// e.g. 'alaska'
@override
String get destinationRef;
/// e.g. 'glacier-trekking-and-ice-climbing'
@override
String get ref;
/// e.g. 'https://storage.googleapis.com/tripedia-images/activities/alaska_glacier-trekking-and-ice-climbing.jpg'
@override
String get imageUrl;
/// Create a copy of Activity
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ActivityImplCopyWith<_$ActivityImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,43 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'activity.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ActivityImpl _$$ActivityImplFromJson(Map<String, dynamic> json) =>
_$ActivityImpl(
name: json['name'] as String,
description: json['description'] as String,
locationName: json['locationName'] as String,
duration: (json['duration'] as num).toInt(),
timeOfDay: $enumDecode(_$TimeOfDayEnumMap, json['timeOfDay']),
familyFriendly: json['familyFriendly'] as bool,
price: (json['price'] as num).toInt(),
destinationRef: json['destinationRef'] as String,
ref: json['ref'] as String,
imageUrl: json['imageUrl'] as String,
);
Map<String, dynamic> _$$ActivityImplToJson(_$ActivityImpl instance) =>
<String, dynamic>{
'name': instance.name,
'description': instance.description,
'locationName': instance.locationName,
'duration': instance.duration,
'timeOfDay': _$TimeOfDayEnumMap[instance.timeOfDay]!,
'familyFriendly': instance.familyFriendly,
'price': instance.price,
'destinationRef': instance.destinationRef,
'ref': instance.ref,
'imageUrl': instance.imageUrl,
};
const _$TimeOfDayEnumMap = {
TimeOfDay.any: 'any',
TimeOfDay.morning: 'morning',
TimeOfDay.afternoon: 'afternoon',
TimeOfDay.evening: 'evening',
TimeOfDay.night: 'night',
};

View File

@@ -0,0 +1,35 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
import '../activity/activity.dart';
import '../destination/destination.dart';
part 'booking.freezed.dart';
part 'booking.g.dart';
@freezed
class Booking with _$Booking {
const factory Booking({
/// Optional ID of the booking.
/// May be null if the booking is not yet stored.
int? id,
/// Start date of the trip
required DateTime startDate,
/// End date of the trip
required DateTime endDate,
/// Destination of the trip
required Destination destination,
/// List of chosen activities
required List<Activity> activity,
}) = _Booking;
factory Booking.fromJson(Map<String, Object?> json) =>
_$BookingFromJson(json);
}

View File

@@ -0,0 +1,300 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'booking.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Booking _$BookingFromJson(Map<String, dynamic> json) {
return _Booking.fromJson(json);
}
/// @nodoc
mixin _$Booking {
/// Optional ID of the booking.
/// May be null if the booking is not yet stored.
int? get id => throw _privateConstructorUsedError;
/// Start date of the trip
DateTime get startDate => throw _privateConstructorUsedError;
/// End date of the trip
DateTime get endDate => throw _privateConstructorUsedError;
/// Destination of the trip
Destination get destination => throw _privateConstructorUsedError;
/// List of chosen activities
List<Activity> get activity => throw _privateConstructorUsedError;
/// Serializes this Booking to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Booking
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$BookingCopyWith<Booking> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $BookingCopyWith<$Res> {
factory $BookingCopyWith(Booking value, $Res Function(Booking) then) =
_$BookingCopyWithImpl<$Res, Booking>;
@useResult
$Res call(
{int? id,
DateTime startDate,
DateTime endDate,
Destination destination,
List<Activity> activity});
$DestinationCopyWith<$Res> get destination;
}
/// @nodoc
class _$BookingCopyWithImpl<$Res, $Val extends Booking>
implements $BookingCopyWith<$Res> {
_$BookingCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Booking
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? startDate = null,
Object? endDate = null,
Object? destination = null,
Object? activity = null,
}) {
return _then(_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int?,
startDate: null == startDate
? _value.startDate
: startDate // ignore: cast_nullable_to_non_nullable
as DateTime,
endDate: null == endDate
? _value.endDate
: endDate // ignore: cast_nullable_to_non_nullable
as DateTime,
destination: null == destination
? _value.destination
: destination // ignore: cast_nullable_to_non_nullable
as Destination,
activity: null == activity
? _value.activity
: activity // ignore: cast_nullable_to_non_nullable
as List<Activity>,
) as $Val);
}
/// Create a copy of Booking
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DestinationCopyWith<$Res> get destination {
return $DestinationCopyWith<$Res>(_value.destination, (value) {
return _then(_value.copyWith(destination: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$BookingImplCopyWith<$Res> implements $BookingCopyWith<$Res> {
factory _$$BookingImplCopyWith(
_$BookingImpl value, $Res Function(_$BookingImpl) then) =
__$$BookingImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int? id,
DateTime startDate,
DateTime endDate,
Destination destination,
List<Activity> activity});
@override
$DestinationCopyWith<$Res> get destination;
}
/// @nodoc
class __$$BookingImplCopyWithImpl<$Res>
extends _$BookingCopyWithImpl<$Res, _$BookingImpl>
implements _$$BookingImplCopyWith<$Res> {
__$$BookingImplCopyWithImpl(
_$BookingImpl _value, $Res Function(_$BookingImpl) _then)
: super(_value, _then);
/// Create a copy of Booking
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? startDate = null,
Object? endDate = null,
Object? destination = null,
Object? activity = null,
}) {
return _then(_$BookingImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int?,
startDate: null == startDate
? _value.startDate
: startDate // ignore: cast_nullable_to_non_nullable
as DateTime,
endDate: null == endDate
? _value.endDate
: endDate // ignore: cast_nullable_to_non_nullable
as DateTime,
destination: null == destination
? _value.destination
: destination // ignore: cast_nullable_to_non_nullable
as Destination,
activity: null == activity
? _value._activity
: activity // ignore: cast_nullable_to_non_nullable
as List<Activity>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$BookingImpl implements _Booking {
const _$BookingImpl(
{this.id,
required this.startDate,
required this.endDate,
required this.destination,
required final List<Activity> activity})
: _activity = activity;
factory _$BookingImpl.fromJson(Map<String, dynamic> json) =>
_$$BookingImplFromJson(json);
/// Optional ID of the booking.
/// May be null if the booking is not yet stored.
@override
final int? id;
/// Start date of the trip
@override
final DateTime startDate;
/// End date of the trip
@override
final DateTime endDate;
/// Destination of the trip
@override
final Destination destination;
/// List of chosen activities
final List<Activity> _activity;
/// List of chosen activities
@override
List<Activity> get activity {
if (_activity is EqualUnmodifiableListView) return _activity;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_activity);
}
@override
String toString() {
return 'Booking(id: $id, startDate: $startDate, endDate: $endDate, destination: $destination, activity: $activity)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$BookingImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.startDate, startDate) ||
other.startDate == startDate) &&
(identical(other.endDate, endDate) || other.endDate == endDate) &&
(identical(other.destination, destination) ||
other.destination == destination) &&
const DeepCollectionEquality().equals(other._activity, _activity));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, startDate, endDate,
destination, const DeepCollectionEquality().hash(_activity));
/// Create a copy of Booking
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$BookingImplCopyWith<_$BookingImpl> get copyWith =>
__$$BookingImplCopyWithImpl<_$BookingImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$BookingImplToJson(
this,
);
}
}
abstract class _Booking implements Booking {
const factory _Booking(
{final int? id,
required final DateTime startDate,
required final DateTime endDate,
required final Destination destination,
required final List<Activity> activity}) = _$BookingImpl;
factory _Booking.fromJson(Map<String, dynamic> json) = _$BookingImpl.fromJson;
/// Optional ID of the booking.
/// May be null if the booking is not yet stored.
@override
int? get id;
/// Start date of the trip
@override
DateTime get startDate;
/// End date of the trip
@override
DateTime get endDate;
/// Destination of the trip
@override
Destination get destination;
/// List of chosen activities
@override
List<Activity> get activity;
/// Create a copy of Booking
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$BookingImplCopyWith<_$BookingImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,28 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'booking.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$BookingImpl _$$BookingImplFromJson(Map<String, dynamic> json) =>
_$BookingImpl(
id: (json['id'] as num?)?.toInt(),
startDate: DateTime.parse(json['startDate'] as String),
endDate: DateTime.parse(json['endDate'] as String),
destination:
Destination.fromJson(json['destination'] as Map<String, dynamic>),
activity: (json['activity'] as List<dynamic>)
.map((e) => Activity.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$$BookingImplToJson(_$BookingImpl instance) =>
<String, dynamic>{
'id': instance.id,
'startDate': instance.startDate.toIso8601String(),
'endDate': instance.endDate.toIso8601String(),
'destination': instance.destination,
'activity': instance.activity,
};

View File

@@ -0,0 +1,34 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'booking_summary.freezed.dart';
part 'booking_summary.g.dart';
/// BookingSummary contains the necessary data to display a booking
/// in the user home screen, but lacks the rest of the booking data
/// like activitities or destination.
///
/// Use the [BookingRepository] to obtain a full [Booking]
/// using the [BookingSummary.id].
@freezed
class BookingSummary with _$BookingSummary {
const factory BookingSummary({
/// Booking id
required int id,
/// Name to be displayed
required String name,
/// Start date of the booking
required DateTime startDate,
/// End date of the booking
required DateTime endDate,
}) = _BookingSummary;
factory BookingSummary.fromJson(Map<String, Object?> json) =>
_$BookingSummaryFromJson(json);
}

View File

@@ -0,0 +1,243 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'booking_summary.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
BookingSummary _$BookingSummaryFromJson(Map<String, dynamic> json) {
return _BookingSummary.fromJson(json);
}
/// @nodoc
mixin _$BookingSummary {
/// Booking id
int get id => throw _privateConstructorUsedError;
/// Name to be displayed
String get name => throw _privateConstructorUsedError;
/// Start date of the booking
DateTime get startDate => throw _privateConstructorUsedError;
/// End date of the booking
DateTime get endDate => throw _privateConstructorUsedError;
/// Serializes this BookingSummary to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of BookingSummary
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$BookingSummaryCopyWith<BookingSummary> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $BookingSummaryCopyWith<$Res> {
factory $BookingSummaryCopyWith(
BookingSummary value, $Res Function(BookingSummary) then) =
_$BookingSummaryCopyWithImpl<$Res, BookingSummary>;
@useResult
$Res call({int id, String name, DateTime startDate, DateTime endDate});
}
/// @nodoc
class _$BookingSummaryCopyWithImpl<$Res, $Val extends BookingSummary>
implements $BookingSummaryCopyWith<$Res> {
_$BookingSummaryCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of BookingSummary
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? startDate = null,
Object? endDate = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
startDate: null == startDate
? _value.startDate
: startDate // ignore: cast_nullable_to_non_nullable
as DateTime,
endDate: null == endDate
? _value.endDate
: endDate // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$BookingSummaryImplCopyWith<$Res>
implements $BookingSummaryCopyWith<$Res> {
factory _$$BookingSummaryImplCopyWith(_$BookingSummaryImpl value,
$Res Function(_$BookingSummaryImpl) then) =
__$$BookingSummaryImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int id, String name, DateTime startDate, DateTime endDate});
}
/// @nodoc
class __$$BookingSummaryImplCopyWithImpl<$Res>
extends _$BookingSummaryCopyWithImpl<$Res, _$BookingSummaryImpl>
implements _$$BookingSummaryImplCopyWith<$Res> {
__$$BookingSummaryImplCopyWithImpl(
_$BookingSummaryImpl _value, $Res Function(_$BookingSummaryImpl) _then)
: super(_value, _then);
/// Create a copy of BookingSummary
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? name = null,
Object? startDate = null,
Object? endDate = null,
}) {
return _then(_$BookingSummaryImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
startDate: null == startDate
? _value.startDate
: startDate // ignore: cast_nullable_to_non_nullable
as DateTime,
endDate: null == endDate
? _value.endDate
: endDate // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$BookingSummaryImpl implements _BookingSummary {
const _$BookingSummaryImpl(
{required this.id,
required this.name,
required this.startDate,
required this.endDate});
factory _$BookingSummaryImpl.fromJson(Map<String, dynamic> json) =>
_$$BookingSummaryImplFromJson(json);
/// Booking id
@override
final int id;
/// Name to be displayed
@override
final String name;
/// Start date of the booking
@override
final DateTime startDate;
/// End date of the booking
@override
final DateTime endDate;
@override
String toString() {
return 'BookingSummary(id: $id, name: $name, startDate: $startDate, endDate: $endDate)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$BookingSummaryImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.startDate, startDate) ||
other.startDate == startDate) &&
(identical(other.endDate, endDate) || other.endDate == endDate));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id, name, startDate, endDate);
/// Create a copy of BookingSummary
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$BookingSummaryImplCopyWith<_$BookingSummaryImpl> get copyWith =>
__$$BookingSummaryImplCopyWithImpl<_$BookingSummaryImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$BookingSummaryImplToJson(
this,
);
}
}
abstract class _BookingSummary implements BookingSummary {
const factory _BookingSummary(
{required final int id,
required final String name,
required final DateTime startDate,
required final DateTime endDate}) = _$BookingSummaryImpl;
factory _BookingSummary.fromJson(Map<String, dynamic> json) =
_$BookingSummaryImpl.fromJson;
/// Booking id
@override
int get id;
/// Name to be displayed
@override
String get name;
/// Start date of the booking
@override
DateTime get startDate;
/// End date of the booking
@override
DateTime get endDate;
/// Create a copy of BookingSummary
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$BookingSummaryImplCopyWith<_$BookingSummaryImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,24 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'booking_summary.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$BookingSummaryImpl _$$BookingSummaryImplFromJson(Map<String, dynamic> json) =>
_$BookingSummaryImpl(
id: (json['id'] as num).toInt(),
name: json['name'] as String,
startDate: DateTime.parse(json['startDate'] as String),
endDate: DateTime.parse(json['endDate'] as String),
);
Map<String, dynamic> _$$BookingSummaryImplToJson(
_$BookingSummaryImpl instance) =>
<String, dynamic>{
'id': instance.id,
'name': instance.name,
'startDate': instance.startDate.toIso8601String(),
'endDate': instance.endDate.toIso8601String(),
};

View File

@@ -0,0 +1,23 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'continent.freezed.dart';
part 'continent.g.dart';
@freezed
class Continent with _$Continent {
const factory Continent({
/// e.g. 'Europe'
required String name,
/// e.g. 'https://rstr.in/google/tripedia/TmR12QdlVTT'
required String imageUrl,
}) = _Continent;
factory Continent.fromJson(Map<String, Object?> json) =>
_$ContinentFromJson(json);
}

View File

@@ -0,0 +1,191 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'continent.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Continent _$ContinentFromJson(Map<String, dynamic> json) {
return _Continent.fromJson(json);
}
/// @nodoc
mixin _$Continent {
/// e.g. 'Europe'
String get name => throw _privateConstructorUsedError;
/// e.g. 'https://rstr.in/google/tripedia/TmR12QdlVTT'
String get imageUrl => throw _privateConstructorUsedError;
/// Serializes this Continent to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Continent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ContinentCopyWith<Continent> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ContinentCopyWith<$Res> {
factory $ContinentCopyWith(Continent value, $Res Function(Continent) then) =
_$ContinentCopyWithImpl<$Res, Continent>;
@useResult
$Res call({String name, String imageUrl});
}
/// @nodoc
class _$ContinentCopyWithImpl<$Res, $Val extends Continent>
implements $ContinentCopyWith<$Res> {
_$ContinentCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Continent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? imageUrl = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
imageUrl: null == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ContinentImplCopyWith<$Res>
implements $ContinentCopyWith<$Res> {
factory _$$ContinentImplCopyWith(
_$ContinentImpl value, $Res Function(_$ContinentImpl) then) =
__$$ContinentImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String name, String imageUrl});
}
/// @nodoc
class __$$ContinentImplCopyWithImpl<$Res>
extends _$ContinentCopyWithImpl<$Res, _$ContinentImpl>
implements _$$ContinentImplCopyWith<$Res> {
__$$ContinentImplCopyWithImpl(
_$ContinentImpl _value, $Res Function(_$ContinentImpl) _then)
: super(_value, _then);
/// Create a copy of Continent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? imageUrl = null,
}) {
return _then(_$ContinentImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
imageUrl: null == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ContinentImpl implements _Continent {
const _$ContinentImpl({required this.name, required this.imageUrl});
factory _$ContinentImpl.fromJson(Map<String, dynamic> json) =>
_$$ContinentImplFromJson(json);
/// e.g. 'Europe'
@override
final String name;
/// e.g. 'https://rstr.in/google/tripedia/TmR12QdlVTT'
@override
final String imageUrl;
@override
String toString() {
return 'Continent(name: $name, imageUrl: $imageUrl)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ContinentImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.imageUrl, imageUrl) ||
other.imageUrl == imageUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, name, imageUrl);
/// Create a copy of Continent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ContinentImplCopyWith<_$ContinentImpl> get copyWith =>
__$$ContinentImplCopyWithImpl<_$ContinentImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ContinentImplToJson(
this,
);
}
}
abstract class _Continent implements Continent {
const factory _Continent(
{required final String name,
required final String imageUrl}) = _$ContinentImpl;
factory _Continent.fromJson(Map<String, dynamic> json) =
_$ContinentImpl.fromJson;
/// e.g. 'Europe'
@override
String get name;
/// e.g. 'https://rstr.in/google/tripedia/TmR12QdlVTT'
@override
String get imageUrl;
/// Create a copy of Continent
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ContinentImplCopyWith<_$ContinentImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'continent.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ContinentImpl _$$ContinentImplFromJson(Map<String, dynamic> json) =>
_$ContinentImpl(
name: json['name'] as String,
imageUrl: json['imageUrl'] as String,
);
Map<String, dynamic> _$$ContinentImplToJson(_$ContinentImpl instance) =>
<String, dynamic>{
'name': instance.name,
'imageUrl': instance.imageUrl,
};

View File

@@ -0,0 +1,38 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'destination.freezed.dart';
part 'destination.g.dart';
@freezed
class Destination with _$Destination {
const factory Destination({
/// e.g. 'alaska'
required String ref,
/// e.g. 'Alaska'
required String name,
/// e.g. 'United States'
required String country,
/// e.g. 'North America'
required String continent,
/// e.g. 'Alaska is a haven for outdoor enthusiasts ...'
required String knownFor,
/// e.g. ['Mountain', 'Off-the-beaten-path', 'Wildlife watching']
required List<String> tags,
/// e.g. 'https://storage.googleapis.com/tripedia-images/destinations/alaska.jpg'
required String imageUrl,
}) = _Destination;
factory Destination.fromJson(Map<String, Object?> json) =>
_$DestinationFromJson(json);
}

View File

@@ -0,0 +1,339 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'destination.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Destination _$DestinationFromJson(Map<String, dynamic> json) {
return _Destination.fromJson(json);
}
/// @nodoc
mixin _$Destination {
/// e.g. 'alaska'
String get ref => throw _privateConstructorUsedError;
/// e.g. 'Alaska'
String get name => throw _privateConstructorUsedError;
/// e.g. 'United States'
String get country => throw _privateConstructorUsedError;
/// e.g. 'North America'
String get continent => throw _privateConstructorUsedError;
/// e.g. 'Alaska is a haven for outdoor enthusiasts ...'
String get knownFor => throw _privateConstructorUsedError;
/// e.g. ['Mountain', 'Off-the-beaten-path', 'Wildlife watching']
List<String> get tags => throw _privateConstructorUsedError;
/// e.g. 'https://storage.googleapis.com/tripedia-images/destinations/alaska.jpg'
String get imageUrl => throw _privateConstructorUsedError;
/// Serializes this Destination to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Destination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DestinationCopyWith<Destination> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DestinationCopyWith<$Res> {
factory $DestinationCopyWith(
Destination value, $Res Function(Destination) then) =
_$DestinationCopyWithImpl<$Res, Destination>;
@useResult
$Res call(
{String ref,
String name,
String country,
String continent,
String knownFor,
List<String> tags,
String imageUrl});
}
/// @nodoc
class _$DestinationCopyWithImpl<$Res, $Val extends Destination>
implements $DestinationCopyWith<$Res> {
_$DestinationCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Destination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? ref = null,
Object? name = null,
Object? country = null,
Object? continent = null,
Object? knownFor = null,
Object? tags = null,
Object? imageUrl = null,
}) {
return _then(_value.copyWith(
ref: null == ref
? _value.ref
: ref // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
country: null == country
? _value.country
: country // ignore: cast_nullable_to_non_nullable
as String,
continent: null == continent
? _value.continent
: continent // ignore: cast_nullable_to_non_nullable
as String,
knownFor: null == knownFor
? _value.knownFor
: knownFor // ignore: cast_nullable_to_non_nullable
as String,
tags: null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
imageUrl: null == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$DestinationImplCopyWith<$Res>
implements $DestinationCopyWith<$Res> {
factory _$$DestinationImplCopyWith(
_$DestinationImpl value, $Res Function(_$DestinationImpl) then) =
__$$DestinationImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String ref,
String name,
String country,
String continent,
String knownFor,
List<String> tags,
String imageUrl});
}
/// @nodoc
class __$$DestinationImplCopyWithImpl<$Res>
extends _$DestinationCopyWithImpl<$Res, _$DestinationImpl>
implements _$$DestinationImplCopyWith<$Res> {
__$$DestinationImplCopyWithImpl(
_$DestinationImpl _value, $Res Function(_$DestinationImpl) _then)
: super(_value, _then);
/// Create a copy of Destination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? ref = null,
Object? name = null,
Object? country = null,
Object? continent = null,
Object? knownFor = null,
Object? tags = null,
Object? imageUrl = null,
}) {
return _then(_$DestinationImpl(
ref: null == ref
? _value.ref
: ref // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
country: null == country
? _value.country
: country // ignore: cast_nullable_to_non_nullable
as String,
continent: null == continent
? _value.continent
: continent // ignore: cast_nullable_to_non_nullable
as String,
knownFor: null == knownFor
? _value.knownFor
: knownFor // ignore: cast_nullable_to_non_nullable
as String,
tags: null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
imageUrl: null == imageUrl
? _value.imageUrl
: imageUrl // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$DestinationImpl implements _Destination {
const _$DestinationImpl(
{required this.ref,
required this.name,
required this.country,
required this.continent,
required this.knownFor,
required final List<String> tags,
required this.imageUrl})
: _tags = tags;
factory _$DestinationImpl.fromJson(Map<String, dynamic> json) =>
_$$DestinationImplFromJson(json);
/// e.g. 'alaska'
@override
final String ref;
/// e.g. 'Alaska'
@override
final String name;
/// e.g. 'United States'
@override
final String country;
/// e.g. 'North America'
@override
final String continent;
/// e.g. 'Alaska is a haven for outdoor enthusiasts ...'
@override
final String knownFor;
/// e.g. ['Mountain', 'Off-the-beaten-path', 'Wildlife watching']
final List<String> _tags;
/// e.g. ['Mountain', 'Off-the-beaten-path', 'Wildlife watching']
@override
List<String> get tags {
if (_tags is EqualUnmodifiableListView) return _tags;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_tags);
}
/// e.g. 'https://storage.googleapis.com/tripedia-images/destinations/alaska.jpg'
@override
final String imageUrl;
@override
String toString() {
return 'Destination(ref: $ref, name: $name, country: $country, continent: $continent, knownFor: $knownFor, tags: $tags, imageUrl: $imageUrl)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DestinationImpl &&
(identical(other.ref, ref) || other.ref == ref) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.country, country) || other.country == country) &&
(identical(other.continent, continent) ||
other.continent == continent) &&
(identical(other.knownFor, knownFor) ||
other.knownFor == knownFor) &&
const DeepCollectionEquality().equals(other._tags, _tags) &&
(identical(other.imageUrl, imageUrl) ||
other.imageUrl == imageUrl));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, ref, name, country, continent,
knownFor, const DeepCollectionEquality().hash(_tags), imageUrl);
/// Create a copy of Destination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DestinationImplCopyWith<_$DestinationImpl> get copyWith =>
__$$DestinationImplCopyWithImpl<_$DestinationImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$DestinationImplToJson(
this,
);
}
}
abstract class _Destination implements Destination {
const factory _Destination(
{required final String ref,
required final String name,
required final String country,
required final String continent,
required final String knownFor,
required final List<String> tags,
required final String imageUrl}) = _$DestinationImpl;
factory _Destination.fromJson(Map<String, dynamic> json) =
_$DestinationImpl.fromJson;
/// e.g. 'alaska'
@override
String get ref;
/// e.g. 'Alaska'
@override
String get name;
/// e.g. 'United States'
@override
String get country;
/// e.g. 'North America'
@override
String get continent;
/// e.g. 'Alaska is a haven for outdoor enthusiasts ...'
@override
String get knownFor;
/// e.g. ['Mountain', 'Off-the-beaten-path', 'Wildlife watching']
@override
List<String> get tags;
/// e.g. 'https://storage.googleapis.com/tripedia-images/destinations/alaska.jpg'
@override
String get imageUrl;
/// Create a copy of Destination
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DestinationImplCopyWith<_$DestinationImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,29 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'destination.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$DestinationImpl _$$DestinationImplFromJson(Map<String, dynamic> json) =>
_$DestinationImpl(
ref: json['ref'] as String,
name: json['name'] as String,
country: json['country'] as String,
continent: json['continent'] as String,
knownFor: json['knownFor'] as String,
tags: (json['tags'] as List<dynamic>).map((e) => e as String).toList(),
imageUrl: json['imageUrl'] as String,
);
Map<String, dynamic> _$$DestinationImplToJson(_$DestinationImpl instance) =>
<String, dynamic>{
'ref': instance.ref,
'name': instance.name,
'country': instance.country,
'continent': instance.continent,
'knownFor': instance.knownFor,
'tags': instance.tags,
'imageUrl': instance.imageUrl,
};

View File

@@ -0,0 +1,35 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'itinerary_config.freezed.dart';
part 'itinerary_config.g.dart';
@freezed
class ItineraryConfig with _$ItineraryConfig {
const factory ItineraryConfig({
/// [Continent] name
String? continent,
/// Start date (check in) of itinerary
DateTime? startDate,
/// End date (check out) of itinerary
DateTime? endDate,
/// Number of guests
int? guests,
/// Selected [Destination] reference
String? destination,
/// Selected [Activity] references
@Default([]) List<String> activities,
}) = _ItineraryConfig;
factory ItineraryConfig.fromJson(Map<String, Object?> json) =>
_$ItineraryConfigFromJson(json);
}

View File

@@ -0,0 +1,316 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'itinerary_config.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
ItineraryConfig _$ItineraryConfigFromJson(Map<String, dynamic> json) {
return _ItineraryConfig.fromJson(json);
}
/// @nodoc
mixin _$ItineraryConfig {
/// [Continent] name
String? get continent => throw _privateConstructorUsedError;
/// Start date (check in) of itinerary
DateTime? get startDate => throw _privateConstructorUsedError;
/// End date (check out) of itinerary
DateTime? get endDate => throw _privateConstructorUsedError;
/// Number of guests
int? get guests => throw _privateConstructorUsedError;
/// Selected [Destination] reference
String? get destination => throw _privateConstructorUsedError;
/// Selected [Activity] references
List<String> get activities => throw _privateConstructorUsedError;
/// Serializes this ItineraryConfig to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of ItineraryConfig
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ItineraryConfigCopyWith<ItineraryConfig> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ItineraryConfigCopyWith<$Res> {
factory $ItineraryConfigCopyWith(
ItineraryConfig value, $Res Function(ItineraryConfig) then) =
_$ItineraryConfigCopyWithImpl<$Res, ItineraryConfig>;
@useResult
$Res call(
{String? continent,
DateTime? startDate,
DateTime? endDate,
int? guests,
String? destination,
List<String> activities});
}
/// @nodoc
class _$ItineraryConfigCopyWithImpl<$Res, $Val extends ItineraryConfig>
implements $ItineraryConfigCopyWith<$Res> {
_$ItineraryConfigCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ItineraryConfig
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? continent = freezed,
Object? startDate = freezed,
Object? endDate = freezed,
Object? guests = freezed,
Object? destination = freezed,
Object? activities = null,
}) {
return _then(_value.copyWith(
continent: freezed == continent
? _value.continent
: continent // ignore: cast_nullable_to_non_nullable
as String?,
startDate: freezed == startDate
? _value.startDate
: startDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
endDate: freezed == endDate
? _value.endDate
: endDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
guests: freezed == guests
? _value.guests
: guests // ignore: cast_nullable_to_non_nullable
as int?,
destination: freezed == destination
? _value.destination
: destination // ignore: cast_nullable_to_non_nullable
as String?,
activities: null == activities
? _value.activities
: activities // ignore: cast_nullable_to_non_nullable
as List<String>,
) as $Val);
}
}
/// @nodoc
abstract class _$$ItineraryConfigImplCopyWith<$Res>
implements $ItineraryConfigCopyWith<$Res> {
factory _$$ItineraryConfigImplCopyWith(_$ItineraryConfigImpl value,
$Res Function(_$ItineraryConfigImpl) then) =
__$$ItineraryConfigImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String? continent,
DateTime? startDate,
DateTime? endDate,
int? guests,
String? destination,
List<String> activities});
}
/// @nodoc
class __$$ItineraryConfigImplCopyWithImpl<$Res>
extends _$ItineraryConfigCopyWithImpl<$Res, _$ItineraryConfigImpl>
implements _$$ItineraryConfigImplCopyWith<$Res> {
__$$ItineraryConfigImplCopyWithImpl(
_$ItineraryConfigImpl _value, $Res Function(_$ItineraryConfigImpl) _then)
: super(_value, _then);
/// Create a copy of ItineraryConfig
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? continent = freezed,
Object? startDate = freezed,
Object? endDate = freezed,
Object? guests = freezed,
Object? destination = freezed,
Object? activities = null,
}) {
return _then(_$ItineraryConfigImpl(
continent: freezed == continent
? _value.continent
: continent // ignore: cast_nullable_to_non_nullable
as String?,
startDate: freezed == startDate
? _value.startDate
: startDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
endDate: freezed == endDate
? _value.endDate
: endDate // ignore: cast_nullable_to_non_nullable
as DateTime?,
guests: freezed == guests
? _value.guests
: guests // ignore: cast_nullable_to_non_nullable
as int?,
destination: freezed == destination
? _value.destination
: destination // ignore: cast_nullable_to_non_nullable
as String?,
activities: null == activities
? _value._activities
: activities // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$ItineraryConfigImpl implements _ItineraryConfig {
const _$ItineraryConfigImpl(
{this.continent,
this.startDate,
this.endDate,
this.guests,
this.destination,
final List<String> activities = const []})
: _activities = activities;
factory _$ItineraryConfigImpl.fromJson(Map<String, dynamic> json) =>
_$$ItineraryConfigImplFromJson(json);
/// [Continent] name
@override
final String? continent;
/// Start date (check in) of itinerary
@override
final DateTime? startDate;
/// End date (check out) of itinerary
@override
final DateTime? endDate;
/// Number of guests
@override
final int? guests;
/// Selected [Destination] reference
@override
final String? destination;
/// Selected [Activity] references
final List<String> _activities;
/// Selected [Activity] references
@override
@JsonKey()
List<String> get activities {
if (_activities is EqualUnmodifiableListView) return _activities;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_activities);
}
@override
String toString() {
return 'ItineraryConfig(continent: $continent, startDate: $startDate, endDate: $endDate, guests: $guests, destination: $destination, activities: $activities)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ItineraryConfigImpl &&
(identical(other.continent, continent) ||
other.continent == continent) &&
(identical(other.startDate, startDate) ||
other.startDate == startDate) &&
(identical(other.endDate, endDate) || other.endDate == endDate) &&
(identical(other.guests, guests) || other.guests == guests) &&
(identical(other.destination, destination) ||
other.destination == destination) &&
const DeepCollectionEquality()
.equals(other._activities, _activities));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, continent, startDate, endDate,
guests, destination, const DeepCollectionEquality().hash(_activities));
/// Create a copy of ItineraryConfig
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ItineraryConfigImplCopyWith<_$ItineraryConfigImpl> get copyWith =>
__$$ItineraryConfigImplCopyWithImpl<_$ItineraryConfigImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$ItineraryConfigImplToJson(
this,
);
}
}
abstract class _ItineraryConfig implements ItineraryConfig {
const factory _ItineraryConfig(
{final String? continent,
final DateTime? startDate,
final DateTime? endDate,
final int? guests,
final String? destination,
final List<String> activities}) = _$ItineraryConfigImpl;
factory _ItineraryConfig.fromJson(Map<String, dynamic> json) =
_$ItineraryConfigImpl.fromJson;
/// [Continent] name
@override
String? get continent;
/// Start date (check in) of itinerary
@override
DateTime? get startDate;
/// End date (check out) of itinerary
@override
DateTime? get endDate;
/// Number of guests
@override
int? get guests;
/// Selected [Destination] reference
@override
String? get destination;
/// Selected [Activity] references
@override
List<String> get activities;
/// Create a copy of ItineraryConfig
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ItineraryConfigImplCopyWith<_$ItineraryConfigImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,36 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'itinerary_config.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$ItineraryConfigImpl _$$ItineraryConfigImplFromJson(
Map<String, dynamic> json) =>
_$ItineraryConfigImpl(
continent: json['continent'] as String?,
startDate: json['startDate'] == null
? null
: DateTime.parse(json['startDate'] as String),
endDate: json['endDate'] == null
? null
: DateTime.parse(json['endDate'] as String),
guests: (json['guests'] as num?)?.toInt(),
destination: json['destination'] as String?,
activities: (json['activities'] as List<dynamic>?)
?.map((e) => e as String)
.toList() ??
const [],
);
Map<String, dynamic> _$$ItineraryConfigImplToJson(
_$ItineraryConfigImpl instance) =>
<String, dynamic>{
'continent': instance.continent,
'startDate': instance.startDate?.toIso8601String(),
'endDate': instance.endDate?.toIso8601String(),
'guests': instance.guests,
'destination': instance.destination,
'activities': instance.activities,
};

View File

@@ -0,0 +1,21 @@
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:freezed_annotation/freezed_annotation.dart';
part 'user.freezed.dart';
part 'user.g.dart';
@freezed
abstract class User with _$User {
const factory User({
/// The user's name.
required String name,
/// The user's picture URL.
required String picture,
}) = _User;
factory User.fromJson(Map<String, Object?> json) => _$UserFromJson(json);
}

View File

@@ -0,0 +1,185 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'user.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
User _$UserFromJson(Map<String, dynamic> json) {
return _User.fromJson(json);
}
/// @nodoc
mixin _$User {
/// The user's name.
String get name => throw _privateConstructorUsedError;
/// The user's picture URL.
String get picture => throw _privateConstructorUsedError;
/// Serializes this User to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UserCopyWith<$Res> {
factory $UserCopyWith(User value, $Res Function(User) then) =
_$UserCopyWithImpl<$Res, User>;
@useResult
$Res call({String name, String picture});
}
/// @nodoc
class _$UserCopyWithImpl<$Res, $Val extends User>
implements $UserCopyWith<$Res> {
_$UserCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? picture = null,
}) {
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
picture: null == picture
? _value.picture
: picture // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
factory _$$UserImplCopyWith(
_$UserImpl value, $Res Function(_$UserImpl) then) =
__$$UserImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String name, String picture});
}
/// @nodoc
class __$$UserImplCopyWithImpl<$Res>
extends _$UserCopyWithImpl<$Res, _$UserImpl>
implements _$$UserImplCopyWith<$Res> {
__$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then)
: super(_value, _then);
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? name = null,
Object? picture = null,
}) {
return _then(_$UserImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
picture: null == picture
? _value.picture
: picture // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$UserImpl implements _User {
const _$UserImpl({required this.name, required this.picture});
factory _$UserImpl.fromJson(Map<String, dynamic> json) =>
_$$UserImplFromJson(json);
/// The user's name.
@override
final String name;
/// The user's picture URL.
@override
final String picture;
@override
String toString() {
return 'User(name: $name, picture: $picture)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UserImpl &&
(identical(other.name, name) || other.name == name) &&
(identical(other.picture, picture) || other.picture == picture));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, name, picture);
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$UserImplToJson(
this,
);
}
}
abstract class _User implements User {
const factory _User(
{required final String name, required final String picture}) = _$UserImpl;
factory _User.fromJson(Map<String, dynamic> json) = _$UserImpl.fromJson;
/// The user's name.
@override
String get name;
/// The user's picture URL.
@override
String get picture;
/// Create a copy of User
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$UserImpl _$$UserImplFromJson(Map<String, dynamic> json) => _$UserImpl(
name: json['name'] as String,
picture: json['picture'] as String,
);
Map<String, dynamic> _$$UserImplToJson(_$UserImpl instance) =>
<String, dynamic>{
'name': instance.name,
'picture': instance.picture,
};