merge branches

This commit is contained in:
amirrezaghabeli
2025-08-18 08:28:18 +03:30
parent 0a54b613cd
commit 36f66bfca5
48 changed files with 2348 additions and 613 deletions
+4 -3
View File
@@ -143,16 +143,17 @@ class YourTendersRouteData extends GoRouteData with _$YourTendersRouteData {
@override @override
Widget build(BuildContext context, GoRouterState state) { Widget build(BuildContext context, GoRouterState state) {
return const YourTendersScreen(); return YourTendersScreen();
} }
} }
@TypedGoRoute<TenderDetailRouteData>(path: '/tender-detail') @TypedGoRoute<TenderDetailRouteData>(path: '/tender-detail')
class TenderDetailRouteData extends GoRouteData with _$TenderDetailRouteData { class TenderDetailRouteData extends GoRouteData with _$TenderDetailRouteData {
const TenderDetailRouteData(); final String tenderId;
const TenderDetailRouteData({required this.tenderId});
@override @override
Widget build(BuildContext context, GoRouterState state) { Widget build(BuildContext context, GoRouterState state) {
return const TenderDetailScreen(); return TenderDetailScreen(tenderId: tenderId);
} }
} }
+7 -2
View File
@@ -175,10 +175,15 @@ RouteBase get $tenderDetailRouteData => GoRouteData.$route(
mixin _$TenderDetailRouteData on GoRouteData { mixin _$TenderDetailRouteData on GoRouteData {
static TenderDetailRouteData _fromState(GoRouterState state) => static TenderDetailRouteData _fromState(GoRouterState state) =>
const TenderDetailRouteData(); TenderDetailRouteData(tenderId: state.uri.queryParameters['tender-id']!);
TenderDetailRouteData get _self => this as TenderDetailRouteData;
@override @override
String get location => GoRouteData.$location('/tender-detail'); String get location => GoRouteData.$location(
'/tender-detail',
queryParams: {'tender-id': _self.tenderId},
);
@override @override
void go(BuildContext context) => context.go(location); void go(BuildContext context) => context.go(location);
+96
View File
@@ -0,0 +1,96 @@
import 'package:intl/intl.dart';
class DateUtils {
/// Converts Unix timestamp (seconds since epoch) to a formatted date string
static String unixToDate(int? unixTimestamp, {String format = 'yyyy-MM-dd'}) {
if (unixTimestamp == null) return '';
// Convert seconds to milliseconds if needed
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timestampInMs,
);
return DateFormat(format).format(dateTime);
}
/// Converts Unix timestamp to a readable date string
static String unixToReadableDate(int? unixTimestamp) {
if (unixTimestamp == null) return '';
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timestampInMs,
);
final DateTime now = DateTime.now();
final Duration difference = now.difference(dateTime);
if (difference.inDays == 0) {
return 'Today';
} else if (difference.inDays == 1) {
return 'Yesterday';
} else if (difference.inDays < 7) {
return '${difference.inDays} days ago';
} else {
return DateFormat('MMM dd, yyyy').format(dateTime);
}
}
/// Converts Unix timestamp to a short date format
static String unixToShortDate(int? unixTimestamp) {
if (unixTimestamp == null) return '';
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timestampInMs,
);
return DateFormat('MMM dd').format(dateTime);
}
/// Converts Unix timestamp to a full date and time format
static String unixToDateTime(int? unixTimestamp) {
if (unixTimestamp == null) return '';
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timestampInMs,
);
return DateFormat('MMM dd, yyyy HH:mm').format(dateTime);
}
/// Checks if a Unix timestamp is in the past
static bool isPast(int? unixTimestamp) {
if (unixTimestamp == null) return false;
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timestampInMs,
);
return dateTime.isBefore(DateTime.now());
}
/// Gets the number of days remaining until a Unix timestamp
static int daysRemaining(int? unixTimestamp) {
if (unixTimestamp == null) return 0;
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
timestampInMs,
);
final DateTime now = DateTime.now();
final Duration difference = dateTime.difference(now);
return difference.inDays;
}
}
@@ -1,18 +1,17 @@
import 'package:tm_app/core/utils/result.dart'; import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/services/model/tender_detail_request/tender_detail_request.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart';
import 'package:tm_app/data/services/tender_detail_service.dart'; import 'package:tm_app/data/services/tender_detail_service.dart';
import '../services/model/tender_detail_response/tender_detail_response_model.dart';
class TenderDetailRepository { class TenderDetailRepository {
TenderDetailRepository({required TenderDetailService tenderDetailService}) TenderDetailRepository({required TenderDetailService tenderDetailService})
: _tenderDetailService = tenderDetailService; : _tenderDetailService = tenderDetailService;
final TenderDetailService _tenderDetailService; final TenderDetailService _tenderDetailService;
Future<Result<TenderDetailResponseModel>> getTenderDetail({ Future<Result<TenderDetailResponseModel>> getTenderDetail({
required TenderDetailRequest request, required String tenderId,
}) async { }) async {
return await _tenderDetailService.getTenderDetail(request: request); return _tenderDetailService.getTenderDetails(tenderId: tenderId);
} }
} }
@@ -3,7 +3,6 @@ import 'package:tm_app/data/services/model/tenders/tender_dislike_response/tende
import 'package:tm_app/data/services/model/tenders/tender_like_response/tender_like_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_like_response/tender_like_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_reject_response/tender_reject_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_reject_response/tender_reject_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_submit_response/tender_submit_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_submit_response/tender_submit_response.dart';
import 'package:tm_app/data/services/model/tenders/tenders_request/tenders_request.dart';
import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart'; import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart';
import 'package:tm_app/data/services/tenders_service.dart'; import 'package:tm_app/data/services/tenders_service.dart';
@@ -12,10 +11,8 @@ class TendersRepository {
: _tendersService = tendersService; : _tendersService = tendersService;
final TendersService _tendersService; final TendersService _tendersService;
Future<Result<TendersResponse>> getTenders({ Future<Result<TendersResponse>> getTenders() async {
TendersRequest? tendersRequestModel, return _tendersService.getTenders();
}) async {
return _tendersService.getTenders(tendersRequestModel: tendersRequestModel);
} }
Future<Result<TenderLikeResponse>> likeTender() async { Future<Result<TenderLikeResponse>> likeTender() async {
+3 -3
View File
@@ -22,7 +22,7 @@ class AuthService {
var data = jsonEncode({"password": password, "username": username}); var data = jsonEncode({"password": password, "username": username});
final result = await _networkManager.makeRequest( final result = await _networkManager.makeRequest(
'/admin/v1/profile/login', '/api/v1/profile/login',
method: 'POST', method: 'POST',
(json) => LoginResponseModel.fromJson(json), (json) => LoginResponseModel.fromJson(json),
data: data, data: data,
@@ -31,14 +31,14 @@ class AuthService {
if (result is Ok<LoginResponseModel>) { if (result is Ok<LoginResponseModel>) {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
final token = result.value.data.accessToken; final token = result.value.data.accessToken;
await prefs.setString('bearer', token); await prefs.setString('bearer', token!);
} }
return result; return result;
} }
Future<Result<LogoutResponse>> logout() async { Future<Result<LogoutResponse>> logout() async {
final result = await _networkManager.makeRequest( final result = await _networkManager.makeRequest(
'/admin/v1/profile/logout', '/api/v1/profile/logout',
method: 'DELETE', method: 'DELETE',
(json) => LogoutResponse.fromJson(json), (json) => LogoutResponse.fromJson(json),
); );
@@ -0,0 +1,22 @@
// ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart';
part 'address.freezed.dart';
part 'address.g.dart';
@freezed
abstract class Address with _$Address {
const factory Address({
required String? street,
required String? city,
required String? state,
@JsonKey(name: 'postal_code') required String? postalCode,
required String? country,
@JsonKey(name: 'address_type') required String? addressType,
@JsonKey(name: 'is_default') required bool? isDefault,
}) = _Address;
factory Address.fromJson(Map<String, Object?> json) =>
_$AddressFromJson(json);
}
@@ -0,0 +1,295 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'address.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$Address {
String? get street; String? get city; String? get state;@JsonKey(name: 'postal_code') String? get postalCode; String? get country;@JsonKey(name: 'address_type') String? get addressType;@JsonKey(name: 'is_default') bool? get isDefault;
/// Create a copy of Address
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AddressCopyWith<Address> get copyWith => _$AddressCopyWithImpl<Address>(this as Address, _$identity);
/// Serializes this Address to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Address&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.state, state) || other.state == state)&&(identical(other.postalCode, postalCode) || other.postalCode == postalCode)&&(identical(other.country, country) || other.country == country)&&(identical(other.addressType, addressType) || other.addressType == addressType)&&(identical(other.isDefault, isDefault) || other.isDefault == isDefault));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,street,city,state,postalCode,country,addressType,isDefault);
@override
String toString() {
return 'Address(street: $street, city: $city, state: $state, postalCode: $postalCode, country: $country, addressType: $addressType, isDefault: $isDefault)';
}
}
/// @nodoc
abstract mixin class $AddressCopyWith<$Res> {
factory $AddressCopyWith(Address value, $Res Function(Address) _then) = _$AddressCopyWithImpl;
@useResult
$Res call({
String? street, String? city, String? state,@JsonKey(name: 'postal_code') String? postalCode, String? country,@JsonKey(name: 'address_type') String? addressType,@JsonKey(name: 'is_default') bool? isDefault
});
}
/// @nodoc
class _$AddressCopyWithImpl<$Res>
implements $AddressCopyWith<$Res> {
_$AddressCopyWithImpl(this._self, this._then);
final Address _self;
final $Res Function(Address) _then;
/// Create a copy of Address
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? street = freezed,Object? city = freezed,Object? state = freezed,Object? postalCode = freezed,Object? country = freezed,Object? addressType = freezed,Object? isDefault = freezed,}) {
return _then(_self.copyWith(
street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String?,postalCode: freezed == postalCode ? _self.postalCode : postalCode // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,addressType: freezed == addressType ? _self.addressType : addressType // ignore: cast_nullable_to_non_nullable
as String?,isDefault: freezed == isDefault ? _self.isDefault : isDefault // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
/// Adds pattern-matching-related methods to [Address].
extension AddressPatterns on Address {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _Address value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _Address() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _Address value) $default,){
final _that = this;
switch (_that) {
case _Address():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _Address value)? $default,){
final _that = this;
switch (_that) {
case _Address() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? street, String? city, String? state, @JsonKey(name: 'postal_code') String? postalCode, String? country, @JsonKey(name: 'address_type') String? addressType, @JsonKey(name: 'is_default') bool? isDefault)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Address() when $default != null:
return $default(_that.street,_that.city,_that.state,_that.postalCode,_that.country,_that.addressType,_that.isDefault);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? street, String? city, String? state, @JsonKey(name: 'postal_code') String? postalCode, String? country, @JsonKey(name: 'address_type') String? addressType, @JsonKey(name: 'is_default') bool? isDefault) $default,) {final _that = this;
switch (_that) {
case _Address():
return $default(_that.street,_that.city,_that.state,_that.postalCode,_that.country,_that.addressType,_that.isDefault);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? street, String? city, String? state, @JsonKey(name: 'postal_code') String? postalCode, String? country, @JsonKey(name: 'address_type') String? addressType, @JsonKey(name: 'is_default') bool? isDefault)? $default,) {final _that = this;
switch (_that) {
case _Address() when $default != null:
return $default(_that.street,_that.city,_that.state,_that.postalCode,_that.country,_that.addressType,_that.isDefault);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _Address implements Address {
const _Address({required this.street, required this.city, required this.state, @JsonKey(name: 'postal_code') required this.postalCode, required this.country, @JsonKey(name: 'address_type') required this.addressType, @JsonKey(name: 'is_default') required this.isDefault});
factory _Address.fromJson(Map<String, dynamic> json) => _$AddressFromJson(json);
@override final String? street;
@override final String? city;
@override final String? state;
@override@JsonKey(name: 'postal_code') final String? postalCode;
@override final String? country;
@override@JsonKey(name: 'address_type') final String? addressType;
@override@JsonKey(name: 'is_default') final bool? isDefault;
/// Create a copy of Address
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AddressCopyWith<_Address> get copyWith => __$AddressCopyWithImpl<_Address>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$AddressToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Address&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.state, state) || other.state == state)&&(identical(other.postalCode, postalCode) || other.postalCode == postalCode)&&(identical(other.country, country) || other.country == country)&&(identical(other.addressType, addressType) || other.addressType == addressType)&&(identical(other.isDefault, isDefault) || other.isDefault == isDefault));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,street,city,state,postalCode,country,addressType,isDefault);
@override
String toString() {
return 'Address(street: $street, city: $city, state: $state, postalCode: $postalCode, country: $country, addressType: $addressType, isDefault: $isDefault)';
}
}
/// @nodoc
abstract mixin class _$AddressCopyWith<$Res> implements $AddressCopyWith<$Res> {
factory _$AddressCopyWith(_Address value, $Res Function(_Address) _then) = __$AddressCopyWithImpl;
@override @useResult
$Res call({
String? street, String? city, String? state,@JsonKey(name: 'postal_code') String? postalCode, String? country,@JsonKey(name: 'address_type') String? addressType,@JsonKey(name: 'is_default') bool? isDefault
});
}
/// @nodoc
class __$AddressCopyWithImpl<$Res>
implements _$AddressCopyWith<$Res> {
__$AddressCopyWithImpl(this._self, this._then);
final _Address _self;
final $Res Function(_Address) _then;
/// Create a copy of Address
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? street = freezed,Object? city = freezed,Object? state = freezed,Object? postalCode = freezed,Object? country = freezed,Object? addressType = freezed,Object? isDefault = freezed,}) {
return _then(_Address(
street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String?,postalCode: freezed == postalCode ? _self.postalCode : postalCode // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,addressType: freezed == addressType ? _self.addressType : addressType // ignore: cast_nullable_to_non_nullable
as String?,isDefault: freezed == isDefault ? _self.isDefault : isDefault // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
// dart format on
@@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'address.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_Address _$AddressFromJson(Map<String, dynamic> json) => _Address(
street: json['street'] as String?,
city: json['city'] as String?,
state: json['state'] as String?,
postalCode: json['postal_code'] as String?,
country: json['country'] as String?,
addressType: json['address_type'] as String?,
isDefault: json['is_default'] as bool?,
);
Map<String, dynamic> _$AddressToJson(_Address instance) => <String, dynamic>{
'street': instance.street,
'city': instance.city,
'state': instance.state,
'postal_code': instance.postalCode,
'country': instance.country,
'address_type': instance.addressType,
'is_default': instance.isDefault,
};
@@ -0,0 +1,23 @@
// ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart';
part 'contact_person.freezed.dart';
part 'contact_person.g.dart';
@freezed
abstract class ContactPerson with _$ContactPerson {
const factory ContactPerson({
@JsonKey(name: 'first_name') required String? firstName,
@JsonKey(name: 'last_name') required String? lastName,
@JsonKey(name: 'full_name') required String? fullName,
required String? position,
required String? email,
required String? phone,
required String? mobile,
@JsonKey(name: 'is_primary') required bool? isPrimary,
}) = _ContactPerson;
factory ContactPerson.fromJson(Map<String, Object?> json) =>
_$ContactPersonFromJson(json);
}
@@ -0,0 +1,298 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'contact_person.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ContactPerson {
@JsonKey(name: 'first_name') String? get firstName;@JsonKey(name: 'last_name') String? get lastName;@JsonKey(name: 'full_name') String? get fullName; String? get position; String? get email; String? get phone; String? get mobile;@JsonKey(name: 'is_primary') bool? get isPrimary;
/// Create a copy of ContactPerson
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ContactPersonCopyWith<ContactPerson> get copyWith => _$ContactPersonCopyWithImpl<ContactPerson>(this as ContactPerson, _$identity);
/// Serializes this ContactPerson to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactPerson&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.fullName, fullName) || other.fullName == fullName)&&(identical(other.position, position) || other.position == position)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,firstName,lastName,fullName,position,email,phone,mobile,isPrimary);
@override
String toString() {
return 'ContactPerson(firstName: $firstName, lastName: $lastName, fullName: $fullName, position: $position, email: $email, phone: $phone, mobile: $mobile, isPrimary: $isPrimary)';
}
}
/// @nodoc
abstract mixin class $ContactPersonCopyWith<$Res> {
factory $ContactPersonCopyWith(ContactPerson value, $Res Function(ContactPerson) _then) = _$ContactPersonCopyWithImpl;
@useResult
$Res call({
@JsonKey(name: 'first_name') String? firstName,@JsonKey(name: 'last_name') String? lastName,@JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile,@JsonKey(name: 'is_primary') bool? isPrimary
});
}
/// @nodoc
class _$ContactPersonCopyWithImpl<$Res>
implements $ContactPersonCopyWith<$Res> {
_$ContactPersonCopyWithImpl(this._self, this._then);
final ContactPerson _self;
final $Res Function(ContactPerson) _then;
/// Create a copy of ContactPerson
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? fullName = freezed,Object? position = freezed,Object? email = freezed,Object? phone = freezed,Object? mobile = freezed,Object? isPrimary = freezed,}) {
return _then(_self.copyWith(
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable
as String?,position: freezed == position ? _self.position : position // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,isPrimary: freezed == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
/// Adds pattern-matching-related methods to [ContactPerson].
extension ContactPersonPatterns on ContactPerson {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ContactPerson value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ContactPerson() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ContactPerson value) $default,){
final _that = this;
switch (_that) {
case _ContactPerson():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ContactPerson value)? $default,){
final _that = this;
switch (_that) {
case _ContactPerson() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile, @JsonKey(name: 'is_primary') bool? isPrimary)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ContactPerson() when $default != null:
return $default(_that.firstName,_that.lastName,_that.fullName,_that.position,_that.email,_that.phone,_that.mobile,_that.isPrimary);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile, @JsonKey(name: 'is_primary') bool? isPrimary) $default,) {final _that = this;
switch (_that) {
case _ContactPerson():
return $default(_that.firstName,_that.lastName,_that.fullName,_that.position,_that.email,_that.phone,_that.mobile,_that.isPrimary);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile, @JsonKey(name: 'is_primary') bool? isPrimary)? $default,) {final _that = this;
switch (_that) {
case _ContactPerson() when $default != null:
return $default(_that.firstName,_that.lastName,_that.fullName,_that.position,_that.email,_that.phone,_that.mobile,_that.isPrimary);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _ContactPerson implements ContactPerson {
const _ContactPerson({@JsonKey(name: 'first_name') required this.firstName, @JsonKey(name: 'last_name') required this.lastName, @JsonKey(name: 'full_name') required this.fullName, required this.position, required this.email, required this.phone, required this.mobile, @JsonKey(name: 'is_primary') required this.isPrimary});
factory _ContactPerson.fromJson(Map<String, dynamic> json) => _$ContactPersonFromJson(json);
@override@JsonKey(name: 'first_name') final String? firstName;
@override@JsonKey(name: 'last_name') final String? lastName;
@override@JsonKey(name: 'full_name') final String? fullName;
@override final String? position;
@override final String? email;
@override final String? phone;
@override final String? mobile;
@override@JsonKey(name: 'is_primary') final bool? isPrimary;
/// Create a copy of ContactPerson
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ContactPersonCopyWith<_ContactPerson> get copyWith => __$ContactPersonCopyWithImpl<_ContactPerson>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ContactPersonToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactPerson&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.fullName, fullName) || other.fullName == fullName)&&(identical(other.position, position) || other.position == position)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.isPrimary, isPrimary) || other.isPrimary == isPrimary));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,firstName,lastName,fullName,position,email,phone,mobile,isPrimary);
@override
String toString() {
return 'ContactPerson(firstName: $firstName, lastName: $lastName, fullName: $fullName, position: $position, email: $email, phone: $phone, mobile: $mobile, isPrimary: $isPrimary)';
}
}
/// @nodoc
abstract mixin class _$ContactPersonCopyWith<$Res> implements $ContactPersonCopyWith<$Res> {
factory _$ContactPersonCopyWith(_ContactPerson value, $Res Function(_ContactPerson) _then) = __$ContactPersonCopyWithImpl;
@override @useResult
$Res call({
@JsonKey(name: 'first_name') String? firstName,@JsonKey(name: 'last_name') String? lastName,@JsonKey(name: 'full_name') String? fullName, String? position, String? email, String? phone, String? mobile,@JsonKey(name: 'is_primary') bool? isPrimary
});
}
/// @nodoc
class __$ContactPersonCopyWithImpl<$Res>
implements _$ContactPersonCopyWith<$Res> {
__$ContactPersonCopyWithImpl(this._self, this._then);
final _ContactPerson _self;
final $Res Function(_ContactPerson) _then;
/// Create a copy of ContactPerson
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? fullName = freezed,Object? position = freezed,Object? email = freezed,Object? phone = freezed,Object? mobile = freezed,Object? isPrimary = freezed,}) {
return _then(_ContactPerson(
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable
as String?,position: freezed == position ? _self.position : position // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,isPrimary: freezed == isPrimary ? _self.isPrimary : isPrimary // ignore: cast_nullable_to_non_nullable
as bool?,
));
}
}
// dart format on
@@ -0,0 +1,31 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'contact_person.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_ContactPerson _$ContactPersonFromJson(Map<String, dynamic> json) =>
_ContactPerson(
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
fullName: json['full_name'] as String?,
position: json['position'] as String?,
email: json['email'] as String?,
phone: json['phone'] as String?,
mobile: json['mobile'] as String?,
isPrimary: json['is_primary'] as bool?,
);
Map<String, dynamic> _$ContactPersonToJson(_ContactPerson instance) =>
<String, dynamic>{
'first_name': instance.firstName,
'last_name': instance.lastName,
'full_name': instance.fullName,
'position': instance.position,
'email': instance.email,
'phone': instance.phone,
'mobile': instance.mobile,
'is_primary': instance.isPrimary,
};
@@ -0,0 +1,47 @@
// ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart';
import '../address/address.dart';
import '../contact_person/contact_person.dart';
part 'customer.freezed.dart';
part 'customer.g.dart';
@freezed
abstract class Customer with _$Customer {
const factory Customer({
required String? id,
required String? type,
required String? status,
@JsonKey(name: 'first_name') required String? firstName,
@JsonKey(name: 'last_name') required String? lastName,
@JsonKey(name: 'full_name') required String? fullName,
required String? email,
required String? phone,
required String? mobile,
@JsonKey(name: 'registration_number') required String? registrationNumber,
@JsonKey(name: 'tax_id') required String? taxId,
required String? industry,
@JsonKey(name: 'business_type') required String? businessType,
@JsonKey(name: 'employee_count') required int? employeeCount,
@JsonKey(name: 'annual_revenue') required int? annualRevenue,
@JsonKey(name: 'founded_year') required int? foundedYear,
@JsonKey(name: 'is_verified') required bool? isVerified,
@JsonKey(name: 'is_compliant') required bool? isCompliant,
@JsonKey(name: 'compliance_notes') required String? complianceNotes,
required String? language,
required String? username,
required String? currency,
required String? timezone,
@JsonKey(name: 'created_at') required int? createdAt,
@JsonKey(name: 'updated_at') required int? updatedAt,
@JsonKey(name: 'created_by') required String? createdBy,
@JsonKey(name: 'updated_by') required String? updatedBy,
required Address? address,
required ContactPerson? contactPersons,
}) = _Customer;
factory Customer.fromJson(Map<String, Object?> json) =>
_$CustomerFromJson(json);
}
@@ -0,0 +1,409 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'customer.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$Customer {
String? get id; String? get type; String? get status;@JsonKey(name: 'first_name') String? get firstName;@JsonKey(name: 'last_name') String? get lastName;@JsonKey(name: 'full_name') String? get fullName; String? get email; String? get phone; String? get mobile;@JsonKey(name: 'registration_number') String? get registrationNumber;@JsonKey(name: 'tax_id') String? get taxId; String? get industry;@JsonKey(name: 'business_type') String? get businessType;@JsonKey(name: 'employee_count') int? get employeeCount;@JsonKey(name: 'annual_revenue') int? get annualRevenue;@JsonKey(name: 'founded_year') int? get foundedYear;@JsonKey(name: 'is_verified') bool? get isVerified;@JsonKey(name: 'is_compliant') bool? get isCompliant;@JsonKey(name: 'compliance_notes') String? get complianceNotes; String? get language; String? get username; String? get currency; String? get timezone;@JsonKey(name: 'created_at') int? get createdAt;@JsonKey(name: 'updated_at') int? get updatedAt;@JsonKey(name: 'created_by') String? get createdBy;@JsonKey(name: 'updated_by') String? get updatedBy; Address? get address; ContactPerson? get contactPersons;
/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$CustomerCopyWith<Customer> get copyWith => _$CustomerCopyWithImpl<Customer>(this as Customer, _$identity);
/// Serializes this Customer to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Customer&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.status, status) || other.status == status)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.fullName, fullName) || other.fullName == fullName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.registrationNumber, registrationNumber) || other.registrationNumber == registrationNumber)&&(identical(other.taxId, taxId) || other.taxId == taxId)&&(identical(other.industry, industry) || other.industry == industry)&&(identical(other.businessType, businessType) || other.businessType == businessType)&&(identical(other.employeeCount, employeeCount) || other.employeeCount == employeeCount)&&(identical(other.annualRevenue, annualRevenue) || other.annualRevenue == annualRevenue)&&(identical(other.foundedYear, foundedYear) || other.foundedYear == foundedYear)&&(identical(other.isVerified, isVerified) || other.isVerified == isVerified)&&(identical(other.isCompliant, isCompliant) || other.isCompliant == isCompliant)&&(identical(other.complianceNotes, complianceNotes) || other.complianceNotes == complianceNotes)&&(identical(other.language, language) || other.language == language)&&(identical(other.username, username) || other.username == username)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.createdBy, createdBy) || other.createdBy == createdBy)&&(identical(other.updatedBy, updatedBy) || other.updatedBy == updatedBy)&&(identical(other.address, address) || other.address == address)&&(identical(other.contactPersons, contactPersons) || other.contactPersons == contactPersons));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,id,type,status,firstName,lastName,fullName,email,phone,mobile,registrationNumber,taxId,industry,businessType,employeeCount,annualRevenue,foundedYear,isVerified,isCompliant,complianceNotes,language,username,currency,timezone,createdAt,updatedAt,createdBy,updatedBy,address,contactPersons]);
@override
String toString() {
return 'Customer(id: $id, type: $type, status: $status, firstName: $firstName, lastName: $lastName, fullName: $fullName, email: $email, phone: $phone, mobile: $mobile, registrationNumber: $registrationNumber, taxId: $taxId, industry: $industry, businessType: $businessType, employeeCount: $employeeCount, annualRevenue: $annualRevenue, foundedYear: $foundedYear, isVerified: $isVerified, isCompliant: $isCompliant, complianceNotes: $complianceNotes, language: $language, username: $username, currency: $currency, timezone: $timezone, createdAt: $createdAt, updatedAt: $updatedAt, createdBy: $createdBy, updatedBy: $updatedBy, address: $address, contactPersons: $contactPersons)';
}
}
/// @nodoc
abstract mixin class $CustomerCopyWith<$Res> {
factory $CustomerCopyWith(Customer value, $Res Function(Customer) _then) = _$CustomerCopyWithImpl;
@useResult
$Res call({
String? id, String? type, String? status,@JsonKey(name: 'first_name') String? firstName,@JsonKey(name: 'last_name') String? lastName,@JsonKey(name: 'full_name') String? fullName, String? email, String? phone, String? mobile,@JsonKey(name: 'registration_number') String? registrationNumber,@JsonKey(name: 'tax_id') String? taxId, String? industry,@JsonKey(name: 'business_type') String? businessType,@JsonKey(name: 'employee_count') int? employeeCount,@JsonKey(name: 'annual_revenue') int? annualRevenue,@JsonKey(name: 'founded_year') int? foundedYear,@JsonKey(name: 'is_verified') bool? isVerified,@JsonKey(name: 'is_compliant') bool? isCompliant,@JsonKey(name: 'compliance_notes') String? complianceNotes, String? language, String? username, String? currency, String? timezone,@JsonKey(name: 'created_at') int? createdAt,@JsonKey(name: 'updated_at') int? updatedAt,@JsonKey(name: 'created_by') String? createdBy,@JsonKey(name: 'updated_by') String? updatedBy, Address? address, ContactPerson? contactPersons
});
$AddressCopyWith<$Res>? get address;$ContactPersonCopyWith<$Res>? get contactPersons;
}
/// @nodoc
class _$CustomerCopyWithImpl<$Res>
implements $CustomerCopyWith<$Res> {
_$CustomerCopyWithImpl(this._self, this._then);
final Customer _self;
final $Res Function(Customer) _then;
/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? type = freezed,Object? status = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? fullName = freezed,Object? email = freezed,Object? phone = freezed,Object? mobile = freezed,Object? registrationNumber = freezed,Object? taxId = freezed,Object? industry = freezed,Object? businessType = freezed,Object? employeeCount = freezed,Object? annualRevenue = freezed,Object? foundedYear = freezed,Object? isVerified = freezed,Object? isCompliant = freezed,Object? complianceNotes = freezed,Object? language = freezed,Object? username = freezed,Object? currency = freezed,Object? timezone = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? createdBy = freezed,Object? updatedBy = freezed,Object? address = freezed,Object? contactPersons = freezed,}) {
return _then(_self.copyWith(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,registrationNumber: freezed == registrationNumber ? _self.registrationNumber : registrationNumber // ignore: cast_nullable_to_non_nullable
as String?,taxId: freezed == taxId ? _self.taxId : taxId // ignore: cast_nullable_to_non_nullable
as String?,industry: freezed == industry ? _self.industry : industry // ignore: cast_nullable_to_non_nullable
as String?,businessType: freezed == businessType ? _self.businessType : businessType // ignore: cast_nullable_to_non_nullable
as String?,employeeCount: freezed == employeeCount ? _self.employeeCount : employeeCount // ignore: cast_nullable_to_non_nullable
as int?,annualRevenue: freezed == annualRevenue ? _self.annualRevenue : annualRevenue // ignore: cast_nullable_to_non_nullable
as int?,foundedYear: freezed == foundedYear ? _self.foundedYear : foundedYear // ignore: cast_nullable_to_non_nullable
as int?,isVerified: freezed == isVerified ? _self.isVerified : isVerified // ignore: cast_nullable_to_non_nullable
as bool?,isCompliant: freezed == isCompliant ? _self.isCompliant : isCompliant // ignore: cast_nullable_to_non_nullable
as bool?,complianceNotes: freezed == complianceNotes ? _self.complianceNotes : complianceNotes // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,currency: freezed == currency ? _self.currency : currency // ignore: cast_nullable_to_non_nullable
as String?,timezone: freezed == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as int?,createdBy: freezed == createdBy ? _self.createdBy : createdBy // ignore: cast_nullable_to_non_nullable
as String?,updatedBy: freezed == updatedBy ? _self.updatedBy : updatedBy // ignore: cast_nullable_to_non_nullable
as String?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as Address?,contactPersons: freezed == contactPersons ? _self.contactPersons : contactPersons // ignore: cast_nullable_to_non_nullable
as ContactPerson?,
));
}
/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AddressCopyWith<$Res>? get address {
if (_self.address == null) {
return null;
}
return $AddressCopyWith<$Res>(_self.address!, (value) {
return _then(_self.copyWith(address: value));
});
}/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ContactPersonCopyWith<$Res>? get contactPersons {
if (_self.contactPersons == null) {
return null;
}
return $ContactPersonCopyWith<$Res>(_self.contactPersons!, (value) {
return _then(_self.copyWith(contactPersons: value));
});
}
}
/// Adds pattern-matching-related methods to [Customer].
extension CustomerPatterns on Customer {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _Customer value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _Customer() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _Customer value) $default,){
final _that = this;
switch (_that) {
case _Customer():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _Customer value)? $default,){
final _that = this;
switch (_that) {
case _Customer() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? id, String? type, String? status, @JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? email, String? phone, String? mobile, @JsonKey(name: 'registration_number') String? registrationNumber, @JsonKey(name: 'tax_id') String? taxId, String? industry, @JsonKey(name: 'business_type') String? businessType, @JsonKey(name: 'employee_count') int? employeeCount, @JsonKey(name: 'annual_revenue') int? annualRevenue, @JsonKey(name: 'founded_year') int? foundedYear, @JsonKey(name: 'is_verified') bool? isVerified, @JsonKey(name: 'is_compliant') bool? isCompliant, @JsonKey(name: 'compliance_notes') String? complianceNotes, String? language, String? username, String? currency, String? timezone, @JsonKey(name: 'created_at') int? createdAt, @JsonKey(name: 'updated_at') int? updatedAt, @JsonKey(name: 'created_by') String? createdBy, @JsonKey(name: 'updated_by') String? updatedBy, Address? address, ContactPerson? contactPersons)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Customer() when $default != null:
return $default(_that.id,_that.type,_that.status,_that.firstName,_that.lastName,_that.fullName,_that.email,_that.phone,_that.mobile,_that.registrationNumber,_that.taxId,_that.industry,_that.businessType,_that.employeeCount,_that.annualRevenue,_that.foundedYear,_that.isVerified,_that.isCompliant,_that.complianceNotes,_that.language,_that.username,_that.currency,_that.timezone,_that.createdAt,_that.updatedAt,_that.createdBy,_that.updatedBy,_that.address,_that.contactPersons);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? id, String? type, String? status, @JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? email, String? phone, String? mobile, @JsonKey(name: 'registration_number') String? registrationNumber, @JsonKey(name: 'tax_id') String? taxId, String? industry, @JsonKey(name: 'business_type') String? businessType, @JsonKey(name: 'employee_count') int? employeeCount, @JsonKey(name: 'annual_revenue') int? annualRevenue, @JsonKey(name: 'founded_year') int? foundedYear, @JsonKey(name: 'is_verified') bool? isVerified, @JsonKey(name: 'is_compliant') bool? isCompliant, @JsonKey(name: 'compliance_notes') String? complianceNotes, String? language, String? username, String? currency, String? timezone, @JsonKey(name: 'created_at') int? createdAt, @JsonKey(name: 'updated_at') int? updatedAt, @JsonKey(name: 'created_by') String? createdBy, @JsonKey(name: 'updated_by') String? updatedBy, Address? address, ContactPerson? contactPersons) $default,) {final _that = this;
switch (_that) {
case _Customer():
return $default(_that.id,_that.type,_that.status,_that.firstName,_that.lastName,_that.fullName,_that.email,_that.phone,_that.mobile,_that.registrationNumber,_that.taxId,_that.industry,_that.businessType,_that.employeeCount,_that.annualRevenue,_that.foundedYear,_that.isVerified,_that.isCompliant,_that.complianceNotes,_that.language,_that.username,_that.currency,_that.timezone,_that.createdAt,_that.updatedAt,_that.createdBy,_that.updatedBy,_that.address,_that.contactPersons);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? id, String? type, String? status, @JsonKey(name: 'first_name') String? firstName, @JsonKey(name: 'last_name') String? lastName, @JsonKey(name: 'full_name') String? fullName, String? email, String? phone, String? mobile, @JsonKey(name: 'registration_number') String? registrationNumber, @JsonKey(name: 'tax_id') String? taxId, String? industry, @JsonKey(name: 'business_type') String? businessType, @JsonKey(name: 'employee_count') int? employeeCount, @JsonKey(name: 'annual_revenue') int? annualRevenue, @JsonKey(name: 'founded_year') int? foundedYear, @JsonKey(name: 'is_verified') bool? isVerified, @JsonKey(name: 'is_compliant') bool? isCompliant, @JsonKey(name: 'compliance_notes') String? complianceNotes, String? language, String? username, String? currency, String? timezone, @JsonKey(name: 'created_at') int? createdAt, @JsonKey(name: 'updated_at') int? updatedAt, @JsonKey(name: 'created_by') String? createdBy, @JsonKey(name: 'updated_by') String? updatedBy, Address? address, ContactPerson? contactPersons)? $default,) {final _that = this;
switch (_that) {
case _Customer() when $default != null:
return $default(_that.id,_that.type,_that.status,_that.firstName,_that.lastName,_that.fullName,_that.email,_that.phone,_that.mobile,_that.registrationNumber,_that.taxId,_that.industry,_that.businessType,_that.employeeCount,_that.annualRevenue,_that.foundedYear,_that.isVerified,_that.isCompliant,_that.complianceNotes,_that.language,_that.username,_that.currency,_that.timezone,_that.createdAt,_that.updatedAt,_that.createdBy,_that.updatedBy,_that.address,_that.contactPersons);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _Customer implements Customer {
const _Customer({required this.id, required this.type, required this.status, @JsonKey(name: 'first_name') required this.firstName, @JsonKey(name: 'last_name') required this.lastName, @JsonKey(name: 'full_name') required this.fullName, required this.email, required this.phone, required this.mobile, @JsonKey(name: 'registration_number') required this.registrationNumber, @JsonKey(name: 'tax_id') required this.taxId, required this.industry, @JsonKey(name: 'business_type') required this.businessType, @JsonKey(name: 'employee_count') required this.employeeCount, @JsonKey(name: 'annual_revenue') required this.annualRevenue, @JsonKey(name: 'founded_year') required this.foundedYear, @JsonKey(name: 'is_verified') required this.isVerified, @JsonKey(name: 'is_compliant') required this.isCompliant, @JsonKey(name: 'compliance_notes') required this.complianceNotes, required this.language, required this.username, required this.currency, required this.timezone, @JsonKey(name: 'created_at') required this.createdAt, @JsonKey(name: 'updated_at') required this.updatedAt, @JsonKey(name: 'created_by') required this.createdBy, @JsonKey(name: 'updated_by') required this.updatedBy, required this.address, required this.contactPersons});
factory _Customer.fromJson(Map<String, dynamic> json) => _$CustomerFromJson(json);
@override final String? id;
@override final String? type;
@override final String? status;
@override@JsonKey(name: 'first_name') final String? firstName;
@override@JsonKey(name: 'last_name') final String? lastName;
@override@JsonKey(name: 'full_name') final String? fullName;
@override final String? email;
@override final String? phone;
@override final String? mobile;
@override@JsonKey(name: 'registration_number') final String? registrationNumber;
@override@JsonKey(name: 'tax_id') final String? taxId;
@override final String? industry;
@override@JsonKey(name: 'business_type') final String? businessType;
@override@JsonKey(name: 'employee_count') final int? employeeCount;
@override@JsonKey(name: 'annual_revenue') final int? annualRevenue;
@override@JsonKey(name: 'founded_year') final int? foundedYear;
@override@JsonKey(name: 'is_verified') final bool? isVerified;
@override@JsonKey(name: 'is_compliant') final bool? isCompliant;
@override@JsonKey(name: 'compliance_notes') final String? complianceNotes;
@override final String? language;
@override final String? username;
@override final String? currency;
@override final String? timezone;
@override@JsonKey(name: 'created_at') final int? createdAt;
@override@JsonKey(name: 'updated_at') final int? updatedAt;
@override@JsonKey(name: 'created_by') final String? createdBy;
@override@JsonKey(name: 'updated_by') final String? updatedBy;
@override final Address? address;
@override final ContactPerson? contactPersons;
/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$CustomerCopyWith<_Customer> get copyWith => __$CustomerCopyWithImpl<_Customer>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$CustomerToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Customer&&(identical(other.id, id) || other.id == id)&&(identical(other.type, type) || other.type == type)&&(identical(other.status, status) || other.status == status)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.fullName, fullName) || other.fullName == fullName)&&(identical(other.email, email) || other.email == email)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.mobile, mobile) || other.mobile == mobile)&&(identical(other.registrationNumber, registrationNumber) || other.registrationNumber == registrationNumber)&&(identical(other.taxId, taxId) || other.taxId == taxId)&&(identical(other.industry, industry) || other.industry == industry)&&(identical(other.businessType, businessType) || other.businessType == businessType)&&(identical(other.employeeCount, employeeCount) || other.employeeCount == employeeCount)&&(identical(other.annualRevenue, annualRevenue) || other.annualRevenue == annualRevenue)&&(identical(other.foundedYear, foundedYear) || other.foundedYear == foundedYear)&&(identical(other.isVerified, isVerified) || other.isVerified == isVerified)&&(identical(other.isCompliant, isCompliant) || other.isCompliant == isCompliant)&&(identical(other.complianceNotes, complianceNotes) || other.complianceNotes == complianceNotes)&&(identical(other.language, language) || other.language == language)&&(identical(other.username, username) || other.username == username)&&(identical(other.currency, currency) || other.currency == currency)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.createdBy, createdBy) || other.createdBy == createdBy)&&(identical(other.updatedBy, updatedBy) || other.updatedBy == updatedBy)&&(identical(other.address, address) || other.address == address)&&(identical(other.contactPersons, contactPersons) || other.contactPersons == contactPersons));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,id,type,status,firstName,lastName,fullName,email,phone,mobile,registrationNumber,taxId,industry,businessType,employeeCount,annualRevenue,foundedYear,isVerified,isCompliant,complianceNotes,language,username,currency,timezone,createdAt,updatedAt,createdBy,updatedBy,address,contactPersons]);
@override
String toString() {
return 'Customer(id: $id, type: $type, status: $status, firstName: $firstName, lastName: $lastName, fullName: $fullName, email: $email, phone: $phone, mobile: $mobile, registrationNumber: $registrationNumber, taxId: $taxId, industry: $industry, businessType: $businessType, employeeCount: $employeeCount, annualRevenue: $annualRevenue, foundedYear: $foundedYear, isVerified: $isVerified, isCompliant: $isCompliant, complianceNotes: $complianceNotes, language: $language, username: $username, currency: $currency, timezone: $timezone, createdAt: $createdAt, updatedAt: $updatedAt, createdBy: $createdBy, updatedBy: $updatedBy, address: $address, contactPersons: $contactPersons)';
}
}
/// @nodoc
abstract mixin class _$CustomerCopyWith<$Res> implements $CustomerCopyWith<$Res> {
factory _$CustomerCopyWith(_Customer value, $Res Function(_Customer) _then) = __$CustomerCopyWithImpl;
@override @useResult
$Res call({
String? id, String? type, String? status,@JsonKey(name: 'first_name') String? firstName,@JsonKey(name: 'last_name') String? lastName,@JsonKey(name: 'full_name') String? fullName, String? email, String? phone, String? mobile,@JsonKey(name: 'registration_number') String? registrationNumber,@JsonKey(name: 'tax_id') String? taxId, String? industry,@JsonKey(name: 'business_type') String? businessType,@JsonKey(name: 'employee_count') int? employeeCount,@JsonKey(name: 'annual_revenue') int? annualRevenue,@JsonKey(name: 'founded_year') int? foundedYear,@JsonKey(name: 'is_verified') bool? isVerified,@JsonKey(name: 'is_compliant') bool? isCompliant,@JsonKey(name: 'compliance_notes') String? complianceNotes, String? language, String? username, String? currency, String? timezone,@JsonKey(name: 'created_at') int? createdAt,@JsonKey(name: 'updated_at') int? updatedAt,@JsonKey(name: 'created_by') String? createdBy,@JsonKey(name: 'updated_by') String? updatedBy, Address? address, ContactPerson? contactPersons
});
@override $AddressCopyWith<$Res>? get address;@override $ContactPersonCopyWith<$Res>? get contactPersons;
}
/// @nodoc
class __$CustomerCopyWithImpl<$Res>
implements _$CustomerCopyWith<$Res> {
__$CustomerCopyWithImpl(this._self, this._then);
final _Customer _self;
final $Res Function(_Customer) _then;
/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? type = freezed,Object? status = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? fullName = freezed,Object? email = freezed,Object? phone = freezed,Object? mobile = freezed,Object? registrationNumber = freezed,Object? taxId = freezed,Object? industry = freezed,Object? businessType = freezed,Object? employeeCount = freezed,Object? annualRevenue = freezed,Object? foundedYear = freezed,Object? isVerified = freezed,Object? isCompliant = freezed,Object? complianceNotes = freezed,Object? language = freezed,Object? username = freezed,Object? currency = freezed,Object? timezone = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? createdBy = freezed,Object? updatedBy = freezed,Object? address = freezed,Object? contactPersons = freezed,}) {
return _then(_Customer(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,fullName: freezed == fullName ? _self.fullName : fullName // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,mobile: freezed == mobile ? _self.mobile : mobile // ignore: cast_nullable_to_non_nullable
as String?,registrationNumber: freezed == registrationNumber ? _self.registrationNumber : registrationNumber // ignore: cast_nullable_to_non_nullable
as String?,taxId: freezed == taxId ? _self.taxId : taxId // ignore: cast_nullable_to_non_nullable
as String?,industry: freezed == industry ? _self.industry : industry // ignore: cast_nullable_to_non_nullable
as String?,businessType: freezed == businessType ? _self.businessType : businessType // ignore: cast_nullable_to_non_nullable
as String?,employeeCount: freezed == employeeCount ? _self.employeeCount : employeeCount // ignore: cast_nullable_to_non_nullable
as int?,annualRevenue: freezed == annualRevenue ? _self.annualRevenue : annualRevenue // ignore: cast_nullable_to_non_nullable
as int?,foundedYear: freezed == foundedYear ? _self.foundedYear : foundedYear // ignore: cast_nullable_to_non_nullable
as int?,isVerified: freezed == isVerified ? _self.isVerified : isVerified // ignore: cast_nullable_to_non_nullable
as bool?,isCompliant: freezed == isCompliant ? _self.isCompliant : isCompliant // ignore: cast_nullable_to_non_nullable
as bool?,complianceNotes: freezed == complianceNotes ? _self.complianceNotes : complianceNotes // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,username: freezed == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String?,currency: freezed == currency ? _self.currency : currency // ignore: cast_nullable_to_non_nullable
as String?,timezone: freezed == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as int?,createdBy: freezed == createdBy ? _self.createdBy : createdBy // ignore: cast_nullable_to_non_nullable
as String?,updatedBy: freezed == updatedBy ? _self.updatedBy : updatedBy // ignore: cast_nullable_to_non_nullable
as String?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as Address?,contactPersons: freezed == contactPersons ? _self.contactPersons : contactPersons // ignore: cast_nullable_to_non_nullable
as ContactPerson?,
));
}
/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AddressCopyWith<$Res>? get address {
if (_self.address == null) {
return null;
}
return $AddressCopyWith<$Res>(_self.address!, (value) {
return _then(_self.copyWith(address: value));
});
}/// Create a copy of Customer
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ContactPersonCopyWith<$Res>? get contactPersons {
if (_self.contactPersons == null) {
return null;
}
return $ContactPersonCopyWith<$Res>(_self.contactPersons!, (value) {
return _then(_self.copyWith(contactPersons: value));
});
}
}
// dart format on
@@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'customer.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_Customer _$CustomerFromJson(Map<String, dynamic> json) => _Customer(
id: json['id'] as String?,
type: json['type'] as String?,
status: json['status'] as String?,
firstName: json['first_name'] as String?,
lastName: json['last_name'] as String?,
fullName: json['full_name'] as String?,
email: json['email'] as String?,
phone: json['phone'] as String?,
mobile: json['mobile'] as String?,
registrationNumber: json['registration_number'] as String?,
taxId: json['tax_id'] as String?,
industry: json['industry'] as String?,
businessType: json['business_type'] as String?,
employeeCount: (json['employee_count'] as num?)?.toInt(),
annualRevenue: (json['annual_revenue'] as num?)?.toInt(),
foundedYear: (json['founded_year'] as num?)?.toInt(),
isVerified: json['is_verified'] as bool?,
isCompliant: json['is_compliant'] as bool?,
complianceNotes: json['compliance_notes'] as String?,
language: json['language'] as String?,
username: json['username'] as String?,
currency: json['currency'] as String?,
timezone: json['timezone'] as String?,
createdAt: (json['created_at'] as num?)?.toInt(),
updatedAt: (json['updated_at'] as num?)?.toInt(),
createdBy: json['created_by'] as String?,
updatedBy: json['updated_by'] as String?,
address:
json['address'] == null
? null
: Address.fromJson(json['address'] as Map<String, dynamic>),
contactPersons:
json['contactPersons'] == null
? null
: ContactPerson.fromJson(
json['contactPersons'] as Map<String, dynamic>,
),
);
Map<String, dynamic> _$CustomerToJson(_Customer instance) => <String, dynamic>{
'id': instance.id,
'type': instance.type,
'status': instance.status,
'first_name': instance.firstName,
'last_name': instance.lastName,
'full_name': instance.fullName,
'email': instance.email,
'phone': instance.phone,
'mobile': instance.mobile,
'registration_number': instance.registrationNumber,
'tax_id': instance.taxId,
'industry': instance.industry,
'business_type': instance.businessType,
'employee_count': instance.employeeCount,
'annual_revenue': instance.annualRevenue,
'founded_year': instance.foundedYear,
'is_verified': instance.isVerified,
'is_compliant': instance.isCompliant,
'compliance_notes': instance.complianceNotes,
'language': instance.language,
'username': instance.username,
'currency': instance.currency,
'timezone': instance.timezone,
'created_at': instance.createdAt,
'updated_at': instance.updatedAt,
'created_by': instance.createdBy,
'updated_by': instance.updatedBy,
'address': instance.address,
'contactPersons': instance.contactPersons,
};
@@ -1,7 +1,9 @@
// ignore_for_file: invalid_annotation_target // ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:tm_app/data/services/model/user/user.dart'; import 'package:tm_app/data/services/model/customer/customer.dart';
import '../error/error_model.dart';
part 'login_data.freezed.dart'; part 'login_data.freezed.dart';
part 'login_data.g.dart'; part 'login_data.g.dart';
@@ -9,10 +11,11 @@ part 'login_data.g.dart';
@freezed @freezed
abstract class LoginData with _$LoginData { abstract class LoginData with _$LoginData {
const factory LoginData({ const factory LoginData({
required User user, required Customer? customer,
@JsonKey(name: 'access_token') required String accessToken, required ErrorModel? error,
@JsonKey(name: 'refresh_token') required String refreshToken, @JsonKey(name: 'access_token') required String? accessToken,
@JsonKey(name: 'expires_at') required int expiresAt, @JsonKey(name: 'refresh_token') required String? refreshToken,
@JsonKey(name: 'expires_at') required int? expiresAt,
}) = _LoginData; }) = _LoginData;
factory LoginData.fromJson(Map<String, Object?> json) => factory LoginData.fromJson(Map<String, Object?> json) =>
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$LoginData { mixin _$LoginData {
User get user;@JsonKey(name: 'access_token') String get accessToken;@JsonKey(name: 'refresh_token') String get refreshToken;@JsonKey(name: 'expires_at') int get expiresAt; Customer? get customer; ErrorModel? get error;@JsonKey(name: 'access_token') String? get accessToken;@JsonKey(name: 'refresh_token') String? get refreshToken;@JsonKey(name: 'expires_at') int? get expiresAt;
/// Create a copy of LoginData /// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $LoginDataCopyWith<LoginData> get copyWith => _$LoginDataCopyWithImpl<LoginData>
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginData&&(identical(other.user, user) || other.user == user)&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt)); return identical(this, other) || (other.runtimeType == runtimeType&&other is LoginData&&(identical(other.customer, customer) || other.customer == customer)&&(identical(other.error, error) || other.error == error)&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,user,accessToken,refreshToken,expiresAt); int get hashCode => Object.hash(runtimeType,customer,error,accessToken,refreshToken,expiresAt);
@override @override
String toString() { String toString() {
return 'LoginData(user: $user, accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: $expiresAt)'; return 'LoginData(customer: $customer, error: $error, accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: $expiresAt)';
} }
@@ -48,11 +48,11 @@ abstract mixin class $LoginDataCopyWith<$Res> {
factory $LoginDataCopyWith(LoginData value, $Res Function(LoginData) _then) = _$LoginDataCopyWithImpl; factory $LoginDataCopyWith(LoginData value, $Res Function(LoginData) _then) = _$LoginDataCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
User user,@JsonKey(name: 'access_token') String accessToken,@JsonKey(name: 'refresh_token') String refreshToken,@JsonKey(name: 'expires_at') int expiresAt Customer? customer, ErrorModel? error,@JsonKey(name: 'access_token') String? accessToken,@JsonKey(name: 'refresh_token') String? refreshToken,@JsonKey(name: 'expires_at') int? expiresAt
}); });
$UserCopyWith<$Res> get user; $CustomerCopyWith<$Res>? get customer;$ErrorModelCopyWith<$Res>? get error;
} }
/// @nodoc /// @nodoc
@@ -65,23 +65,39 @@ class _$LoginDataCopyWithImpl<$Res>
/// Create a copy of LoginData /// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? user = null,Object? accessToken = null,Object? refreshToken = null,Object? expiresAt = null,}) { @pragma('vm:prefer-inline') @override $Res call({Object? customer = freezed,Object? error = freezed,Object? accessToken = freezed,Object? refreshToken = freezed,Object? expiresAt = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
user: null == user ? _self.user : user // ignore: cast_nullable_to_non_nullable customer: freezed == customer ? _self.customer : customer // ignore: cast_nullable_to_non_nullable
as User,accessToken: null == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable as Customer?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as String,refreshToken: null == refreshToken ? _self.refreshToken : refreshToken // ignore: cast_nullable_to_non_nullable as ErrorModel?,accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
as String,expiresAt: null == expiresAt ? _self.expiresAt : expiresAt // ignore: cast_nullable_to_non_nullable as String?,refreshToken: freezed == refreshToken ? _self.refreshToken : refreshToken // ignore: cast_nullable_to_non_nullable
as int, as String?,expiresAt: freezed == expiresAt ? _self.expiresAt : expiresAt // ignore: cast_nullable_to_non_nullable
as int?,
)); ));
} }
/// Create a copy of LoginData /// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$UserCopyWith<$Res> get user { $CustomerCopyWith<$Res>? get customer {
if (_self.customer == null) {
return null;
}
return $UserCopyWith<$Res>(_self.user, (value) { return $CustomerCopyWith<$Res>(_self.customer!, (value) {
return _then(_self.copyWith(user: value)); return _then(_self.copyWith(customer: value));
});
}/// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
}); });
} }
} }
@@ -165,10 +181,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( User user, @JsonKey(name: 'access_token') String accessToken, @JsonKey(name: 'refresh_token') String refreshToken, @JsonKey(name: 'expires_at') int expiresAt)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( Customer? customer, ErrorModel? error, @JsonKey(name: 'access_token') String? accessToken, @JsonKey(name: 'refresh_token') String? refreshToken, @JsonKey(name: 'expires_at') int? expiresAt)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _LoginData() when $default != null: case _LoginData() when $default != null:
return $default(_that.user,_that.accessToken,_that.refreshToken,_that.expiresAt);case _: return $default(_that.customer,_that.error,_that.accessToken,_that.refreshToken,_that.expiresAt);case _:
return orElse(); return orElse();
} }
@@ -186,10 +202,10 @@ return $default(_that.user,_that.accessToken,_that.refreshToken,_that.expiresAt)
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( User user, @JsonKey(name: 'access_token') String accessToken, @JsonKey(name: 'refresh_token') String refreshToken, @JsonKey(name: 'expires_at') int expiresAt) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( Customer? customer, ErrorModel? error, @JsonKey(name: 'access_token') String? accessToken, @JsonKey(name: 'refresh_token') String? refreshToken, @JsonKey(name: 'expires_at') int? expiresAt) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _LoginData(): case _LoginData():
return $default(_that.user,_that.accessToken,_that.refreshToken,_that.expiresAt);case _: return $default(_that.customer,_that.error,_that.accessToken,_that.refreshToken,_that.expiresAt);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -206,10 +222,10 @@ return $default(_that.user,_that.accessToken,_that.refreshToken,_that.expiresAt)
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( User user, @JsonKey(name: 'access_token') String accessToken, @JsonKey(name: 'refresh_token') String refreshToken, @JsonKey(name: 'expires_at') int expiresAt)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( Customer? customer, ErrorModel? error, @JsonKey(name: 'access_token') String? accessToken, @JsonKey(name: 'refresh_token') String? refreshToken, @JsonKey(name: 'expires_at') int? expiresAt)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _LoginData() when $default != null: case _LoginData() when $default != null:
return $default(_that.user,_that.accessToken,_that.refreshToken,_that.expiresAt);case _: return $default(_that.customer,_that.error,_that.accessToken,_that.refreshToken,_that.expiresAt);case _:
return null; return null;
} }
@@ -221,13 +237,14 @@ return $default(_that.user,_that.accessToken,_that.refreshToken,_that.expiresAt)
@JsonSerializable() @JsonSerializable()
class _LoginData implements LoginData { class _LoginData implements LoginData {
const _LoginData({required this.user, @JsonKey(name: 'access_token') required this.accessToken, @JsonKey(name: 'refresh_token') required this.refreshToken, @JsonKey(name: 'expires_at') required this.expiresAt}); const _LoginData({required this.customer, required this.error, @JsonKey(name: 'access_token') required this.accessToken, @JsonKey(name: 'refresh_token') required this.refreshToken, @JsonKey(name: 'expires_at') required this.expiresAt});
factory _LoginData.fromJson(Map<String, dynamic> json) => _$LoginDataFromJson(json); factory _LoginData.fromJson(Map<String, dynamic> json) => _$LoginDataFromJson(json);
@override final User user; @override final Customer? customer;
@override@JsonKey(name: 'access_token') final String accessToken; @override final ErrorModel? error;
@override@JsonKey(name: 'refresh_token') final String refreshToken; @override@JsonKey(name: 'access_token') final String? accessToken;
@override@JsonKey(name: 'expires_at') final int expiresAt; @override@JsonKey(name: 'refresh_token') final String? refreshToken;
@override@JsonKey(name: 'expires_at') final int? expiresAt;
/// Create a copy of LoginData /// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -242,16 +259,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LoginData&&(identical(other.user, user) || other.user == user)&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _LoginData&&(identical(other.customer, customer) || other.customer == customer)&&(identical(other.error, error) || other.error == error)&&(identical(other.accessToken, accessToken) || other.accessToken == accessToken)&&(identical(other.refreshToken, refreshToken) || other.refreshToken == refreshToken)&&(identical(other.expiresAt, expiresAt) || other.expiresAt == expiresAt));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,user,accessToken,refreshToken,expiresAt); int get hashCode => Object.hash(runtimeType,customer,error,accessToken,refreshToken,expiresAt);
@override @override
String toString() { String toString() {
return 'LoginData(user: $user, accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: $expiresAt)'; return 'LoginData(customer: $customer, error: $error, accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: $expiresAt)';
} }
@@ -262,11 +279,11 @@ abstract mixin class _$LoginDataCopyWith<$Res> implements $LoginDataCopyWith<$Re
factory _$LoginDataCopyWith(_LoginData value, $Res Function(_LoginData) _then) = __$LoginDataCopyWithImpl; factory _$LoginDataCopyWith(_LoginData value, $Res Function(_LoginData) _then) = __$LoginDataCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
User user,@JsonKey(name: 'access_token') String accessToken,@JsonKey(name: 'refresh_token') String refreshToken,@JsonKey(name: 'expires_at') int expiresAt Customer? customer, ErrorModel? error,@JsonKey(name: 'access_token') String? accessToken,@JsonKey(name: 'refresh_token') String? refreshToken,@JsonKey(name: 'expires_at') int? expiresAt
}); });
@override $UserCopyWith<$Res> get user; @override $CustomerCopyWith<$Res>? get customer;@override $ErrorModelCopyWith<$Res>? get error;
} }
/// @nodoc /// @nodoc
@@ -279,13 +296,14 @@ class __$LoginDataCopyWithImpl<$Res>
/// Create a copy of LoginData /// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? user = null,Object? accessToken = null,Object? refreshToken = null,Object? expiresAt = null,}) { @override @pragma('vm:prefer-inline') $Res call({Object? customer = freezed,Object? error = freezed,Object? accessToken = freezed,Object? refreshToken = freezed,Object? expiresAt = freezed,}) {
return _then(_LoginData( return _then(_LoginData(
user: null == user ? _self.user : user // ignore: cast_nullable_to_non_nullable customer: freezed == customer ? _self.customer : customer // ignore: cast_nullable_to_non_nullable
as User,accessToken: null == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable as Customer?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as String,refreshToken: null == refreshToken ? _self.refreshToken : refreshToken // ignore: cast_nullable_to_non_nullable as ErrorModel?,accessToken: freezed == accessToken ? _self.accessToken : accessToken // ignore: cast_nullable_to_non_nullable
as String,expiresAt: null == expiresAt ? _self.expiresAt : expiresAt // ignore: cast_nullable_to_non_nullable as String?,refreshToken: freezed == refreshToken ? _self.refreshToken : refreshToken // ignore: cast_nullable_to_non_nullable
as int, as String?,expiresAt: freezed == expiresAt ? _self.expiresAt : expiresAt // ignore: cast_nullable_to_non_nullable
as int?,
)); ));
} }
@@ -293,10 +311,25 @@ as int,
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$UserCopyWith<$Res> get user { $CustomerCopyWith<$Res>? get customer {
if (_self.customer == null) {
return null;
}
return $UserCopyWith<$Res>(_self.user, (value) { return $CustomerCopyWith<$Res>(_self.customer!, (value) {
return _then(_self.copyWith(user: value)); return _then(_self.copyWith(customer: value));
});
}/// Create a copy of LoginData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
}); });
} }
} }
@@ -7,15 +7,23 @@ part of 'login_data.dart';
// ************************************************************************** // **************************************************************************
_LoginData _$LoginDataFromJson(Map<String, dynamic> json) => _LoginData( _LoginData _$LoginDataFromJson(Map<String, dynamic> json) => _LoginData(
user: User.fromJson(json['user'] as Map<String, dynamic>), customer:
accessToken: json['access_token'] as String, json['customer'] == null
refreshToken: json['refresh_token'] as String, ? null
expiresAt: (json['expires_at'] as num).toInt(), : Customer.fromJson(json['customer'] as Map<String, dynamic>),
error:
json['error'] == null
? null
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
accessToken: json['access_token'] as String?,
refreshToken: json['refresh_token'] as String?,
expiresAt: (json['expires_at'] as num?)?.toInt(),
); );
Map<String, dynamic> _$LoginDataToJson(_LoginData instance) => Map<String, dynamic> _$LoginDataToJson(_LoginData instance) =>
<String, dynamic>{ <String, dynamic>{
'user': instance.user, 'customer': instance.customer,
'error': instance.error,
'access_token': instance.accessToken, 'access_token': instance.accessToken,
'refresh_token': instance.refreshToken, 'refresh_token': instance.refreshToken,
'expires_at': instance.expiresAt, 'expires_at': instance.expiresAt,
@@ -1,6 +1,8 @@
// ignore_for_file: invalid_annotation_target // ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:tm_app/data/services/model/error/error_model.dart';
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
part 'tender_detail_response_model.freezed.dart'; part 'tender_detail_response_model.freezed.dart';
part 'tender_detail_response_model.g.dart'; part 'tender_detail_response_model.g.dart';
@@ -9,24 +11,10 @@ part 'tender_detail_response_model.g.dart';
abstract class TenderDetailResponseModel with _$TenderDetailResponseModel { abstract class TenderDetailResponseModel with _$TenderDetailResponseModel {
@JsonSerializable(explicitToJson: true) @JsonSerializable(explicitToJson: true)
const factory TenderDetailResponseModel({ const factory TenderDetailResponseModel({
required String? date, required TenderData? data,
required String? status, required ErrorModel? error,
required String? title, required bool? success,
required String? id, required String? message,
required String? approvalDate,
required String? submissionDate,
required String? client,
required String? deliveryLocation,
required String? referenceNumber,
required String? country,
required String? flagAsset,
required String? locationTitle,
required String? locationDescription,
required String? documentName,
required String? documentUrl,
required double? profileMatch,
required bool? incompleteResume,
required String? incompleteResumeReason,
}) = _TenderDetailResponseModel; }) = _TenderDetailResponseModel;
factory TenderDetailResponseModel.fromJson(Map<String, dynamic> json) => factory TenderDetailResponseModel.fromJson(Map<String, dynamic> json) =>
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$TenderDetailResponseModel { mixin _$TenderDetailResponseModel {
String? get date; String? get status; String? get title; String? get id; String? get approvalDate; String? get submissionDate; String? get client; String? get deliveryLocation; String? get referenceNumber; String? get country; String? get flagAsset; String? get locationTitle; String? get locationDescription; String? get documentName; String? get documentUrl; double? get profileMatch; bool? get incompleteResume; String? get incompleteResumeReason; TenderData? get data; ErrorModel? get error; bool? get success; String? get message;
/// Create a copy of TenderDetailResponseModel /// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $TenderDetailResponseModelCopyWith<TenderDetailResponseModel> get copyWith => _$
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderDetailResponseModel&&(identical(other.date, date) || other.date == date)&&(identical(other.status, status) || other.status == status)&&(identical(other.title, title) || other.title == title)&&(identical(other.id, id) || other.id == id)&&(identical(other.approvalDate, approvalDate) || other.approvalDate == approvalDate)&&(identical(other.submissionDate, submissionDate) || other.submissionDate == submissionDate)&&(identical(other.client, client) || other.client == client)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation)&&(identical(other.referenceNumber, referenceNumber) || other.referenceNumber == referenceNumber)&&(identical(other.country, country) || other.country == country)&&(identical(other.flagAsset, flagAsset) || other.flagAsset == flagAsset)&&(identical(other.locationTitle, locationTitle) || other.locationTitle == locationTitle)&&(identical(other.locationDescription, locationDescription) || other.locationDescription == locationDescription)&&(identical(other.documentName, documentName) || other.documentName == documentName)&&(identical(other.documentUrl, documentUrl) || other.documentUrl == documentUrl)&&(identical(other.profileMatch, profileMatch) || other.profileMatch == profileMatch)&&(identical(other.incompleteResume, incompleteResume) || other.incompleteResume == incompleteResume)&&(identical(other.incompleteResumeReason, incompleteResumeReason) || other.incompleteResumeReason == incompleteResumeReason)); return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderDetailResponseModel&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,date,status,title,id,approvalDate,submissionDate,client,deliveryLocation,referenceNumber,country,flagAsset,locationTitle,locationDescription,documentName,documentUrl,profileMatch,incompleteResume,incompleteResumeReason); int get hashCode => Object.hash(runtimeType,data,error,success,message);
@override @override
String toString() { String toString() {
return 'TenderDetailResponseModel(date: $date, status: $status, title: $title, id: $id, approvalDate: $approvalDate, submissionDate: $submissionDate, client: $client, deliveryLocation: $deliveryLocation, referenceNumber: $referenceNumber, country: $country, flagAsset: $flagAsset, locationTitle: $locationTitle, locationDescription: $locationDescription, documentName: $documentName, documentUrl: $documentUrl, profileMatch: $profileMatch, incompleteResume: $incompleteResume, incompleteResumeReason: $incompleteResumeReason)'; return 'TenderDetailResponseModel(data: $data, error: $error, success: $success, message: $message)';
} }
@@ -48,11 +48,11 @@ abstract mixin class $TenderDetailResponseModelCopyWith<$Res> {
factory $TenderDetailResponseModelCopyWith(TenderDetailResponseModel value, $Res Function(TenderDetailResponseModel) _then) = _$TenderDetailResponseModelCopyWithImpl; factory $TenderDetailResponseModelCopyWith(TenderDetailResponseModel value, $Res Function(TenderDetailResponseModel) _then) = _$TenderDetailResponseModelCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String? date, String? status, String? title, String? id, String? approvalDate, String? submissionDate, String? client, String? deliveryLocation, String? referenceNumber, String? country, String? flagAsset, String? locationTitle, String? locationDescription, String? documentName, String? documentUrl, double? profileMatch, bool? incompleteResume, String? incompleteResumeReason TenderData? data, ErrorModel? error, bool? success, String? message
}); });
$TenderDataCopyWith<$Res>? get data;$ErrorModelCopyWith<$Res>? get error;
} }
/// @nodoc /// @nodoc
@@ -65,30 +65,40 @@ class _$TenderDetailResponseModelCopyWithImpl<$Res>
/// Create a copy of TenderDetailResponseModel /// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? date = freezed,Object? status = freezed,Object? title = freezed,Object? id = freezed,Object? approvalDate = freezed,Object? submissionDate = freezed,Object? client = freezed,Object? deliveryLocation = freezed,Object? referenceNumber = freezed,Object? country = freezed,Object? flagAsset = freezed,Object? locationTitle = freezed,Object? locationDescription = freezed,Object? documentName = freezed,Object? documentUrl = freezed,Object? profileMatch = freezed,Object? incompleteResume = freezed,Object? incompleteResumeReason = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? data = freezed,Object? error = freezed,Object? success = freezed,Object? message = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable as TenderData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable as ErrorModel?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String?,approvalDate: freezed == approvalDate ? _self.approvalDate : approvalDate // ignore: cast_nullable_to_non_nullable
as String?,submissionDate: freezed == submissionDate ? _self.submissionDate : submissionDate // ignore: cast_nullable_to_non_nullable
as String?,client: freezed == client ? _self.client : client // ignore: cast_nullable_to_non_nullable
as String?,deliveryLocation: freezed == deliveryLocation ? _self.deliveryLocation : deliveryLocation // ignore: cast_nullable_to_non_nullable
as String?,referenceNumber: freezed == referenceNumber ? _self.referenceNumber : referenceNumber // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,flagAsset: freezed == flagAsset ? _self.flagAsset : flagAsset // ignore: cast_nullable_to_non_nullable
as String?,locationTitle: freezed == locationTitle ? _self.locationTitle : locationTitle // ignore: cast_nullable_to_non_nullable
as String?,locationDescription: freezed == locationDescription ? _self.locationDescription : locationDescription // ignore: cast_nullable_to_non_nullable
as String?,documentName: freezed == documentName ? _self.documentName : documentName // ignore: cast_nullable_to_non_nullable
as String?,documentUrl: freezed == documentUrl ? _self.documentUrl : documentUrl // ignore: cast_nullable_to_non_nullable
as String?,profileMatch: freezed == profileMatch ? _self.profileMatch : profileMatch // ignore: cast_nullable_to_non_nullable
as double?,incompleteResume: freezed == incompleteResume ? _self.incompleteResume : incompleteResume // ignore: cast_nullable_to_non_nullable
as bool?,incompleteResumeReason: freezed == incompleteResumeReason ? _self.incompleteResumeReason : incompleteResumeReason // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ));
} }
/// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TenderDataCopyWith<$Res>? get data {
if (_self.data == null) {
return null;
}
return $TenderDataCopyWith<$Res>(_self.data!, (value) {
return _then(_self.copyWith(data: value));
});
}/// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
});
}
} }
@@ -170,10 +180,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? date, String? status, String? title, String? id, String? approvalDate, String? submissionDate, String? client, String? deliveryLocation, String? referenceNumber, String? country, String? flagAsset, String? locationTitle, String? locationDescription, String? documentName, String? documentUrl, double? profileMatch, bool? incompleteResume, String? incompleteResumeReason)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( TenderData? data, ErrorModel? error, bool? success, String? message)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _TenderDetailResponseModel() when $default != null: case _TenderDetailResponseModel() when $default != null:
return $default(_that.date,_that.status,_that.title,_that.id,_that.approvalDate,_that.submissionDate,_that.client,_that.deliveryLocation,_that.referenceNumber,_that.country,_that.flagAsset,_that.locationTitle,_that.locationDescription,_that.documentName,_that.documentUrl,_that.profileMatch,_that.incompleteResume,_that.incompleteResumeReason);case _: return $default(_that.data,_that.error,_that.success,_that.message);case _:
return orElse(); return orElse();
} }
@@ -191,10 +201,10 @@ return $default(_that.date,_that.status,_that.title,_that.id,_that.approvalDate,
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? date, String? status, String? title, String? id, String? approvalDate, String? submissionDate, String? client, String? deliveryLocation, String? referenceNumber, String? country, String? flagAsset, String? locationTitle, String? locationDescription, String? documentName, String? documentUrl, double? profileMatch, bool? incompleteResume, String? incompleteResumeReason) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( TenderData? data, ErrorModel? error, bool? success, String? message) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _TenderDetailResponseModel(): case _TenderDetailResponseModel():
return $default(_that.date,_that.status,_that.title,_that.id,_that.approvalDate,_that.submissionDate,_that.client,_that.deliveryLocation,_that.referenceNumber,_that.country,_that.flagAsset,_that.locationTitle,_that.locationDescription,_that.documentName,_that.documentUrl,_that.profileMatch,_that.incompleteResume,_that.incompleteResumeReason);case _: return $default(_that.data,_that.error,_that.success,_that.message);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -211,10 +221,10 @@ return $default(_that.date,_that.status,_that.title,_that.id,_that.approvalDate,
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? date, String? status, String? title, String? id, String? approvalDate, String? submissionDate, String? client, String? deliveryLocation, String? referenceNumber, String? country, String? flagAsset, String? locationTitle, String? locationDescription, String? documentName, String? documentUrl, double? profileMatch, bool? incompleteResume, String? incompleteResumeReason)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( TenderData? data, ErrorModel? error, bool? success, String? message)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _TenderDetailResponseModel() when $default != null: case _TenderDetailResponseModel() when $default != null:
return $default(_that.date,_that.status,_that.title,_that.id,_that.approvalDate,_that.submissionDate,_that.client,_that.deliveryLocation,_that.referenceNumber,_that.country,_that.flagAsset,_that.locationTitle,_that.locationDescription,_that.documentName,_that.documentUrl,_that.profileMatch,_that.incompleteResume,_that.incompleteResumeReason);case _: return $default(_that.data,_that.error,_that.success,_that.message);case _:
return null; return null;
} }
@@ -226,27 +236,13 @@ return $default(_that.date,_that.status,_that.title,_that.id,_that.approvalDate,
@JsonSerializable(explicitToJson: true) @JsonSerializable(explicitToJson: true)
class _TenderDetailResponseModel implements TenderDetailResponseModel { class _TenderDetailResponseModel implements TenderDetailResponseModel {
const _TenderDetailResponseModel({required this.date, required this.status, required this.title, required this.id, required this.approvalDate, required this.submissionDate, required this.client, required this.deliveryLocation, required this.referenceNumber, required this.country, required this.flagAsset, required this.locationTitle, required this.locationDescription, required this.documentName, required this.documentUrl, required this.profileMatch, required this.incompleteResume, required this.incompleteResumeReason}); const _TenderDetailResponseModel({required this.data, required this.error, required this.success, required this.message});
factory _TenderDetailResponseModel.fromJson(Map<String, dynamic> json) => _$TenderDetailResponseModelFromJson(json); factory _TenderDetailResponseModel.fromJson(Map<String, dynamic> json) => _$TenderDetailResponseModelFromJson(json);
@override final String? date; @override final TenderData? data;
@override final String? status; @override final ErrorModel? error;
@override final String? title; @override final bool? success;
@override final String? id; @override final String? message;
@override final String? approvalDate;
@override final String? submissionDate;
@override final String? client;
@override final String? deliveryLocation;
@override final String? referenceNumber;
@override final String? country;
@override final String? flagAsset;
@override final String? locationTitle;
@override final String? locationDescription;
@override final String? documentName;
@override final String? documentUrl;
@override final double? profileMatch;
@override final bool? incompleteResume;
@override final String? incompleteResumeReason;
/// Create a copy of TenderDetailResponseModel /// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -261,16 +257,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderDetailResponseModel&&(identical(other.date, date) || other.date == date)&&(identical(other.status, status) || other.status == status)&&(identical(other.title, title) || other.title == title)&&(identical(other.id, id) || other.id == id)&&(identical(other.approvalDate, approvalDate) || other.approvalDate == approvalDate)&&(identical(other.submissionDate, submissionDate) || other.submissionDate == submissionDate)&&(identical(other.client, client) || other.client == client)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation)&&(identical(other.referenceNumber, referenceNumber) || other.referenceNumber == referenceNumber)&&(identical(other.country, country) || other.country == country)&&(identical(other.flagAsset, flagAsset) || other.flagAsset == flagAsset)&&(identical(other.locationTitle, locationTitle) || other.locationTitle == locationTitle)&&(identical(other.locationDescription, locationDescription) || other.locationDescription == locationDescription)&&(identical(other.documentName, documentName) || other.documentName == documentName)&&(identical(other.documentUrl, documentUrl) || other.documentUrl == documentUrl)&&(identical(other.profileMatch, profileMatch) || other.profileMatch == profileMatch)&&(identical(other.incompleteResume, incompleteResume) || other.incompleteResume == incompleteResume)&&(identical(other.incompleteResumeReason, incompleteResumeReason) || other.incompleteResumeReason == incompleteResumeReason)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderDetailResponseModel&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&(identical(other.success, success) || other.success == success)&&(identical(other.message, message) || other.message == message));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,date,status,title,id,approvalDate,submissionDate,client,deliveryLocation,referenceNumber,country,flagAsset,locationTitle,locationDescription,documentName,documentUrl,profileMatch,incompleteResume,incompleteResumeReason); int get hashCode => Object.hash(runtimeType,data,error,success,message);
@override @override
String toString() { String toString() {
return 'TenderDetailResponseModel(date: $date, status: $status, title: $title, id: $id, approvalDate: $approvalDate, submissionDate: $submissionDate, client: $client, deliveryLocation: $deliveryLocation, referenceNumber: $referenceNumber, country: $country, flagAsset: $flagAsset, locationTitle: $locationTitle, locationDescription: $locationDescription, documentName: $documentName, documentUrl: $documentUrl, profileMatch: $profileMatch, incompleteResume: $incompleteResume, incompleteResumeReason: $incompleteResumeReason)'; return 'TenderDetailResponseModel(data: $data, error: $error, success: $success, message: $message)';
} }
@@ -281,11 +277,11 @@ abstract mixin class _$TenderDetailResponseModelCopyWith<$Res> implements $Tende
factory _$TenderDetailResponseModelCopyWith(_TenderDetailResponseModel value, $Res Function(_TenderDetailResponseModel) _then) = __$TenderDetailResponseModelCopyWithImpl; factory _$TenderDetailResponseModelCopyWith(_TenderDetailResponseModel value, $Res Function(_TenderDetailResponseModel) _then) = __$TenderDetailResponseModelCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String? date, String? status, String? title, String? id, String? approvalDate, String? submissionDate, String? client, String? deliveryLocation, String? referenceNumber, String? country, String? flagAsset, String? locationTitle, String? locationDescription, String? documentName, String? documentUrl, double? profileMatch, bool? incompleteResume, String? incompleteResumeReason TenderData? data, ErrorModel? error, bool? success, String? message
}); });
@override $TenderDataCopyWith<$Res>? get data;@override $ErrorModelCopyWith<$Res>? get error;
} }
/// @nodoc /// @nodoc
@@ -298,31 +294,41 @@ class __$TenderDetailResponseModelCopyWithImpl<$Res>
/// Create a copy of TenderDetailResponseModel /// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? date = freezed,Object? status = freezed,Object? title = freezed,Object? id = freezed,Object? approvalDate = freezed,Object? submissionDate = freezed,Object? client = freezed,Object? deliveryLocation = freezed,Object? referenceNumber = freezed,Object? country = freezed,Object? flagAsset = freezed,Object? locationTitle = freezed,Object? locationDescription = freezed,Object? documentName = freezed,Object? documentUrl = freezed,Object? profileMatch = freezed,Object? incompleteResume = freezed,Object? incompleteResumeReason = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? data = freezed,Object? error = freezed,Object? success = freezed,Object? message = freezed,}) {
return _then(_TenderDetailResponseModel( return _then(_TenderDetailResponseModel(
date: freezed == date ? _self.date : date // ignore: cast_nullable_to_non_nullable data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable as TenderData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable as ErrorModel?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as String?,id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as bool?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String?,approvalDate: freezed == approvalDate ? _self.approvalDate : approvalDate // ignore: cast_nullable_to_non_nullable
as String?,submissionDate: freezed == submissionDate ? _self.submissionDate : submissionDate // ignore: cast_nullable_to_non_nullable
as String?,client: freezed == client ? _self.client : client // ignore: cast_nullable_to_non_nullable
as String?,deliveryLocation: freezed == deliveryLocation ? _self.deliveryLocation : deliveryLocation // ignore: cast_nullable_to_non_nullable
as String?,referenceNumber: freezed == referenceNumber ? _self.referenceNumber : referenceNumber // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,flagAsset: freezed == flagAsset ? _self.flagAsset : flagAsset // ignore: cast_nullable_to_non_nullable
as String?,locationTitle: freezed == locationTitle ? _self.locationTitle : locationTitle // ignore: cast_nullable_to_non_nullable
as String?,locationDescription: freezed == locationDescription ? _self.locationDescription : locationDescription // ignore: cast_nullable_to_non_nullable
as String?,documentName: freezed == documentName ? _self.documentName : documentName // ignore: cast_nullable_to_non_nullable
as String?,documentUrl: freezed == documentUrl ? _self.documentUrl : documentUrl // ignore: cast_nullable_to_non_nullable
as String?,profileMatch: freezed == profileMatch ? _self.profileMatch : profileMatch // ignore: cast_nullable_to_non_nullable
as double?,incompleteResume: freezed == incompleteResume ? _self.incompleteResume : incompleteResume // ignore: cast_nullable_to_non_nullable
as bool?,incompleteResumeReason: freezed == incompleteResumeReason ? _self.incompleteResumeReason : incompleteResumeReason // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ));
} }
/// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TenderDataCopyWith<$Res>? get data {
if (_self.data == null) {
return null;
}
return $TenderDataCopyWith<$Res>(_self.data!, (value) {
return _then(_self.copyWith(data: value));
});
}/// Create a copy of TenderDetailResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
});
}
} }
// dart format on // dart format on
@@ -9,45 +9,23 @@ part of 'tender_detail_response_model.dart';
_TenderDetailResponseModel _$TenderDetailResponseModelFromJson( _TenderDetailResponseModel _$TenderDetailResponseModelFromJson(
Map<String, dynamic> json, Map<String, dynamic> json,
) => _TenderDetailResponseModel( ) => _TenderDetailResponseModel(
date: json['date'] as String?, data:
status: json['status'] as String?, json['data'] == null
title: json['title'] as String?, ? null
id: json['id'] as String?, : TenderData.fromJson(json['data'] as Map<String, dynamic>),
approvalDate: json['approvalDate'] as String?, error:
submissionDate: json['submissionDate'] as String?, json['error'] == null
client: json['client'] as String?, ? null
deliveryLocation: json['deliveryLocation'] as String?, : ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
referenceNumber: json['referenceNumber'] as String?, success: json['success'] as bool?,
country: json['country'] as String?, message: json['message'] as String?,
flagAsset: json['flagAsset'] as String?,
locationTitle: json['locationTitle'] as String?,
locationDescription: json['locationDescription'] as String?,
documentName: json['documentName'] as String?,
documentUrl: json['documentUrl'] as String?,
profileMatch: (json['profileMatch'] as num?)?.toDouble(),
incompleteResume: json['incompleteResume'] as bool?,
incompleteResumeReason: json['incompleteResumeReason'] as String?,
); );
Map<String, dynamic> _$TenderDetailResponseModelToJson( Map<String, dynamic> _$TenderDetailResponseModelToJson(
_TenderDetailResponseModel instance, _TenderDetailResponseModel instance,
) => <String, dynamic>{ ) => <String, dynamic>{
'date': instance.date, 'data': instance.data?.toJson(),
'status': instance.status, 'error': instance.error?.toJson(),
'title': instance.title, 'success': instance.success,
'id': instance.id, 'message': instance.message,
'approvalDate': instance.approvalDate,
'submissionDate': instance.submissionDate,
'client': instance.client,
'deliveryLocation': instance.deliveryLocation,
'referenceNumber': instance.referenceNumber,
'country': instance.country,
'flagAsset': instance.flagAsset,
'locationTitle': instance.locationTitle,
'locationDescription': instance.locationDescription,
'documentName': instance.documentName,
'documentUrl': instance.documentUrl,
'profileMatch': instance.profileMatch,
'incompleteResume': instance.incompleteResume,
'incompleteResumeReason': instance.incompleteResumeReason,
}; };
@@ -0,0 +1,20 @@
// ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart';
import '../../meta/meta.dart';
import '../../tender_data/tender_data.dart';
part 'tenders_data.freezed.dart';
part 'tenders_data.g.dart';
@freezed
abstract class TendersData with _$TendersData {
const factory TendersData({
required List<TenderData>? tenders,
required Meta? metadata,
}) = _TendersData;
factory TendersData.fromJson(Map<String, Object?> json) =>
_$TendersDataFromJson(json);
}
@@ -0,0 +1,312 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'tenders_data.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$TendersData {
List<TenderData>? get tenders; Meta? get metadata;
/// Create a copy of TendersData
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$TendersDataCopyWith<TendersData> get copyWith => _$TendersDataCopyWithImpl<TendersData>(this as TendersData, _$identity);
/// Serializes this TendersData to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is TendersData&&const DeepCollectionEquality().equals(other.tenders, tenders)&&(identical(other.metadata, metadata) || other.metadata == metadata));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(tenders),metadata);
@override
String toString() {
return 'TendersData(tenders: $tenders, metadata: $metadata)';
}
}
/// @nodoc
abstract mixin class $TendersDataCopyWith<$Res> {
factory $TendersDataCopyWith(TendersData value, $Res Function(TendersData) _then) = _$TendersDataCopyWithImpl;
@useResult
$Res call({
List<TenderData>? tenders, Meta? metadata
});
$MetaCopyWith<$Res>? get metadata;
}
/// @nodoc
class _$TendersDataCopyWithImpl<$Res>
implements $TendersDataCopyWith<$Res> {
_$TendersDataCopyWithImpl(this._self, this._then);
final TendersData _self;
final $Res Function(TendersData) _then;
/// Create a copy of TendersData
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? tenders = freezed,Object? metadata = freezed,}) {
return _then(_self.copyWith(
tenders: freezed == tenders ? _self.tenders : tenders // ignore: cast_nullable_to_non_nullable
as List<TenderData>?,metadata: freezed == metadata ? _self.metadata : metadata // ignore: cast_nullable_to_non_nullable
as Meta?,
));
}
/// Create a copy of TendersData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res>? get metadata {
if (_self.metadata == null) {
return null;
}
return $MetaCopyWith<$Res>(_self.metadata!, (value) {
return _then(_self.copyWith(metadata: value));
});
}
}
/// Adds pattern-matching-related methods to [TendersData].
extension TendersDataPatterns on TendersData {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _TendersData value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _TendersData() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _TendersData value) $default,){
final _that = this;
switch (_that) {
case _TendersData():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _TendersData value)? $default,){
final _that = this;
switch (_that) {
case _TendersData() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<TenderData>? tenders, Meta? metadata)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _TendersData() when $default != null:
return $default(_that.tenders,_that.metadata);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<TenderData>? tenders, Meta? metadata) $default,) {final _that = this;
switch (_that) {
case _TendersData():
return $default(_that.tenders,_that.metadata);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<TenderData>? tenders, Meta? metadata)? $default,) {final _that = this;
switch (_that) {
case _TendersData() when $default != null:
return $default(_that.tenders,_that.metadata);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _TendersData implements TendersData {
const _TendersData({required final List<TenderData>? tenders, required this.metadata}): _tenders = tenders;
factory _TendersData.fromJson(Map<String, dynamic> json) => _$TendersDataFromJson(json);
final List<TenderData>? _tenders;
@override List<TenderData>? get tenders {
final value = _tenders;
if (value == null) return null;
if (_tenders is EqualUnmodifiableListView) return _tenders;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
@override final Meta? metadata;
/// Create a copy of TendersData
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$TendersDataCopyWith<_TendersData> get copyWith => __$TendersDataCopyWithImpl<_TendersData>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$TendersDataToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TendersData&&const DeepCollectionEquality().equals(other._tenders, _tenders)&&(identical(other.metadata, metadata) || other.metadata == metadata));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_tenders),metadata);
@override
String toString() {
return 'TendersData(tenders: $tenders, metadata: $metadata)';
}
}
/// @nodoc
abstract mixin class _$TendersDataCopyWith<$Res> implements $TendersDataCopyWith<$Res> {
factory _$TendersDataCopyWith(_TendersData value, $Res Function(_TendersData) _then) = __$TendersDataCopyWithImpl;
@override @useResult
$Res call({
List<TenderData>? tenders, Meta? metadata
});
@override $MetaCopyWith<$Res>? get metadata;
}
/// @nodoc
class __$TendersDataCopyWithImpl<$Res>
implements _$TendersDataCopyWith<$Res> {
__$TendersDataCopyWithImpl(this._self, this._then);
final _TendersData _self;
final $Res Function(_TendersData) _then;
/// Create a copy of TendersData
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? tenders = freezed,Object? metadata = freezed,}) {
return _then(_TendersData(
tenders: freezed == tenders ? _self._tenders : tenders // ignore: cast_nullable_to_non_nullable
as List<TenderData>?,metadata: freezed == metadata ? _self.metadata : metadata // ignore: cast_nullable_to_non_nullable
as Meta?,
));
}
/// Create a copy of TendersData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res>? get metadata {
if (_self.metadata == null) {
return null;
}
return $MetaCopyWith<$Res>(_self.metadata!, (value) {
return _then(_self.copyWith(metadata: value));
});
}
}
// dart format on
@@ -0,0 +1,24 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'tenders_data.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_TendersData _$TendersDataFromJson(Map<String, dynamic> json) => _TendersData(
tenders:
(json['tenders'] as List<dynamic>?)
?.map((e) => TenderData.fromJson(e as Map<String, dynamic>))
.toList(),
metadata:
json['metadata'] == null
? null
: Meta.fromJson(json['metadata'] as Map<String, dynamic>),
);
Map<String, dynamic> _$TendersDataToJson(_TendersData instance) =>
<String, dynamic>{
'tenders': instance.tenders,
'metadata': instance.metadata,
};
@@ -1,15 +1,21 @@
// ignore_for_file: invalid_annotation_target // ignore_for_file: invalid_annotation_target
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:tm_app/data/services/model/tender/tender_model.dart';
import '../../error/error_model.dart';
import '../tenders_data/tenders_data.dart';
part 'tenders_response.freezed.dart'; part 'tenders_response.freezed.dart';
part 'tenders_response.g.dart'; part 'tenders_response.g.dart';
@freezed @freezed
abstract class TendersResponse with _$TendersResponse { abstract class TendersResponse with _$TendersResponse {
const factory TendersResponse({required List<TenderModel>? tenders}) = const factory TendersResponse({
_TendersResponse; required TendersData? data,
required ErrorModel? error,
required String? message,
required bool? success,
}) = _TendersResponse;
factory TendersResponse.fromJson(Map<String, Object?> json) => factory TendersResponse.fromJson(Map<String, Object?> json) =>
_$TendersResponseFromJson(json); _$TendersResponseFromJson(json);
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$TendersResponse { mixin _$TendersResponse {
List<TenderModel>? get tenders; TendersData? get data; ErrorModel? get error; String? get message; bool? get success;
/// Create a copy of TendersResponse /// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $TendersResponseCopyWith<TendersResponse> get copyWith => _$TendersResponseCopyW
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is TendersResponse&&const DeepCollectionEquality().equals(other.tenders, tenders)); return identical(this, other) || (other.runtimeType == runtimeType&&other is TendersResponse&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(tenders)); int get hashCode => Object.hash(runtimeType,data,error,message,success);
@override @override
String toString() { String toString() {
return 'TendersResponse(tenders: $tenders)'; return 'TendersResponse(data: $data, error: $error, message: $message, success: $success)';
} }
@@ -48,11 +48,11 @@ abstract mixin class $TendersResponseCopyWith<$Res> {
factory $TendersResponseCopyWith(TendersResponse value, $Res Function(TendersResponse) _then) = _$TendersResponseCopyWithImpl; factory $TendersResponseCopyWith(TendersResponse value, $Res Function(TendersResponse) _then) = _$TendersResponseCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
List<TenderModel>? tenders TendersData? data, ErrorModel? error, String? message, bool? success
}); });
$TendersDataCopyWith<$Res>? get data;$ErrorModelCopyWith<$Res>? get error;
} }
/// @nodoc /// @nodoc
@@ -65,13 +65,40 @@ class _$TendersResponseCopyWithImpl<$Res>
/// Create a copy of TendersResponse /// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? tenders = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? data = freezed,Object? error = freezed,Object? message = freezed,Object? success = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
tenders: freezed == tenders ? _self.tenders : tenders // ignore: cast_nullable_to_non_nullable data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
as List<TenderModel>?, as TendersData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as ErrorModel?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as bool?,
)); ));
} }
/// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TendersDataCopyWith<$Res>? get data {
if (_self.data == null) {
return null;
}
return $TendersDataCopyWith<$Res>(_self.data!, (value) {
return _then(_self.copyWith(data: value));
});
}/// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
});
}
} }
@@ -153,10 +180,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<TenderModel>? tenders)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( TendersData? data, ErrorModel? error, String? message, bool? success)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _TendersResponse() when $default != null: case _TendersResponse() when $default != null:
return $default(_that.tenders);case _: return $default(_that.data,_that.error,_that.message,_that.success);case _:
return orElse(); return orElse();
} }
@@ -174,10 +201,10 @@ return $default(_that.tenders);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<TenderModel>? tenders) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( TendersData? data, ErrorModel? error, String? message, bool? success) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _TendersResponse(): case _TendersResponse():
return $default(_that.tenders);case _: return $default(_that.data,_that.error,_that.message,_that.success);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -194,10 +221,10 @@ return $default(_that.tenders);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<TenderModel>? tenders)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( TendersData? data, ErrorModel? error, String? message, bool? success)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _TendersResponse() when $default != null: case _TendersResponse() when $default != null:
return $default(_that.tenders);case _: return $default(_that.data,_that.error,_that.message,_that.success);case _:
return null; return null;
} }
@@ -209,18 +236,13 @@ return $default(_that.tenders);case _:
@JsonSerializable() @JsonSerializable()
class _TendersResponse implements TendersResponse { class _TendersResponse implements TendersResponse {
const _TendersResponse({required final List<TenderModel>? tenders}): _tenders = tenders; const _TendersResponse({required this.data, required this.error, required this.message, required this.success});
factory _TendersResponse.fromJson(Map<String, dynamic> json) => _$TendersResponseFromJson(json); factory _TendersResponse.fromJson(Map<String, dynamic> json) => _$TendersResponseFromJson(json);
final List<TenderModel>? _tenders; @override final TendersData? data;
@override List<TenderModel>? get tenders { @override final ErrorModel? error;
final value = _tenders; @override final String? message;
if (value == null) return null; @override final bool? success;
if (_tenders is EqualUnmodifiableListView) return _tenders;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(value);
}
/// Create a copy of TendersResponse /// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -235,16 +257,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TendersResponse&&const DeepCollectionEquality().equals(other._tenders, _tenders)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _TendersResponse&&(identical(other.data, data) || other.data == data)&&(identical(other.error, error) || other.error == error)&&(identical(other.message, message) || other.message == message)&&(identical(other.success, success) || other.success == success));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_tenders)); int get hashCode => Object.hash(runtimeType,data,error,message,success);
@override @override
String toString() { String toString() {
return 'TendersResponse(tenders: $tenders)'; return 'TendersResponse(data: $data, error: $error, message: $message, success: $success)';
} }
@@ -255,11 +277,11 @@ abstract mixin class _$TendersResponseCopyWith<$Res> implements $TendersResponse
factory _$TendersResponseCopyWith(_TendersResponse value, $Res Function(_TendersResponse) _then) = __$TendersResponseCopyWithImpl; factory _$TendersResponseCopyWith(_TendersResponse value, $Res Function(_TendersResponse) _then) = __$TendersResponseCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
List<TenderModel>? tenders TendersData? data, ErrorModel? error, String? message, bool? success
}); });
@override $TendersDataCopyWith<$Res>? get data;@override $ErrorModelCopyWith<$Res>? get error;
} }
/// @nodoc /// @nodoc
@@ -272,14 +294,41 @@ class __$TendersResponseCopyWithImpl<$Res>
/// Create a copy of TendersResponse /// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? tenders = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? data = freezed,Object? error = freezed,Object? message = freezed,Object? success = freezed,}) {
return _then(_TendersResponse( return _then(_TendersResponse(
tenders: freezed == tenders ? _self._tenders : tenders // ignore: cast_nullable_to_non_nullable data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
as List<TenderModel>?, as TendersData?,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
as ErrorModel?,message: freezed == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String?,success: freezed == success ? _self.success : success // ignore: cast_nullable_to_non_nullable
as bool?,
)); ));
} }
/// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TendersDataCopyWith<$Res>? get data {
if (_self.data == null) {
return null;
}
return $TendersDataCopyWith<$Res>(_self.data!, (value) {
return _then(_self.copyWith(data: value));
});
}/// Create a copy of TendersResponse
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ErrorModelCopyWith<$Res>? get error {
if (_self.error == null) {
return null;
}
return $ErrorModelCopyWith<$Res>(_self.error!, (value) {
return _then(_self.copyWith(error: value));
});
}
} }
// dart format on // dart format on
@@ -8,11 +8,22 @@ part of 'tenders_response.dart';
_TendersResponse _$TendersResponseFromJson(Map<String, dynamic> json) => _TendersResponse _$TendersResponseFromJson(Map<String, dynamic> json) =>
_TendersResponse( _TendersResponse(
tenders: data:
(json['tenders'] as List<dynamic>?) json['data'] == null
?.map((e) => TenderModel.fromJson(e as Map<String, dynamic>)) ? null
.toList(), : TendersData.fromJson(json['data'] as Map<String, dynamic>),
error:
json['error'] == null
? null
: ErrorModel.fromJson(json['error'] as Map<String, dynamic>),
message: json['message'] as String?,
success: json['success'] as bool?,
); );
Map<String, dynamic> _$TendersResponseToJson(_TendersResponse instance) => Map<String, dynamic> _$TendersResponseToJson(_TendersResponse instance) =>
<String, dynamic>{'tenders': instance.tenders}; <String, dynamic>{
'data': instance.data,
'error': instance.error,
'message': instance.message,
'success': instance.success,
};
+7 -19
View File
@@ -1,9 +1,4 @@
import 'dart:convert';
import 'package:tm_app/core/utils/logger.dart';
import 'package:tm_app/core/utils/result.dart'; import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/services/mock_data/tender_detail_mock.dart';
import 'package:tm_app/data/services/model/tender_detail_request/tender_detail_request.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart'; import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart';
import '../../core/network/network_manager.dart'; import '../../core/network/network_manager.dart';
@@ -14,21 +9,14 @@ class TenderDetailService {
final NetworkManager _networkManager; final NetworkManager _networkManager;
Future<Result<TenderDetailResponseModel>> getTenderDetail({ Future<Result<TenderDetailResponseModel>> getTenderDetails({
required TenderDetailRequest request, required String tenderId,
}) async { }) async {
try { final result = await _networkManager.makeRequest(
await Future.delayed(const Duration(seconds: 2)); '/api/v1/tenders/details/$tenderId',
appLogger.info('get tender detail success'); method: 'GET',
(json) => TenderDetailResponseModel.fromJson(json),
return Result.ok(
TenderDetailResponseModel.fromJson(
jsonDecode(tenderDetailMockData)['data'],
),
); );
} catch (e, stackTrace) { return result;
appLogger.error('get tender detail failed: $e', stackTrace: stackTrace);
return Result.error(Exception(e));
}
} }
} }
+7 -24
View File
@@ -1,14 +1,10 @@
import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:tm_app/core/utils/logger.dart'; import 'package:tm_app/core/utils/logger.dart';
import 'package:tm_app/core/utils/result.dart'; import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/services/mock_data/tenders_mock_data.dart';
import 'package:tm_app/data/services/model/tenders/tender_dislike_response/tender_dislike_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_dislike_response/tender_dislike_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_like_response/tender_like_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_like_response/tender_like_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_reject_response/tender_reject_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_reject_response/tender_reject_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_submit_response/tender_submit_response.dart'; import 'package:tm_app/data/services/model/tenders/tender_submit_response/tender_submit_response.dart';
import 'package:tm_app/data/services/model/tenders/tenders_request/tenders_request.dart';
import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart'; import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart';
import '../../core/network/network_manager.dart'; import '../../core/network/network_manager.dart';
@@ -18,26 +14,13 @@ class TendersService {
: _networkManager = networkManager; : _networkManager = networkManager;
final NetworkManager _networkManager; final NetworkManager _networkManager;
Future<Result<TendersResponse>> getTenders({ Future<Result<TendersResponse>> getTenders() async {
TendersRequest? tendersRequestModel, final result = await _networkManager.makeRequest(
}) async { '/api/v1/tenders',
try { method: 'GET',
// final result = await _networkManager.makeRequest( (json) => TendersResponse.fromJson(json),
// '/api/v1/tenders', );
// (json) => TendersResponse.fromJson(json), return result;
// method: 'GET',
// );
await Future.delayed(Duration(seconds: 2));
appLogger.info('get tenders success');
// TODO: will change when api is ready
return Result.ok(TendersResponse.fromJson(jsonDecode(tendersMockData)));
} on DioException catch (e) {
appLogger.error('get tenders failed: $e');
return Result.error(e);
} on Exception catch (e, stackTrace) {
appLogger.error('get tenders failed: $e', stackTrace: stackTrace);
return Result.error(Exception(e));
}
} }
Future<Result<TenderLikeResponse>> likeTender() async { Future<Result<TenderLikeResponse>> likeTender() async {
+4 -5
View File
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:tm_app/data/services/model/customer/customer.dart';
import '../core/utils/result.dart'; import '../core/utils/result.dart';
import '../data/repositories/auth_repository.dart'; import '../data/repositories/auth_repository.dart';
import '../data/services/model/login_response/login_response_model.dart'; import '../data/services/model/login_response/login_response_model.dart';
import '../data/services/model/logout_response/logout_response.dart'; import '../data/services/model/logout_response/logout_response.dart';
import '../data/services/model/user/user.dart';
class AuthViewModel with ChangeNotifier { class AuthViewModel with ChangeNotifier {
final AuthRepository _authRepository; final AuthRepository _authRepository;
@@ -30,11 +30,11 @@ class AuthViewModel with ChangeNotifier {
// Auth state // Auth state
bool _isLoading = false; bool _isLoading = false;
String? _errorMessage; String? _errorMessage;
User? _loggedInUser; Customer? _loggedInUser;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
String? get errorMessage => _errorMessage; String? get errorMessage => _errorMessage;
User? get loggedInUser => _loggedInUser; Customer? get loggedInUser => _loggedInUser;
void togglePasswordVisibility() { void togglePasswordVisibility() {
_obscurePassword = !_obscurePassword; _obscurePassword = !_obscurePassword;
@@ -57,8 +57,7 @@ class AuthViewModel with ChangeNotifier {
switch (result) { switch (result) {
case Ok<LoginResponseModel>(): case Ok<LoginResponseModel>():
_loggedInUser = result.value.data.user; _loggedInUser = result.value.data.customer;
break; break;
case Error<LoginResponseModel>(): case Error<LoginResponseModel>():
_errorMessage = result.error.toString(); _errorMessage = result.error.toString();
+6 -13
View File
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:tm_app/core/utils/result.dart'; import 'package:tm_app/core/utils/result.dart';
import 'package:tm_app/data/repositories/tender_detail_repository.dart'; import 'package:tm_app/data/repositories/tender_detail_repository.dart';
import 'package:tm_app/data/services/model/tender_detail_request/tender_detail_request.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart'; import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart';
class TenderDetailViewModel with ChangeNotifier { class TenderDetailViewModel with ChangeNotifier {
@@ -9,32 +9,25 @@ class TenderDetailViewModel with ChangeNotifier {
TenderDetailViewModel({ TenderDetailViewModel({
required TenderDetailRepository tenderDetailRepository, required TenderDetailRepository tenderDetailRepository,
}) : _tenderDetailRepository = tenderDetailRepository { }) : _tenderDetailRepository = tenderDetailRepository;
WidgetsBinding.instance.addPostFrameCallback((_) {
getTenderDetail(id: 'JNDFKMDV-100JF');
});
}
bool _isLoading = false; bool _isLoading = false;
String? _errorMessage; String? _errorMessage;
TenderDetailResponseModel? _tenderDetail; TenderData? _tenderDetail;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
String? get errorMessage => _errorMessage; String? get errorMessage => _errorMessage;
TenderDetailResponseModel? get tenderDetail => _tenderDetail; TenderData? get tenderDetail => _tenderDetail;
Future<void> getTenderDetail({required String id}) async { Future<void> getTenderDetail({required String id}) async {
_isLoading = true; _isLoading = true;
_errorMessage = null; _errorMessage = null;
notifyListeners(); notifyListeners();
final request = TenderDetailRequest(id: id); final result = await _tenderDetailRepository.getTenderDetail(tenderId: id);
final result = await _tenderDetailRepository.getTenderDetail(
request: request,
);
switch (result) { switch (result) {
case Ok<TenderDetailResponseModel>(): case Ok<TenderDetailResponseModel>():
_tenderDetail = result.value; _tenderDetail = result.value.data;
break; break;
case Error<TenderDetailResponseModel>(): case Error<TenderDetailResponseModel>():
_errorMessage = result.error.toString(); _errorMessage = result.error.toString();
+111 -115
View File
@@ -1,11 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:tm_app/data/repositories/tenders_repository.dart'; import 'package:tm_app/data/repositories/tenders_repository.dart';
import 'package:tm_app/data/services/model/tender/tender_model.dart'; import 'package:tm_app/data/services/model/tender/tender_model.dart';
import 'package:tm_app/data/services/model/tenders/tender_dislike_response/tender_dislike_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_like_response/tender_like_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_reject_response/tender_reject_response.dart';
import 'package:tm_app/data/services/model/tenders/tender_submit_response/tender_submit_response.dart';
import 'package:tm_app/data/services/model/tenders/tenders_request/tenders_request.dart';
import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart'; import 'package:tm_app/data/services/model/tenders/tenders_response/tenders_response.dart';
import '../core/utils/result.dart'; import '../core/utils/result.dart';
@@ -35,10 +30,7 @@ class TendersViewModel with ChangeNotifier {
_errorMessage = null; _errorMessage = null;
notifyListeners(); notifyListeners();
final request = TendersRequest(id: 'JNDFKMDV-100JF'); final result = await _tendersRepository.getTenders();
final result = await _tendersRepository.getTenders(
tendersRequestModel: request,
);
switch (result) { switch (result) {
case Ok<TendersResponse>(): case Ok<TendersResponse>():
_tendersResponse = result.value; _tendersResponse = result.value;
@@ -61,98 +53,102 @@ class TendersViewModel with ChangeNotifier {
bool? rejected, bool? rejected,
bool? submitted, bool? submitted,
}) { }) {
if (_tendersResponse?.tenders != null) { // if (_tendersResponse?.tendersData?.tenders != null) {
final updatedTenders = // final updatedTenders =
_tendersResponse!.tenders!.map((element) { // _tendersResponse!.tendersData!.tenders!.map((element) {
if (element.tenderId == tenderId) { // if (element.tenderId == tenderId) {
return element.copyWith( // return element.copyWith(
liked: liked, // liked: liked,
disliked: disliked, // disliked: disliked,
rejected: rejected, // rejected: rejected,
submitted: submitted, // submitted: submitted,
); // );
} // }
return element; // return element;
}).toList(); // }).toList();
_tendersResponse = _tendersResponse!.copyWith(tenders: updatedTenders); // _tendersResponse = _tendersResponse!.copyWith(
} // tendersData: _tendersResponse!.tendersData!.copyWith(
// tenders: updatedTenders,
// ),
// );
// }
} }
/// Sets a tender as liked /// Sets a tender as liked
Future<void> markLiked(TenderModel tender) async { Future<void> markLiked(TenderModel tender) async {
_updateTenderState( // _updateTenderState(
tender.tenderId!, // tender.id!,
liked: true, // liked: true,
disliked: false, // disliked: false,
rejected: false, // rejected: false,
submitted: tender.submitted, // submitted: tender.submitted,
); // );
notifyListeners(); // notifyListeners();
final result = await _tendersRepository.likeTender(); // final result = await _tendersRepository.likeTender();
switch (result) { // switch (result) {
case Ok<TenderLikeResponse>(): // case Ok<TenderLikeResponse>():
break; // break;
case Error<TenderLikeResponse>(): // case Error<TenderLikeResponse>():
break; // break;
} // }
} }
/// Sets a tender as disliked /// Sets a tender as disliked
Future<void> markDisliked(TenderModel tender) async { Future<void> markDisliked(TenderModel tender) async {
_updateTenderState( // _updateTenderState(
tender.tenderId!, // tender.tenderId!,
disliked: true, // disliked: true,
liked: false, // liked: false,
rejected: tender.rejected, // rejected: tender.rejected,
submitted: false, // submitted: false,
); // );
notifyListeners(); // notifyListeners();
final result = await _tendersRepository.dislikeTender(); // final result = await _tendersRepository.dislikeTender();
switch (result) { // switch (result) {
case Ok<TenderDislikeResponse>(): // case Ok<TenderDislikeResponse>():
break; // break;
case Error<TenderDislikeResponse>(): // case Error<TenderDislikeResponse>():
break; // break;
} // }
} }
/// Sets a tender as rejected /// Sets a tender as rejected
Future<void> markRejected(TenderModel tender) async { Future<void> markRejected(TenderModel tender) async {
_updateTenderState( // _updateTenderState(
tender.tenderId!, // tender.tenderId!,
rejected: true, // rejected: true,
liked: false, // liked: false,
disliked: tender.disliked, // disliked: tender.disliked,
submitted: false, // submitted: false,
); // );
notifyListeners(); // notifyListeners();
final result = await _tendersRepository.rejectTender(); // final result = await _tendersRepository.rejectTender();
switch (result) { // switch (result) {
case Ok<TenderRejectResponse>(): // case Ok<TenderRejectResponse>():
break; // break;
case Error<TenderRejectResponse>(): // case Error<TenderRejectResponse>():
break; // break;
} // }
} }
/// Sets a tender as submitted /// Sets a tender as submitted
Future<void> markSubmitted(TenderModel tender) async { Future<void> markSubmitted(TenderModel tender) async {
_updateTenderState( // _updateTenderState(
tender.tenderId!, // tender.tenderId!,
submitted: true, // submitted: true,
liked: tender.liked, // liked: tender.liked,
disliked: false, // disliked: false,
rejected: false, // rejected: false,
); // );
notifyListeners(); // notifyListeners();
final result = await _tendersRepository.submitTender(); // final result = await _tendersRepository.submitTender();
switch (result) { // switch (result) {
case Ok<TenderSubmitResponse>(): // case Ok<TenderSubmitResponse>():
break; // break;
case Error<TenderSubmitResponse>(): // case Error<TenderSubmitResponse>():
break; // break;
} // }
} }
/// Clears a specific state for a tender /// Clears a specific state for a tender
@@ -163,52 +159,52 @@ class TendersViewModel with ChangeNotifier {
bool? isRejected, bool? isRejected,
bool? isSubmitted, bool? isSubmitted,
}) { }) {
_updateTenderState( // _updateTenderState(
tenderModel.tenderId!, // tenderModel.tenderId!,
liked: isLiked ?? tenderModel.liked, // liked: isLiked ?? tenderModel.liked,
disliked: isDisliked ?? tenderModel.disliked, // disliked: isDisliked ?? tenderModel.disliked,
rejected: isRejected ?? tenderModel.rejected, // rejected: isRejected ?? tenderModel.rejected,
submitted: isSubmitted ?? tenderModel.submitted, // submitted: isSubmitted ?? tenderModel.submitted,
); // );
} }
/// Toggles like state for a tender /// Toggles like state for a tender
void toggleLike(TenderModel tender) { void toggleLike(TenderModel tender) {
if (tender.liked == true) { // if (tender.liked == true) {
clearTenderState(tender, isLiked: false); // clearTenderState(tender, isLiked: false);
} else { // } else {
markLiked(tender); // markLiked(tender);
} // }
notifyListeners(); // notifyListeners();
} }
/// Toggles dislike state for a tender /// Toggles dislike state for a tender
void toggleDislike(TenderModel tender) { void toggleDislike(TenderModel tender) {
if (tender.disliked == true) { // if (tender.disliked == true) {
clearTenderState(tender, isDisliked: false); // clearTenderState(tender, isDisliked: false);
} else { // } else {
markDisliked(tender); // markDisliked(tender);
} // }
notifyListeners(); // notifyListeners();
} }
/// Toggles reject state for a tender /// Toggles reject state for a tender
void toggleReject(TenderModel tender) { void toggleReject(TenderModel tender) {
if (tender.rejected == true) { // if (tender.rejected == true) {
clearTenderState(tender, isRejected: false); // clearTenderState(tender, isRejected: false);
} else { // } else {
markRejected(tender); // markRejected(tender);
} // }
notifyListeners(); // notifyListeners();
} }
/// Toggles submit state for a tender /// Toggles submit state for a tender
void toggleSubmit(TenderModel tender) { void toggleSubmit(TenderModel tender) {
if (tender.submitted == true) { // if (tender.submitted == true) {
clearTenderState(tender, isSubmitted: false); // clearTenderState(tender, isSubmitted: false);
} else { // } else {
markSubmitted(tender); // markSubmitted(tender);
} // }
notifyListeners(); // notifyListeners();
} }
} }
+24 -5
View File
@@ -1,20 +1,39 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/view_models/tender_detail_view_model.dart';
import 'package:tm_app/views/detail/pages/detail_desktop_page.dart'; import 'package:tm_app/views/detail/pages/detail_desktop_page.dart';
import 'package:tm_app/views/detail/pages/detail_mobile_page.dart'; import 'package:tm_app/views/detail/pages/detail_mobile_page.dart';
import 'package:tm_app/views/detail/pages/detail_tablet_page.dart'; import 'package:tm_app/views/detail/pages/detail_tablet_page.dart';
import 'package:tm_app/views/shared/responsive_builder.dart'; import 'package:tm_app/views/shared/responsive_builder.dart';
class TenderDetailScreen extends StatelessWidget { class TenderDetailScreen extends StatefulWidget {
const TenderDetailScreen({super.key}); const TenderDetailScreen({required this.tenderId, super.key});
final String tenderId;
@override
State<TenderDetailScreen> createState() => _TenderDetailScreenState();
}
class _TenderDetailScreenState extends State<TenderDetailScreen> {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
context.read<TenderDetailViewModel>().getTenderDetail(
id: widget.tenderId,
);
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SizeConfig.init(context); SizeConfig.init(context);
return ResponsiveBuilder( return ResponsiveBuilder(
mobile: TenderDetailMobilePage(tenderId: 'JNDFKMDV-100JF'), mobile: TenderDetailMobilePage(tenderId: widget.tenderId),
tablet: TenderDetailTabletPage(tenderId: 'JNDFKMDV-100JF'), tablet: TenderDetailTabletPage(tenderId: widget.tenderId),
desktop: TenderDetailDesktopPage(tenderId: 'JNDFKMDV-100JF'), desktop: TenderDetailDesktopPage(tenderId: widget.tenderId),
); );
} }
} }
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:tm_app/core/constants/strings.dart'; import 'package:tm_app/core/constants/strings.dart';
import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
class TenderDetailCard extends StatelessWidget { class TenderDetailCard extends StatelessWidget {
final TenderDetailResponseModel detail; final TenderData detail;
const TenderDetailCard({required this.detail, super.key}); const TenderDetailCard({required this.detail, super.key});
@@ -1,7 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import 'package:tm_app/views/detail/widgets/status_tag.dart'; import 'package:tm_app/views/detail/widgets/status_tag.dart';
import 'package:tm_app/views/detail/widgets/tender_detail_info_section.dart'; import 'package:tm_app/views/detail/widgets/tender_detail_info_section.dart';
import 'package:tm_app/views/detail/widgets/tender_document_section.dart'; import 'package:tm_app/views/detail/widgets/tender_document_section.dart';
@@ -9,9 +10,13 @@ import 'package:tm_app/views/detail/widgets/tender_location_section.dart';
class TenderDetailHeader extends StatelessWidget { class TenderDetailHeader extends StatelessWidget {
final bool isScreenBig; final bool isScreenBig;
final TenderDetailResponseModel detail; final TenderData detail;
const TenderDetailHeader({required this.isScreenBig, required this.detail, super.key}); const TenderDetailHeader({
required this.isScreenBig,
required this.detail,
super.key,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -29,7 +34,7 @@ class TenderDetailHeader extends StatelessWidget {
SizedBox(height: 12.0.h()), SizedBox(height: 12.0.h()),
_buildTitle(), _buildTitle(),
SizedBox(height: 10.0.h()), SizedBox(height: 10.0.h()),
Divider(color: AppColors.grey20,), Divider(color: AppColors.grey20),
SizedBox(height: 5.0.h()), SizedBox(height: 5.0.h()),
TenderDetailInfoSection(isScreenBig: isScreenBig, detail: detail), TenderDetailInfoSection(isScreenBig: isScreenBig, detail: detail),
TenderLocationSection(detail: detail), TenderLocationSection(detail: detail),
@@ -44,7 +49,7 @@ class TenderDetailHeader extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
detail.date ?? '', unixToDate(detail.publicationDate),
style: TextStyle( style: TextStyle(
color: AppColors.grey60, color: AppColors.grey60,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -68,3 +73,14 @@ class TenderDetailHeader extends StatelessWidget {
), ),
); );
} }
String unixToDate(int? unixTimestamp, {String format = 'yyyy-MM-dd'}) {
if (unixTimestamp == null) return '';
// Convert seconds to milliseconds if needed
int timestampInMs =
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampInMs);
return DateFormat(format).format(dateTime);
}
@@ -1,43 +1,44 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:tm_app/core/constants/strings.dart'; import 'package:tm_app/core/constants/strings.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import 'package:tm_app/views/detail/widgets/deadline_item.dart'; import 'package:tm_app/views/detail/widgets/deadline_item.dart';
import 'package:tm_app/views/detail/widgets/info_item.dart'; import 'package:tm_app/views/detail/widgets/info_item.dart';
class TenderDetailInfoSection extends StatelessWidget { class TenderDetailInfoSection extends StatelessWidget {
final bool isScreenBig; final bool isScreenBig;
final TenderDetailResponseModel detail; final TenderData detail;
const TenderDetailInfoSection({required this.isScreenBig, required this.detail, super.key}); const TenderDetailInfoSection({
required this.isScreenBig,
required this.detail,
super.key,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
InfoItem( InfoItem(title: AppStrings.tenderIdLabel, value: detail.id ?? ''),
title: AppStrings.tenderIdLabel,
value: detail.id ?? '',
),
DeadlineItem( DeadlineItem(
title: AppStrings.tenderDeadlineLabel, title: AppStrings.tenderDeadlineLabel,
approvalText: AppStrings.tenderApprovalText, approvalText: AppStrings.tenderApprovalText,
approvalDate: detail.approvalDate ?? '', approvalDate: '',
submissionText: AppStrings.tenderSubmissionText, submissionText: AppStrings.tenderSubmissionText,
submissionDate: detail.submissionDate ?? '', submissionDate: '',
isScreenBig: isScreenBig, isScreenBig: isScreenBig,
), ),
InfoItem( InfoItem(
title: AppStrings.tenderClientLabel, title: AppStrings.tenderClientLabel,
value: detail.client ?? '', value: detail.buyerOrganization!.name ?? '',
), ),
InfoItem( InfoItem(
title: AppStrings.tenderDeliveryLocationsLabel, title: AppStrings.tenderDeliveryLocationsLabel,
value: detail.deliveryLocation ?? '', value: detail.countryCode ?? '',
), ),
InfoItem( InfoItem(
title: AppStrings.tenderReferenceNumberLabel, title: AppStrings.tenderReferenceNumberLabel,
value: detail.referenceNumber ?? '', value: detail.noticePublicationId ?? '',
), ),
], ],
); );
@@ -3,27 +3,24 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:tm_app/core/constants/assets.dart'; import 'package:tm_app/core/constants/assets.dart';
import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
class TenderDocumentSection extends StatelessWidget {
final TenderDetailResponseModel detail;
const TenderDocumentSection({super.key, required this.detail}); class TenderDocumentSection extends StatelessWidget {
final TenderData detail;
const TenderDocumentSection({required this.detail, super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () { onTap: () {},
if (detail.documentUrl != null) {
//launchUrl(Uri.parse(detail.documentUrl!));
}
},
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SvgPicture.asset(AssetsManager.export), SvgPicture.asset(AssetsManager.export),
SizedBox(height: 6.0.h()), SizedBox(height: 6.0.h()),
Text( Text(
detail.documentName ?? '', '',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 16.0.sp(), fontSize: 16.0.sp(),
@@ -4,10 +4,11 @@ import 'package:tm_app/core/constants/assets.dart';
import 'package:tm_app/core/constants/strings.dart'; import 'package:tm_app/core/constants/strings.dart';
import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart';
import '../../../data/services/model/tender_data/tender_data.dart';
class TenderLocationSection extends StatelessWidget { class TenderLocationSection extends StatelessWidget {
final TenderDetailResponseModel detail; final TenderData detail;
const TenderLocationSection({required this.detail, super.key}); const TenderLocationSection({required this.detail, super.key});
@@ -21,7 +22,7 @@ class TenderLocationSection extends StatelessWidget {
SizedBox( SizedBox(
height: 45.0.h(), height: 45.0.h(),
child: Text( child: Text(
detail.locationTitle ?? '', '',
style: TextStyle( style: TextStyle(
color: AppColors.grey80, color: AppColors.grey80,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@@ -38,7 +39,7 @@ class TenderLocationSection extends StatelessWidget {
), ),
SizedBox(width: 4.0.w()), SizedBox(width: 4.0.w()),
Text( Text(
detail.country ?? '', detail.countryCode ?? '',
style: TextStyle( style: TextStyle(
color: AppColors.grey70, color: AppColors.grey70,
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
@@ -47,7 +48,7 @@ class TenderLocationSection extends StatelessWidget {
), ),
SizedBox(width: 4.0.w()), SizedBox(width: 4.0.w()),
Image.asset( Image.asset(
detail.flagAsset ?? AssetsManager.seFlag, AssetsManager.seFlag,
height: 20.0.h(), height: 20.0.h(),
width: 20.0.w(), width: 20.0.w(),
), ),
@@ -60,7 +61,7 @@ class TenderLocationSection extends StatelessWidget {
), ),
SizedBox(height: 8.0.h()), SizedBox(height: 8.0.h()),
Text( Text(
detail.locationDescription ?? '', detail.description ?? '',
style: TextStyle(fontWeight: FontWeight.w400, fontSize: 14.0.sp()), style: TextStyle(fontWeight: FontWeight.w400, fontSize: 14.0.sp()),
), ),
SizedBox(height: 16.0.h()), SizedBox(height: 16.0.h()),
+1 -1
View File
@@ -100,7 +100,7 @@ class DesktopHomePage extends StatelessWidget {
width: 178, width: 178,
height: 148, height: 148,
onTap: () { onTap: () {
YourTendersRouteData().push(context); // YourTendersRouteData().push(context);
}, },
), ),
SizedBox(width: 10), SizedBox(width: 10),
+64
View File
@@ -27,6 +27,7 @@ class TendersListItem extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
<<<<<<< HEAD
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: Text( child: Text(
@@ -53,6 +54,30 @@ class TendersListItem extends StatelessWidget {
children: [ children: [
Text( Text(
'${AppStrings.tenderDeadline} :', '${AppStrings.tenderDeadline} :',
=======
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
// tender.createdTime ?? '',
'',
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey60,
),
),
Container(
width: 91.0.w(),
height: 24.0.h(),
decoration: BoxDecoration(
color: AppColors.green20,
borderRadius: BorderRadius.circular(8),
),
alignment: Alignment.center,
child: Text(
'',
>>>>>>> tender_tender_detail
style: TextStyle( style: TextStyle(
fontSize: 15.0.sp(), fontSize: 15.0.sp(),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@@ -72,7 +97,11 @@ class TendersListItem extends StatelessWidget {
), ),
SizedBox(height: 12.0.h()), SizedBox(height: 12.0.h()),
Text( Text(
<<<<<<< HEAD
tender.title!, tender.title!,
=======
'',
>>>>>>> tender_tender_detail
style: TextStyle( style: TextStyle(
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
fontSize: 16.0.sp(), fontSize: 16.0.sp(),
@@ -81,6 +110,7 @@ class TendersListItem extends StatelessWidget {
), ),
), ),
SizedBox(height: 8.0.h()), SizedBox(height: 8.0.h()),
<<<<<<< HEAD
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: Text( child: Text(
@@ -93,6 +123,16 @@ class TendersListItem extends StatelessWidget {
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: AppColors.grey70, color: AppColors.grey70,
), ),
=======
Text(
'',
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey70,
>>>>>>> tender_tender_detail
), ),
), ),
SizedBox(height: 18.0.h()), SizedBox(height: 18.0.h()),
@@ -104,7 +144,11 @@ class TendersListItem extends StatelessWidget {
SvgPicture.asset(AssetsManager.location), SvgPicture.asset(AssetsManager.location),
SizedBox(width: 1.0.w()), SizedBox(width: 1.0.w()),
Text( Text(
<<<<<<< HEAD
tender.countryCode!, tender.countryCode!,
=======
'',
>>>>>>> tender_tender_detail
style: TextStyle( style: TextStyle(
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -118,6 +162,7 @@ class TendersListItem extends StatelessWidget {
child: Image.asset(AssetsManager.seFlag, fit: BoxFit.cover), child: Image.asset(AssetsManager.seFlag, fit: BoxFit.cover),
), ),
Spacer(), Spacer(),
<<<<<<< HEAD
// Container( // Container(
// width: 96.0.w(), // width: 96.0.w(),
// height: 24.0.h(), // height: 24.0.h(),
@@ -135,6 +180,25 @@ class TendersListItem extends StatelessWidget {
// ), // ),
// ), // ),
// ), // ),
=======
Container(
width: 96.0.w(),
height: 24.0.h(),
decoration: BoxDecoration(
color: AppColors.grey30,
borderRadius: BorderRadius.circular(88),
),
alignment: Alignment.center,
child: Text(
'',
style: TextStyle(
fontSize: 12.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.grey60,
),
),
),
>>>>>>> tender_tender_detail
], ],
), ),
], ],
+1 -1
View File
@@ -33,7 +33,7 @@ class DesktopTendersPage extends StatelessWidget {
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 24.0.h()), padding: EdgeInsets.symmetric(vertical: 24.0.h()),
child: MainTendersSlider( child: MainTendersSlider(
tenders: viewModel.tendersResponse?.tenders ?? [], tenders: viewModel.tendersResponse?.data?.tenders ?? [],
isDesktop: true, isDesktop: true,
), ),
), ),
+1 -1
View File
@@ -30,7 +30,7 @@ class MobileTendersPage extends StatelessWidget {
return Padding( return Padding(
padding: EdgeInsets.symmetric(vertical: 24.0.h()), padding: EdgeInsets.symmetric(vertical: 24.0.h()),
child: MainTendersSlider( child: MainTendersSlider(
tenders: viewModel.tendersResponse?.tenders ?? [], tenders: viewModel.tendersResponse?.data?.tenders ?? [],
), ),
); );
}, },
+1 -1
View File
@@ -28,7 +28,7 @@ class TabletTendersPage extends StatelessWidget {
return Padding( return Padding(
padding: EdgeInsets.only(right: 24.0.w(), top: 128.0.h()), padding: EdgeInsets.only(right: 24.0.w(), top: 128.0.h()),
child: MainTendersSlider( child: MainTendersSlider(
tenders: viewModel.tendersResponse?.tenders ?? [], tenders: viewModel.tendersResponse?.data?.tenders ?? [],
), ),
); );
}, },
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/data/services/model/tender/tender_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import '../../../core/constants/assets.dart'; import '../../../core/constants/assets.dart';
import '../../../core/utils/size_config.dart'; import '../../../core/utils/size_config.dart';
@@ -14,7 +14,7 @@ class MainTendersSlider extends StatefulWidget {
this.isDesktop = false, this.isDesktop = false,
}); });
final bool isDesktop; final bool isDesktop;
final List<TenderModel> tenders; final List<TenderData> tenders;
@override @override
State<MainTendersSlider> createState() => _MainTendersSliderState(); State<MainTendersSlider> createState() => _MainTendersSliderState();
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:tm_app/core/constants/strings.dart'; import 'package:tm_app/core/constants/strings.dart';
import 'package:tm_app/data/services/model/tender/tender_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import 'package:tm_app/view_models/tenders_view_model.dart'; import 'package:tm_app/view_models/tenders_view_model.dart';
import '../../../core/constants/assets.dart'; import '../../../core/constants/assets.dart';
@@ -10,7 +10,7 @@ import '../../../core/theme/colors.dart';
import '../../../core/utils/size_config.dart'; import '../../../core/utils/size_config.dart';
class TenderActionButtonsRow extends StatelessWidget { class TenderActionButtonsRow extends StatelessWidget {
final TenderModel tender; final TenderData tender;
final bool isDesktop; final bool isDesktop;
const TenderActionButtonsRow({ const TenderActionButtonsRow({
@@ -48,7 +48,7 @@ class TenderActionButtonsRow extends StatelessWidget {
child: InkWell( child: InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
onTap: () { onTap: () {
viewModel.toggleReject(tender); // viewModel.toggleReject(tender);
}, },
child: Column( child: Column(
children: [ children: [
@@ -59,9 +59,10 @@ class TenderActionButtonsRow extends StatelessWidget {
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border: Border.all(
color: color:
tender.rejected ?? false // tender.rejected ?? false
? AppColors.errorColor // ? AppColors.errorColor
: AppColors.grey60, // :
AppColors.grey60,
width: 1.5.w(), width: 1.5.w(),
), ),
), ),
@@ -69,9 +70,10 @@ class TenderActionButtonsRow extends StatelessWidget {
child: Icon( child: Icon(
Icons.close, Icons.close,
color: color:
tender.rejected ?? false // tender.rejected ?? false
? AppColors.errorColor // ? AppColors.errorColor
: AppColors.grey60, // :
AppColors.grey60,
size: 16, size: 16,
), ),
), ),
@@ -83,9 +85,10 @@ class TenderActionButtonsRow extends StatelessWidget {
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: color:
tender.rejected ?? false // tender.rejected ?? false
? AppColors.errorColor // ? AppColors.errorColor
: AppColors.grey60, // :
AppColors.grey60,
), ),
), ),
], ],
@@ -100,7 +103,7 @@ class TenderActionButtonsRow extends StatelessWidget {
child: InkWell( child: InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
onTap: () { onTap: () {
viewModel.toggleSubmit(tender); // viewModel.toggleSubmit(tender);
}, },
child: Column( child: Column(
children: [ children: [
@@ -111,9 +114,10 @@ class TenderActionButtonsRow extends StatelessWidget {
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border: Border.all(
color: color:
tender.submitted ?? false // tender.submitted ?? false
? AppColors.successColor // ? AppColors.successColor
: AppColors.grey60, // :
AppColors.grey60,
width: 1.5.w(), width: 1.5.w(),
), ),
), ),
@@ -121,9 +125,10 @@ class TenderActionButtonsRow extends StatelessWidget {
child: SvgPicture.asset( child: SvgPicture.asset(
AssetsManager.tick, AssetsManager.tick,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
tender.submitted ?? false // tender.submitted ?? false
? AppColors.successColor // ? AppColors.successColor
: AppColors.grey60, // :
AppColors.grey60,
BlendMode.srcATop, BlendMode.srcATop,
), ),
), ),
@@ -136,9 +141,10 @@ class TenderActionButtonsRow extends StatelessWidget {
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: color:
tender.submitted ?? false // tender.submitted ?? false
? AppColors.successColor // ? AppColors.successColor
: AppColors.grey60, // :
AppColors.grey60,
), ),
), ),
], ],
@@ -153,7 +159,7 @@ class TenderActionButtonsRow extends StatelessWidget {
child: InkWell( child: InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
onTap: () { onTap: () {
viewModel.toggleDislike(tender); // viewModel.toggleDislike(tender);
}, },
child: Column( child: Column(
children: [ children: [
@@ -163,9 +169,10 @@ class TenderActionButtonsRow extends StatelessWidget {
fit: BoxFit.cover, fit: BoxFit.cover,
AssetsManager.dislike, AssetsManager.dislike,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
tender.disliked ?? false // tender.disliked ?? false
? AppColors.errorColor // ? AppColors.errorColor
: AppColors.grey50, // :
AppColors.grey50,
BlendMode.srcATop, BlendMode.srcATop,
), ),
), ),
@@ -177,9 +184,10 @@ class TenderActionButtonsRow extends StatelessWidget {
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: color:
tender.disliked ?? false // tender.disliked ?? false
? AppColors.errorColor // ? AppColors.errorColor
: AppColors.grey50, // :
AppColors.grey50,
), ),
), ),
], ],
@@ -194,7 +202,7 @@ class TenderActionButtonsRow extends StatelessWidget {
child: InkWell( child: InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
onTap: () { onTap: () {
viewModel.toggleLike(tender); // viewModel.toggleLike(tender);
}, },
child: Column( child: Column(
children: [ children: [
@@ -204,9 +212,10 @@ class TenderActionButtonsRow extends StatelessWidget {
fit: BoxFit.cover, fit: BoxFit.cover,
AssetsManager.like, AssetsManager.like,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
tender.liked ?? false // tender.liked ?? false
? AppColors.successColor // ? AppColors.successColor
: AppColors.grey50, // :
AppColors.grey50,
BlendMode.srcATop, BlendMode.srcATop,
), ),
), ),
@@ -218,9 +227,10 @@ class TenderActionButtonsRow extends StatelessWidget {
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: color:
tender.liked ?? false // tender.liked ?? false
? AppColors.successColor // ? AppColors.successColor
: AppColors.grey50, // :
AppColors.grey50,
), ),
), ),
], ],
+11 -10
View File
@@ -1,16 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart' hide DateUtils;
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:tm_app/core/constants/strings.dart'; import 'package:tm_app/core/constants/strings.dart';
import 'package:tm_app/core/routes/app_routes.dart'; import 'package:tm_app/core/routes/app_routes.dart';
import 'package:tm_app/data/services/model/tender/tender_model.dart'; import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import '../../../core/constants/assets.dart'; import '../../../core/constants/assets.dart';
import '../../../core/theme/colors.dart'; import '../../../core/theme/colors.dart';
import '../../../core/utils/date_utils.dart';
import '../../../core/utils/size_config.dart'; import '../../../core/utils/size_config.dart';
import 'tender_action_buttons_row.dart'; import 'tender_action_buttons_row.dart';
class TenderCard extends StatelessWidget { class TenderCard extends StatelessWidget {
final TenderModel tender; final TenderData tender;
final bool isDesktop; final bool isDesktop;
const TenderCard({required this.tender, super.key, this.isDesktop = false}); const TenderCard({required this.tender, super.key, this.isDesktop = false});
@@ -104,7 +105,7 @@ class TenderCard extends StatelessWidget {
Widget _dateText() { Widget _dateText() {
return Text( return Text(
tender.createdTime ?? '', DateUtils.unixToDate(tender.publicationDate ?? 0),
style: TextStyle( style: TextStyle(
color: AppColors.grey60, color: AppColors.grey60,
fontSize: 12.0.sp(), fontSize: 12.0.sp(),
@@ -134,7 +135,7 @@ class TenderCard extends StatelessWidget {
), ),
), ),
Text( Text(
tender.deadline ?? '', DateUtils.unixToDate(tender.tenderDeadline ?? 0),
style: TextStyle( style: TextStyle(
color: AppColors.grey80, color: AppColors.grey80,
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
@@ -171,7 +172,7 @@ class TenderCard extends StatelessWidget {
Widget _idText() { Widget _idText() {
return Text( return Text(
tender.tenderId ?? '', tender.id ?? '',
style: TextStyle( style: TextStyle(
color: AppColors.grey, color: AppColors.grey,
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
@@ -193,7 +194,7 @@ class TenderCard extends StatelessWidget {
), ),
), ),
Text( Text(
'${tender.profileMatch ?? 0}%', '${45}%',
style: TextStyle( style: TextStyle(
color: AppColors.secondaryTextColor, color: AppColors.secondaryTextColor,
fontSize: 16.0.sp(), fontSize: 16.0.sp(),
@@ -214,7 +215,7 @@ class TenderCard extends StatelessWidget {
), ),
child: FractionallySizedBox( child: FractionallySizedBox(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
widthFactor: (tender.profileMatch ?? 0) / 100, widthFactor: (45) / 100,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.secondary50, color: AppColors.secondary50,
@@ -232,7 +233,7 @@ class TenderCard extends StatelessWidget {
SvgPicture.asset(AssetsManager.location), SvgPicture.asset(AssetsManager.location),
SizedBox(width: 4.0.w()), SizedBox(width: 4.0.w()),
Text( Text(
tender.location ?? '', tender.countryCode ?? '',
style: TextStyle( style: TextStyle(
color: AppColors.grey80, color: AppColors.grey80,
fontSize: 14.0.sp(), fontSize: 14.0.sp(),
@@ -250,7 +251,7 @@ class TenderCard extends StatelessWidget {
Widget _seeMoreButton(BuildContext context) { Widget _seeMoreButton(BuildContext context) {
return InkWell( return InkWell(
onTap: () { onTap: () {
TenderDetailRouteData().push(context); TenderDetailRouteData(tenderId: tender.id!).push(context);
}, },
child: Container( child: Container(
width: 108.0.w(), width: 108.0.w(),
@@ -1,101 +0,0 @@
import 'package:flutter/material.dart';
class TenderModel {
final String date;
final String title;
final String description;
final String location;
final String countryFlag;
final String status;
final String projectStatus;
final Color? backgroundColor;
final Color? borderColor;
final String? statusIcon;
final Color? statusCardColor;
TenderModel({
required this.date,
required this.title,
required this.description,
required this.location,
required this.countryFlag,
required this.status,
required this.projectStatus,
this.backgroundColor,
this.borderColor,
this.statusIcon,
this.statusCardColor,
});
}
List<TenderModel> approvedTenders = [
TenderModel(
date: '2025-01-01',
title:
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
description:
'Lorem ipsum dolor sit amet consectetur. Volutpat velit tincidunt amet diam. Placerat congue ut Sed facilisis faucibus porttitor. Proin suspendisse eu euismod sit lorem quis. ',
location: 'Stockholm, Sweden',
countryFlag: 'assets/icons/SE.png',
status: 'Completed',
projectStatus: 'Self Control',
),
TenderModel(
date: '2025-01-01',
title:
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
description:
'Lorem ipsum dolor sit amet consectetur. Volutpat velit tincidunt amet diam. Placerat congue ut Sed facilisis faucibus porttitor. Proin suspendisse eu euismod sit lorem quis. ',
location: 'Stockholm, Sweden',
countryFlag: 'assets/icons/SE.png',
status: 'Completed',
projectStatus: 'Patner Ship',
),
TenderModel(
date: '2025-01-01',
title:
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
description:
'Lorem ipsum dolor sit amet consectetur. Volutpat velit tincidunt amet diam. Placerat congue ut Sed facilisis faucibus porttitor. Proin suspendisse eu euismod sit lorem quis. ',
location: 'Stockholm, Sweden',
countryFlag: 'assets/icons/SE.png',
status: 'Completed',
projectStatus: 'Self Control',
),
];
List<TenderModel> tendersSubmitted = [
TenderModel(
date: '2025-01-01',
title:
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
description:
'Lorem ipsum dolor sit amet consectetur. Volutpat velit tincidunt amet diam. Placerat congue ut Sed facilisis faucibus porttitor. Proin suspendisse eu euismod sit lorem quis. ',
location: 'Stockholm, Sweden',
countryFlag: 'assets/icons/SE.png',
status: 'Won',
projectStatus: 'Self Control',
),
TenderModel(
date: '2025-01-01',
title:
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
description:
'Lorem ipsum dolor sit amet consectetur. Volutpat velit tincidunt amet diam. Placerat congue ut Sed facilisis faucibus porttitor. Proin suspendisse eu euismod sit lorem quis. ',
location: 'Stockholm, Sweden',
countryFlag: 'assets/icons/SE.png',
status: 'Reject',
projectStatus: 'Patner Ship',
),
TenderModel(
date: '2025-01-01',
title:
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
description:
'Lorem ipsum dolor sit amet consectetur. Volutpat velit tincidunt amet diam. Placerat congue ut Sed facilisis faucibus porttitor. Proin suspendisse eu euismod sit lorem quis. ',
location: 'Stockholm, Sweden',
countryFlag: 'assets/icons/SE.png',
status: 'Won',
projectStatus: 'Self Control',
),
];
+1
View File
@@ -22,6 +22,7 @@ dependencies:
shared_preferences: ^2.5.3 shared_preferences: ^2.5.3
json_annotation: ^4.8.1 json_annotation: ^4.8.1
http: ^1.5.0 http: ^1.5.0
intl: ^0.20.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: