home logic added
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
dart run build_runner build --delete-conflicting-outputs
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:provider/single_child_widget.dart';
|
import 'package:provider/single_child_widget.dart';
|
||||||
import 'package:tm_app/core/theme/theme_provider.dart';
|
import 'package:tm_app/core/theme/theme_provider.dart';
|
||||||
|
import 'package:tm_app/data/repositories/home_repository.dart';
|
||||||
|
import 'package:tm_app/data/services/home_service.dart';
|
||||||
|
|
||||||
import '../../data/repositories/auth_repository.dart';
|
import '../../data/repositories/auth_repository.dart';
|
||||||
import '../../data/services/auth_service.dart';
|
import '../../data/services/auth_service.dart';
|
||||||
import '../../data/services/network_manager.dart';
|
import '../../data/services/network_manager.dart';
|
||||||
import '../../view_models/auth_view_model.dart';
|
import '../../view_models/auth_view_model.dart';
|
||||||
|
import '../../view_models/home_view_model.dart';
|
||||||
|
|
||||||
List<SingleChildWidget> get providersRemote {
|
List<SingleChildWidget> get providersRemote {
|
||||||
return [...cores, ...apiClients, ...repositories, ...viewModels, ...others];
|
return [...cores, ...apiClients, ...repositories, ...viewModels, ...others];
|
||||||
@@ -21,20 +24,25 @@ List<SingleChildWidget> get cores {
|
|||||||
List<SingleChildWidget> get apiClients {
|
List<SingleChildWidget> get apiClients {
|
||||||
return [
|
return [
|
||||||
Provider(create: (context) => AuthService(networkManager: context.read())),
|
Provider(create: (context) => AuthService(networkManager: context.read())),
|
||||||
|
Provider(create: (context) => HomeService(networkManager: context.read())),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SingleChildWidget> get repositories {
|
List<SingleChildWidget> get repositories {
|
||||||
return [
|
return [
|
||||||
Provider(create: (context) => AuthRepository(authService: context.read())),
|
Provider(create: (context) => AuthRepository(authService: context.read())),
|
||||||
|
Provider(create: (context) => HomeRepository(homeService: context.read())),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SingleChildWidget> get viewModels {
|
List<SingleChildWidget> get viewModels {
|
||||||
return [
|
return [
|
||||||
Provider(
|
ChangeNotifierProvider(
|
||||||
create: (context) => AuthViewModel(authRepository: context.read()),
|
create: (context) => AuthViewModel(authRepository: context.read()),
|
||||||
),
|
),
|
||||||
|
ChangeNotifierProvider(
|
||||||
|
create: (context) => HomeViewModel(homeRepository: context.read()),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:tm_app/core/utils/result.dart';
|
||||||
|
import 'package:tm_app/data/services/home_service.dart';
|
||||||
|
import 'package:tm_app/data/services/model/home/home_request/home_request_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
||||||
|
|
||||||
|
class HomeRepository {
|
||||||
|
HomeRepository({required HomeService homeService})
|
||||||
|
: _homeService = homeService;
|
||||||
|
final HomeService _homeService;
|
||||||
|
|
||||||
|
Future<Result<HomeResponseModel>> getHome({
|
||||||
|
HomeRequestModel? homeRequestModel,
|
||||||
|
}) async {
|
||||||
|
return _homeService.getHome(homeRequestModel: homeRequestModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:tm_app/core/utils/logger.dart';
|
||||||
|
import 'package:tm_app/core/utils/result.dart';
|
||||||
|
import 'package:tm_app/data/services/mock_data/home_mock_data.dart';
|
||||||
|
import 'package:tm_app/data/services/model/home/home_request/home_request_model.dart';
|
||||||
|
import 'package:tm_app/data/services/model/home/home_response/home_response_model.dart';
|
||||||
|
import 'package:tm_app/data/services/network_manager.dart';
|
||||||
|
|
||||||
|
class HomeService {
|
||||||
|
HomeService({required NetworkManager networkManager})
|
||||||
|
: _networkManager = networkManager;
|
||||||
|
final NetworkManager _networkManager;
|
||||||
|
|
||||||
|
Future<Result<HomeResponseModel>> getHome({
|
||||||
|
HomeRequestModel? homeRequestModel,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
// final result = await _networkManager.makeRequest(
|
||||||
|
// '/api/v1/home',
|
||||||
|
// (json) => HomeResponseModel.fromJson(json),
|
||||||
|
// method: 'GET',
|
||||||
|
// );
|
||||||
|
await Future.delayed(Duration(seconds: 2));
|
||||||
|
appLogger.info('get home success');
|
||||||
|
// TODO: will change when api is ready
|
||||||
|
appLogger.debug(
|
||||||
|
HomeResponseModel.fromJson(jsonDecode(homeMockData)['data']),
|
||||||
|
);
|
||||||
|
return Result.ok(
|
||||||
|
HomeResponseModel.fromJson(jsonDecode(homeMockData)['data']),
|
||||||
|
);
|
||||||
|
} on DioException catch (e) {
|
||||||
|
appLogger.error('get home failed: $e');
|
||||||
|
return Result.error(e);
|
||||||
|
} on Exception catch (e, stackTrace) {
|
||||||
|
appLogger.error('get home failed: $e', stackTrace: stackTrace);
|
||||||
|
return Result.error(Exception(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
const String homeMockData = '''
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"partnership": "75",
|
||||||
|
"self_apply": "12",
|
||||||
|
"contracting": "36",
|
||||||
|
"tender_submitted": "12",
|
||||||
|
"approved_tenders": "03",
|
||||||
|
"tender_value": "\$250,000",
|
||||||
|
"thunder_status": "23",
|
||||||
|
"your_tenders": [
|
||||||
|
{
|
||||||
|
"created_time": "2025-01-01",
|
||||||
|
"tender_id": "1234567890",
|
||||||
|
"status": "Completed",
|
||||||
|
"title": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.",
|
||||||
|
"description": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.Lorem ipsum dolor sit amet consectetur",
|
||||||
|
"location": "Sweden",
|
||||||
|
"type": "Self Control"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"created_time": "2025-01-01",
|
||||||
|
"tender_id": "1234567890",
|
||||||
|
"status": "Completed",
|
||||||
|
"title": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.",
|
||||||
|
"description": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.Lorem ipsum dolor sit amet consectetur",
|
||||||
|
"location": "Sweden",
|
||||||
|
"type": "Partner Ship"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"created_time": "2025-01-01",
|
||||||
|
"tender_id": "1234567890",
|
||||||
|
"status": "Completed",
|
||||||
|
"title": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.",
|
||||||
|
"description": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.Lorem ipsum dolor sit amet consectetur",
|
||||||
|
"location": "Sweden",
|
||||||
|
"type": "Self Control"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"created_time": "2025-01-01",
|
||||||
|
"tender_id": "1234567890",
|
||||||
|
"status": "Completed",
|
||||||
|
"title": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.",
|
||||||
|
"description": "Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.Lorem ipsum dolor sit amet consectetur",
|
||||||
|
"location": "Sweden",
|
||||||
|
"type": "Partner Ship"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'home_request_model.freezed.dart';
|
||||||
|
part 'home_request_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class HomeRequestModel with _$HomeRequestModel {
|
||||||
|
const factory HomeRequestModel({required String id}) = _HomeRequestModel;
|
||||||
|
|
||||||
|
factory HomeRequestModel.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$HomeRequestModelFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
// 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 'home_request_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$HomeRequestModel {
|
||||||
|
|
||||||
|
String get id;
|
||||||
|
/// Create a copy of HomeRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$HomeRequestModelCopyWith<HomeRequestModel> get copyWith => _$HomeRequestModelCopyWithImpl<HomeRequestModel>(this as HomeRequestModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this HomeRequestModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is HomeRequestModel&&(identical(other.id, id) || other.id == id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'HomeRequestModel(id: $id)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $HomeRequestModelCopyWith<$Res> {
|
||||||
|
factory $HomeRequestModelCopyWith(HomeRequestModel value, $Res Function(HomeRequestModel) _then) = _$HomeRequestModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$HomeRequestModelCopyWithImpl<$Res>
|
||||||
|
implements $HomeRequestModelCopyWith<$Res> {
|
||||||
|
_$HomeRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final HomeRequestModel _self;
|
||||||
|
final $Res Function(HomeRequestModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of HomeRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [HomeRequestModel].
|
||||||
|
extension HomeRequestModelPatterns on HomeRequestModel {
|
||||||
|
/// 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( _HomeRequestModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeRequestModel() 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( _HomeRequestModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeRequestModel():
|
||||||
|
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( _HomeRequestModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeRequestModel() 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)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeRequestModel() when $default != null:
|
||||||
|
return $default(_that.id);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) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeRequestModel():
|
||||||
|
return $default(_that.id);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)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeRequestModel() when $default != null:
|
||||||
|
return $default(_that.id);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _HomeRequestModel implements HomeRequestModel {
|
||||||
|
const _HomeRequestModel({required this.id});
|
||||||
|
factory _HomeRequestModel.fromJson(Map<String, dynamic> json) => _$HomeRequestModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
|
||||||
|
/// Create a copy of HomeRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$HomeRequestModelCopyWith<_HomeRequestModel> get copyWith => __$HomeRequestModelCopyWithImpl<_HomeRequestModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$HomeRequestModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HomeRequestModel&&(identical(other.id, id) || other.id == id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'HomeRequestModel(id: $id)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$HomeRequestModelCopyWith<$Res> implements $HomeRequestModelCopyWith<$Res> {
|
||||||
|
factory _$HomeRequestModelCopyWith(_HomeRequestModel value, $Res Function(_HomeRequestModel) _then) = __$HomeRequestModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$HomeRequestModelCopyWithImpl<$Res>
|
||||||
|
implements _$HomeRequestModelCopyWith<$Res> {
|
||||||
|
__$HomeRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _HomeRequestModel _self;
|
||||||
|
final $Res Function(_HomeRequestModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of HomeRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,}) {
|
||||||
|
return _then(_HomeRequestModel(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'home_request_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_HomeRequestModel _$HomeRequestModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
_HomeRequestModel(id: json['id'] as String);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$HomeRequestModelToJson(_HomeRequestModel instance) =>
|
||||||
|
<String, dynamic>{'id': instance.id};
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// ignore_for_file: invalid_annotation_target
|
||||||
|
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:tm_app/data/services/model/home/tender/tender_model.dart';
|
||||||
|
|
||||||
|
part 'home_response_model.freezed.dart';
|
||||||
|
part 'home_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class HomeResponseModel with _$HomeResponseModel {
|
||||||
|
const factory HomeResponseModel({
|
||||||
|
required String? partnership,
|
||||||
|
@JsonKey(name: 'self_apply') required String? selfApply,
|
||||||
|
required String? contracting,
|
||||||
|
@JsonKey(name: 'tender_submitted') required String? tenderSubmitted,
|
||||||
|
@JsonKey(name: 'approved_tenders') required String? approvedTenders,
|
||||||
|
@JsonKey(name: 'tender_value') required String? tenderValue,
|
||||||
|
@JsonKey(name: 'thunder_status') required String? thunderStatus,
|
||||||
|
@JsonKey(name: 'your_tenders') required List<TenderModel>? yourTenders,
|
||||||
|
}) = _HomeResponseModel;
|
||||||
|
|
||||||
|
factory HomeResponseModel.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$HomeResponseModelFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
// 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 'home_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$HomeResponseModel {
|
||||||
|
|
||||||
|
String? get partnership;@JsonKey(name: 'self_apply') String? get selfApply; String? get contracting;@JsonKey(name: 'tender_submitted') String? get tenderSubmitted;@JsonKey(name: 'approved_tenders') String? get approvedTenders;@JsonKey(name: 'tender_value') String? get tenderValue;@JsonKey(name: 'thunder_status') String? get thunderStatus;@JsonKey(name: 'your_tenders') List<TenderModel>? get yourTenders;
|
||||||
|
/// Create a copy of HomeResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$HomeResponseModelCopyWith<HomeResponseModel> get copyWith => _$HomeResponseModelCopyWithImpl<HomeResponseModel>(this as HomeResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this HomeResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is HomeResponseModel&&(identical(other.partnership, partnership) || other.partnership == partnership)&&(identical(other.selfApply, selfApply) || other.selfApply == selfApply)&&(identical(other.contracting, contracting) || other.contracting == contracting)&&(identical(other.tenderSubmitted, tenderSubmitted) || other.tenderSubmitted == tenderSubmitted)&&(identical(other.approvedTenders, approvedTenders) || other.approvedTenders == approvedTenders)&&(identical(other.tenderValue, tenderValue) || other.tenderValue == tenderValue)&&(identical(other.thunderStatus, thunderStatus) || other.thunderStatus == thunderStatus)&&const DeepCollectionEquality().equals(other.yourTenders, yourTenders));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,partnership,selfApply,contracting,tenderSubmitted,approvedTenders,tenderValue,thunderStatus,const DeepCollectionEquality().hash(yourTenders));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'HomeResponseModel(partnership: $partnership, selfApply: $selfApply, contracting: $contracting, tenderSubmitted: $tenderSubmitted, approvedTenders: $approvedTenders, tenderValue: $tenderValue, thunderStatus: $thunderStatus, yourTenders: $yourTenders)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $HomeResponseModelCopyWith<$Res> {
|
||||||
|
factory $HomeResponseModelCopyWith(HomeResponseModel value, $Res Function(HomeResponseModel) _then) = _$HomeResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String? partnership,@JsonKey(name: 'self_apply') String? selfApply, String? contracting,@JsonKey(name: 'tender_submitted') String? tenderSubmitted,@JsonKey(name: 'approved_tenders') String? approvedTenders,@JsonKey(name: 'tender_value') String? tenderValue,@JsonKey(name: 'thunder_status') String? thunderStatus,@JsonKey(name: 'your_tenders') List<TenderModel>? yourTenders
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$HomeResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $HomeResponseModelCopyWith<$Res> {
|
||||||
|
_$HomeResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final HomeResponseModel _self;
|
||||||
|
final $Res Function(HomeResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of HomeResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? partnership = freezed,Object? selfApply = freezed,Object? contracting = freezed,Object? tenderSubmitted = freezed,Object? approvedTenders = freezed,Object? tenderValue = freezed,Object? thunderStatus = freezed,Object? yourTenders = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
partnership: freezed == partnership ? _self.partnership : partnership // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,selfApply: freezed == selfApply ? _self.selfApply : selfApply // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,contracting: freezed == contracting ? _self.contracting : contracting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,tenderSubmitted: freezed == tenderSubmitted ? _self.tenderSubmitted : tenderSubmitted // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,approvedTenders: freezed == approvedTenders ? _self.approvedTenders : approvedTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,tenderValue: freezed == tenderValue ? _self.tenderValue : tenderValue // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,thunderStatus: freezed == thunderStatus ? _self.thunderStatus : thunderStatus // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,yourTenders: freezed == yourTenders ? _self.yourTenders : yourTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<TenderModel>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [HomeResponseModel].
|
||||||
|
extension HomeResponseModelPatterns on HomeResponseModel {
|
||||||
|
/// 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( _HomeResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeResponseModel() 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( _HomeResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeResponseModel():
|
||||||
|
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( _HomeResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeResponseModel() 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? partnership, @JsonKey(name: 'self_apply') String? selfApply, String? contracting, @JsonKey(name: 'tender_submitted') String? tenderSubmitted, @JsonKey(name: 'approved_tenders') String? approvedTenders, @JsonKey(name: 'tender_value') String? tenderValue, @JsonKey(name: 'thunder_status') String? thunderStatus, @JsonKey(name: 'your_tenders') List<TenderModel>? yourTenders)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeResponseModel() when $default != null:
|
||||||
|
return $default(_that.partnership,_that.selfApply,_that.contracting,_that.tenderSubmitted,_that.approvedTenders,_that.tenderValue,_that.thunderStatus,_that.yourTenders);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? partnership, @JsonKey(name: 'self_apply') String? selfApply, String? contracting, @JsonKey(name: 'tender_submitted') String? tenderSubmitted, @JsonKey(name: 'approved_tenders') String? approvedTenders, @JsonKey(name: 'tender_value') String? tenderValue, @JsonKey(name: 'thunder_status') String? thunderStatus, @JsonKey(name: 'your_tenders') List<TenderModel>? yourTenders) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeResponseModel():
|
||||||
|
return $default(_that.partnership,_that.selfApply,_that.contracting,_that.tenderSubmitted,_that.approvedTenders,_that.tenderValue,_that.thunderStatus,_that.yourTenders);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? partnership, @JsonKey(name: 'self_apply') String? selfApply, String? contracting, @JsonKey(name: 'tender_submitted') String? tenderSubmitted, @JsonKey(name: 'approved_tenders') String? approvedTenders, @JsonKey(name: 'tender_value') String? tenderValue, @JsonKey(name: 'thunder_status') String? thunderStatus, @JsonKey(name: 'your_tenders') List<TenderModel>? yourTenders)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HomeResponseModel() when $default != null:
|
||||||
|
return $default(_that.partnership,_that.selfApply,_that.contracting,_that.tenderSubmitted,_that.approvedTenders,_that.tenderValue,_that.thunderStatus,_that.yourTenders);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _HomeResponseModel implements HomeResponseModel {
|
||||||
|
const _HomeResponseModel({required this.partnership, @JsonKey(name: 'self_apply') required this.selfApply, required this.contracting, @JsonKey(name: 'tender_submitted') required this.tenderSubmitted, @JsonKey(name: 'approved_tenders') required this.approvedTenders, @JsonKey(name: 'tender_value') required this.tenderValue, @JsonKey(name: 'thunder_status') required this.thunderStatus, @JsonKey(name: 'your_tenders') required final List<TenderModel>? yourTenders}): _yourTenders = yourTenders;
|
||||||
|
factory _HomeResponseModel.fromJson(Map<String, dynamic> json) => _$HomeResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String? partnership;
|
||||||
|
@override@JsonKey(name: 'self_apply') final String? selfApply;
|
||||||
|
@override final String? contracting;
|
||||||
|
@override@JsonKey(name: 'tender_submitted') final String? tenderSubmitted;
|
||||||
|
@override@JsonKey(name: 'approved_tenders') final String? approvedTenders;
|
||||||
|
@override@JsonKey(name: 'tender_value') final String? tenderValue;
|
||||||
|
@override@JsonKey(name: 'thunder_status') final String? thunderStatus;
|
||||||
|
final List<TenderModel>? _yourTenders;
|
||||||
|
@override@JsonKey(name: 'your_tenders') List<TenderModel>? get yourTenders {
|
||||||
|
final value = _yourTenders;
|
||||||
|
if (value == null) return null;
|
||||||
|
if (_yourTenders is EqualUnmodifiableListView) return _yourTenders;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Create a copy of HomeResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$HomeResponseModelCopyWith<_HomeResponseModel> get copyWith => __$HomeResponseModelCopyWithImpl<_HomeResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$HomeResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HomeResponseModel&&(identical(other.partnership, partnership) || other.partnership == partnership)&&(identical(other.selfApply, selfApply) || other.selfApply == selfApply)&&(identical(other.contracting, contracting) || other.contracting == contracting)&&(identical(other.tenderSubmitted, tenderSubmitted) || other.tenderSubmitted == tenderSubmitted)&&(identical(other.approvedTenders, approvedTenders) || other.approvedTenders == approvedTenders)&&(identical(other.tenderValue, tenderValue) || other.tenderValue == tenderValue)&&(identical(other.thunderStatus, thunderStatus) || other.thunderStatus == thunderStatus)&&const DeepCollectionEquality().equals(other._yourTenders, _yourTenders));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,partnership,selfApply,contracting,tenderSubmitted,approvedTenders,tenderValue,thunderStatus,const DeepCollectionEquality().hash(_yourTenders));
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'HomeResponseModel(partnership: $partnership, selfApply: $selfApply, contracting: $contracting, tenderSubmitted: $tenderSubmitted, approvedTenders: $approvedTenders, tenderValue: $tenderValue, thunderStatus: $thunderStatus, yourTenders: $yourTenders)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$HomeResponseModelCopyWith<$Res> implements $HomeResponseModelCopyWith<$Res> {
|
||||||
|
factory _$HomeResponseModelCopyWith(_HomeResponseModel value, $Res Function(_HomeResponseModel) _then) = __$HomeResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String? partnership,@JsonKey(name: 'self_apply') String? selfApply, String? contracting,@JsonKey(name: 'tender_submitted') String? tenderSubmitted,@JsonKey(name: 'approved_tenders') String? approvedTenders,@JsonKey(name: 'tender_value') String? tenderValue,@JsonKey(name: 'thunder_status') String? thunderStatus,@JsonKey(name: 'your_tenders') List<TenderModel>? yourTenders
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$HomeResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$HomeResponseModelCopyWith<$Res> {
|
||||||
|
__$HomeResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _HomeResponseModel _self;
|
||||||
|
final $Res Function(_HomeResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of HomeResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? partnership = freezed,Object? selfApply = freezed,Object? contracting = freezed,Object? tenderSubmitted = freezed,Object? approvedTenders = freezed,Object? tenderValue = freezed,Object? thunderStatus = freezed,Object? yourTenders = freezed,}) {
|
||||||
|
return _then(_HomeResponseModel(
|
||||||
|
partnership: freezed == partnership ? _self.partnership : partnership // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,selfApply: freezed == selfApply ? _self.selfApply : selfApply // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,contracting: freezed == contracting ? _self.contracting : contracting // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,tenderSubmitted: freezed == tenderSubmitted ? _self.tenderSubmitted : tenderSubmitted // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,approvedTenders: freezed == approvedTenders ? _self.approvedTenders : approvedTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,tenderValue: freezed == tenderValue ? _self.tenderValue : tenderValue // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,thunderStatus: freezed == thunderStatus ? _self.thunderStatus : thunderStatus // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,yourTenders: freezed == yourTenders ? _self._yourTenders : yourTenders // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<TenderModel>?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'home_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_HomeResponseModel _$HomeResponseModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
_HomeResponseModel(
|
||||||
|
partnership: json['partnership'] as String?,
|
||||||
|
selfApply: json['self_apply'] as String?,
|
||||||
|
contracting: json['contracting'] as String?,
|
||||||
|
tenderSubmitted: json['tender_submitted'] as String?,
|
||||||
|
approvedTenders: json['approved_tenders'] as String?,
|
||||||
|
tenderValue: json['tender_value'] as String?,
|
||||||
|
thunderStatus: json['thunder_status'] as String?,
|
||||||
|
yourTenders:
|
||||||
|
(json['your_tenders'] as List<dynamic>?)
|
||||||
|
?.map((e) => TenderModel.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$HomeResponseModelToJson(_HomeResponseModel instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'partnership': instance.partnership,
|
||||||
|
'self_apply': instance.selfApply,
|
||||||
|
'contracting': instance.contracting,
|
||||||
|
'tender_submitted': instance.tenderSubmitted,
|
||||||
|
'approved_tenders': instance.approvedTenders,
|
||||||
|
'tender_value': instance.tenderValue,
|
||||||
|
'thunder_status': instance.thunderStatus,
|
||||||
|
'your_tenders': instance.yourTenders,
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// ignore_for_file: invalid_annotation_target
|
||||||
|
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'tender_model.freezed.dart';
|
||||||
|
part 'tender_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class TenderModel with _$TenderModel {
|
||||||
|
const factory TenderModel({
|
||||||
|
@JsonKey(name: 'created_time') required String? createdTime,
|
||||||
|
@JsonKey(name: 'tender_id') required String? tenderId,
|
||||||
|
required String? status,
|
||||||
|
required String? title,
|
||||||
|
required String? description,
|
||||||
|
required String? location,
|
||||||
|
required String? type,
|
||||||
|
}) = _TenderModel;
|
||||||
|
|
||||||
|
factory TenderModel.fromJson(Map<String, Object?> json) =>
|
||||||
|
_$TenderModelFromJson(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 'tender_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$TenderModel {
|
||||||
|
|
||||||
|
@JsonKey(name: 'created_time') String? get createdTime;@JsonKey(name: 'tender_id') String? get tenderId; String? get status; String? get title; String? get description; String? get location; String? get type;
|
||||||
|
/// Create a copy of TenderModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$TenderModelCopyWith<TenderModel> get copyWith => _$TenderModelCopyWithImpl<TenderModel>(this as TenderModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this TenderModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is TenderModel&&(identical(other.createdTime, createdTime) || other.createdTime == createdTime)&&(identical(other.tenderId, tenderId) || other.tenderId == tenderId)&&(identical(other.status, status) || other.status == status)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.location, location) || other.location == location)&&(identical(other.type, type) || other.type == type));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,createdTime,tenderId,status,title,description,location,type);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TenderModel(createdTime: $createdTime, tenderId: $tenderId, status: $status, title: $title, description: $description, location: $location, type: $type)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $TenderModelCopyWith<$Res> {
|
||||||
|
factory $TenderModelCopyWith(TenderModel value, $Res Function(TenderModel) _then) = _$TenderModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'created_time') String? createdTime,@JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$TenderModelCopyWithImpl<$Res>
|
||||||
|
implements $TenderModelCopyWith<$Res> {
|
||||||
|
_$TenderModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final TenderModel _self;
|
||||||
|
final $Res Function(TenderModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of TenderModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? createdTime = freezed,Object? tenderId = freezed,Object? status = freezed,Object? title = freezed,Object? description = freezed,Object? location = freezed,Object? type = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
createdTime: freezed == createdTime ? _self.createdTime : createdTime // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,tenderId: freezed == tenderId ? _self.tenderId : tenderId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [TenderModel].
|
||||||
|
extension TenderModelPatterns on TenderModel {
|
||||||
|
/// 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( _TenderModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderModel() 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( _TenderModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderModel():
|
||||||
|
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( _TenderModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderModel() 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: 'created_time') String? createdTime, @JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderModel() when $default != null:
|
||||||
|
return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.description,_that.location,_that.type);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: 'created_time') String? createdTime, @JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderModel():
|
||||||
|
return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.description,_that.location,_that.type);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: 'created_time') String? createdTime, @JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _TenderModel() when $default != null:
|
||||||
|
return $default(_that.createdTime,_that.tenderId,_that.status,_that.title,_that.description,_that.location,_that.type);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _TenderModel implements TenderModel {
|
||||||
|
const _TenderModel({@JsonKey(name: 'created_time') required this.createdTime, @JsonKey(name: 'tender_id') required this.tenderId, required this.status, required this.title, required this.description, required this.location, required this.type});
|
||||||
|
factory _TenderModel.fromJson(Map<String, dynamic> json) => _$TenderModelFromJson(json);
|
||||||
|
|
||||||
|
@override@JsonKey(name: 'created_time') final String? createdTime;
|
||||||
|
@override@JsonKey(name: 'tender_id') final String? tenderId;
|
||||||
|
@override final String? status;
|
||||||
|
@override final String? title;
|
||||||
|
@override final String? description;
|
||||||
|
@override final String? location;
|
||||||
|
@override final String? type;
|
||||||
|
|
||||||
|
/// Create a copy of TenderModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$TenderModelCopyWith<_TenderModel> get copyWith => __$TenderModelCopyWithImpl<_TenderModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$TenderModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TenderModel&&(identical(other.createdTime, createdTime) || other.createdTime == createdTime)&&(identical(other.tenderId, tenderId) || other.tenderId == tenderId)&&(identical(other.status, status) || other.status == status)&&(identical(other.title, title) || other.title == title)&&(identical(other.description, description) || other.description == description)&&(identical(other.location, location) || other.location == location)&&(identical(other.type, type) || other.type == type));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,createdTime,tenderId,status,title,description,location,type);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'TenderModel(createdTime: $createdTime, tenderId: $tenderId, status: $status, title: $title, description: $description, location: $location, type: $type)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$TenderModelCopyWith<$Res> implements $TenderModelCopyWith<$Res> {
|
||||||
|
factory _$TenderModelCopyWith(_TenderModel value, $Res Function(_TenderModel) _then) = __$TenderModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
@JsonKey(name: 'created_time') String? createdTime,@JsonKey(name: 'tender_id') String? tenderId, String? status, String? title, String? description, String? location, String? type
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$TenderModelCopyWithImpl<$Res>
|
||||||
|
implements _$TenderModelCopyWith<$Res> {
|
||||||
|
__$TenderModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _TenderModel _self;
|
||||||
|
final $Res Function(_TenderModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of TenderModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? createdTime = freezed,Object? tenderId = freezed,Object? status = freezed,Object? title = freezed,Object? description = freezed,Object? location = freezed,Object? type = freezed,}) {
|
||||||
|
return _then(_TenderModel(
|
||||||
|
createdTime: freezed == createdTime ? _self.createdTime : createdTime // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,tenderId: freezed == tenderId ? _self.tenderId : tenderId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,location: freezed == location ? _self.location : location // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,type: freezed == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'tender_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_TenderModel _$TenderModelFromJson(Map<String, dynamic> json) => _TenderModel(
|
||||||
|
createdTime: json['created_time'] as String?,
|
||||||
|
tenderId: json['tender_id'] as String?,
|
||||||
|
status: json['status'] as String?,
|
||||||
|
title: json['title'] as String?,
|
||||||
|
description: json['description'] as String?,
|
||||||
|
location: json['location'] as String?,
|
||||||
|
type: json['type'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$TenderModelToJson(_TenderModel instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'created_time': instance.createdTime,
|
||||||
|
'tender_id': instance.tenderId,
|
||||||
|
'status': instance.status,
|
||||||
|
'title': instance.title,
|
||||||
|
'description': instance.description,
|
||||||
|
'location': instance.location,
|
||||||
|
'type': instance.type,
|
||||||
|
};
|
||||||
@@ -0,0 +1,247 @@
|
|||||||
|
// dart format width=80
|
||||||
|
|
||||||
|
/// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
/// *****************************************************
|
||||||
|
/// FlutterGen
|
||||||
|
/// *****************************************************
|
||||||
|
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: deprecated_member_use,directives_ordering,implicit_dynamic_list_literal,unnecessary_import
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
class $AssetsIconsGen {
|
||||||
|
const $AssetsIconsGen();
|
||||||
|
|
||||||
|
/// File path: assets/icons/SE.png
|
||||||
|
AssetGenImage get se => const AssetGenImage('assets/icons/SE.png');
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-circle-left.svg
|
||||||
|
String get arrowCircleLeft => 'assets/icons/arrow-circle-left.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-circle-right.svg
|
||||||
|
String get arrowCircleRight => 'assets/icons/arrow-circle-right.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-left-small.svg
|
||||||
|
String get arrowLeftSmall => 'assets/icons/arrow-left-small.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-right-small.svg
|
||||||
|
String get arrowRightSmall => 'assets/icons/arrow-right-small.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrow-right.svg
|
||||||
|
String get arrowRight => 'assets/icons/arrow-right.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/arrows.svg
|
||||||
|
String get arrows => 'assets/icons/arrows.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/close-circle.svg
|
||||||
|
String get closeCircle => 'assets/icons/close-circle.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/dislike.svg
|
||||||
|
String get dislike => 'assets/icons/dislike.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/edit.svg
|
||||||
|
String get edit => 'assets/icons/edit.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/home.svg
|
||||||
|
String get home => 'assets/icons/home.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/home_active.svg
|
||||||
|
String get homeActive => 'assets/icons/home_active.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/like.svg
|
||||||
|
String get like => 'assets/icons/like.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/location.svg
|
||||||
|
String get location => 'assets/icons/location.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/profile-circle.svg
|
||||||
|
String get profileCircle => 'assets/icons/profile-circle.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/profile-circle_active.svg
|
||||||
|
String get profileCircleActive => 'assets/icons/profile-circle_active.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/shield.svg
|
||||||
|
String get shield => 'assets/icons/shield.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/task-square_active.svg
|
||||||
|
String get taskSquareActive => 'assets/icons/task-square_active.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/task_square.svg
|
||||||
|
String get taskSquare => 'assets/icons/task_square.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/tenderLogo.png
|
||||||
|
AssetGenImage get tenderLogoPng =>
|
||||||
|
const AssetGenImage('assets/icons/tenderLogo.png');
|
||||||
|
|
||||||
|
/// File path: assets/icons/tenderLogo.svg
|
||||||
|
String get tenderLogoSvg => 'assets/icons/tenderLogo.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/thumb.svg
|
||||||
|
String get thumb => 'assets/icons/thumb.svg';
|
||||||
|
|
||||||
|
/// File path: assets/icons/tick-circle.svg
|
||||||
|
String get tickCircle => 'assets/icons/tick-circle.svg';
|
||||||
|
|
||||||
|
/// List of all assets
|
||||||
|
List<dynamic> get values => [
|
||||||
|
se,
|
||||||
|
arrowCircleLeft,
|
||||||
|
arrowCircleRight,
|
||||||
|
arrowLeftSmall,
|
||||||
|
arrowRightSmall,
|
||||||
|
arrowRight,
|
||||||
|
arrows,
|
||||||
|
closeCircle,
|
||||||
|
dislike,
|
||||||
|
edit,
|
||||||
|
home,
|
||||||
|
homeActive,
|
||||||
|
like,
|
||||||
|
location,
|
||||||
|
profileCircle,
|
||||||
|
profileCircleActive,
|
||||||
|
shield,
|
||||||
|
taskSquareActive,
|
||||||
|
taskSquare,
|
||||||
|
tenderLogoPng,
|
||||||
|
tenderLogoSvg,
|
||||||
|
thumb,
|
||||||
|
tickCircle,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class $AssetsPngsGen {
|
||||||
|
const $AssetsPngsGen();
|
||||||
|
|
||||||
|
/// File path: assets/pngs/logo.png
|
||||||
|
AssetGenImage get logo => const AssetGenImage('assets/pngs/logo.png');
|
||||||
|
|
||||||
|
/// List of all assets
|
||||||
|
List<AssetGenImage> get values => [logo];
|
||||||
|
}
|
||||||
|
|
||||||
|
class $AssetsSvgsGen {
|
||||||
|
const $AssetsSvgsGen();
|
||||||
|
|
||||||
|
/// File path: assets/svgs/arrow_left.svg
|
||||||
|
String get arrowLeft => 'assets/svgs/arrow_left.svg';
|
||||||
|
|
||||||
|
/// File path: assets/svgs/export.svg
|
||||||
|
String get export => 'assets/svgs/export.svg';
|
||||||
|
|
||||||
|
/// File path: assets/svgs/password_icon.svg
|
||||||
|
String get passwordIcon => 'assets/svgs/password_icon.svg';
|
||||||
|
|
||||||
|
/// File path: assets/svgs/password_visibility.svg
|
||||||
|
String get passwordVisibility => 'assets/svgs/password_visibility.svg';
|
||||||
|
|
||||||
|
/// File path: assets/svgs/user_icon.svg
|
||||||
|
String get userIcon => 'assets/svgs/user_icon.svg';
|
||||||
|
|
||||||
|
/// List of all assets
|
||||||
|
List<String> get values => [
|
||||||
|
arrowLeft,
|
||||||
|
export,
|
||||||
|
passwordIcon,
|
||||||
|
passwordVisibility,
|
||||||
|
userIcon,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class Assets {
|
||||||
|
const Assets._();
|
||||||
|
|
||||||
|
static const $AssetsIconsGen icons = $AssetsIconsGen();
|
||||||
|
static const $AssetsPngsGen pngs = $AssetsPngsGen();
|
||||||
|
static const $AssetsSvgsGen svgs = $AssetsSvgsGen();
|
||||||
|
}
|
||||||
|
|
||||||
|
class AssetGenImage {
|
||||||
|
const AssetGenImage(
|
||||||
|
this._assetName, {
|
||||||
|
this.size,
|
||||||
|
this.flavors = const {},
|
||||||
|
this.animation,
|
||||||
|
});
|
||||||
|
|
||||||
|
final String _assetName;
|
||||||
|
|
||||||
|
final Size? size;
|
||||||
|
final Set<String> flavors;
|
||||||
|
final AssetGenImageAnimation? animation;
|
||||||
|
|
||||||
|
Image image({
|
||||||
|
Key? key,
|
||||||
|
AssetBundle? bundle,
|
||||||
|
ImageFrameBuilder? frameBuilder,
|
||||||
|
ImageErrorWidgetBuilder? errorBuilder,
|
||||||
|
String? semanticLabel,
|
||||||
|
bool excludeFromSemantics = false,
|
||||||
|
double? scale,
|
||||||
|
double? width,
|
||||||
|
double? height,
|
||||||
|
Color? color,
|
||||||
|
Animation<double>? opacity,
|
||||||
|
BlendMode? colorBlendMode,
|
||||||
|
BoxFit? fit,
|
||||||
|
AlignmentGeometry alignment = Alignment.center,
|
||||||
|
ImageRepeat repeat = ImageRepeat.noRepeat,
|
||||||
|
Rect? centerSlice,
|
||||||
|
bool matchTextDirection = false,
|
||||||
|
bool gaplessPlayback = true,
|
||||||
|
bool isAntiAlias = false,
|
||||||
|
String? package,
|
||||||
|
FilterQuality filterQuality = FilterQuality.medium,
|
||||||
|
int? cacheWidth,
|
||||||
|
int? cacheHeight,
|
||||||
|
}) {
|
||||||
|
return Image.asset(
|
||||||
|
_assetName,
|
||||||
|
key: key,
|
||||||
|
bundle: bundle,
|
||||||
|
frameBuilder: frameBuilder,
|
||||||
|
errorBuilder: errorBuilder,
|
||||||
|
semanticLabel: semanticLabel,
|
||||||
|
excludeFromSemantics: excludeFromSemantics,
|
||||||
|
scale: scale,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
color: color,
|
||||||
|
opacity: opacity,
|
||||||
|
colorBlendMode: colorBlendMode,
|
||||||
|
fit: fit,
|
||||||
|
alignment: alignment,
|
||||||
|
repeat: repeat,
|
||||||
|
centerSlice: centerSlice,
|
||||||
|
matchTextDirection: matchTextDirection,
|
||||||
|
gaplessPlayback: gaplessPlayback,
|
||||||
|
isAntiAlias: isAntiAlias,
|
||||||
|
package: package,
|
||||||
|
filterQuality: filterQuality,
|
||||||
|
cacheWidth: cacheWidth,
|
||||||
|
cacheHeight: cacheHeight,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageProvider provider({AssetBundle? bundle, String? package}) {
|
||||||
|
return AssetImage(_assetName, bundle: bundle, package: package);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get path => _assetName;
|
||||||
|
|
||||||
|
String get keyName => _assetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AssetGenImageAnimation {
|
||||||
|
const AssetGenImageAnimation({
|
||||||
|
required this.isAnimation,
|
||||||
|
required this.duration,
|
||||||
|
required this.frames,
|
||||||
|
});
|
||||||
|
|
||||||
|
final bool isAnimation;
|
||||||
|
final Duration duration;
|
||||||
|
final int frames;
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:tm_app/core/utils/result.dart';
|
||||||
|
import 'package:tm_app/data/services/model/home/home_request/home_request_model.dart';
|
||||||
|
|
||||||
|
import '../data/repositories/home_repository.dart';
|
||||||
|
import '../data/services/model/home/home_response/home_response_model.dart';
|
||||||
|
|
||||||
|
class HomeViewModel with ChangeNotifier {
|
||||||
|
final HomeRepository _homeRepository;
|
||||||
|
|
||||||
|
HomeViewModel({required HomeRepository homeRepository})
|
||||||
|
: _homeRepository = homeRepository {
|
||||||
|
getHome(homeRequestModel: HomeRequestModel(id: '1'));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _isLoading = false;
|
||||||
|
String? _errorMessage;
|
||||||
|
HomeResponseModel? _homeResponse;
|
||||||
|
|
||||||
|
bool get isLoading => _isLoading;
|
||||||
|
String? get errorMessage => _errorMessage;
|
||||||
|
HomeResponseModel? get homeResponse => _homeResponse;
|
||||||
|
|
||||||
|
Future<void> getHome({HomeRequestModel? homeRequestModel}) async {
|
||||||
|
_isLoading = true;
|
||||||
|
_errorMessage = null;
|
||||||
|
notifyListeners();
|
||||||
|
|
||||||
|
final result = await _homeRepository.getHome(
|
||||||
|
homeRequestModel: homeRequestModel,
|
||||||
|
);
|
||||||
|
|
||||||
|
switch (result) {
|
||||||
|
case Ok<HomeResponseModel>():
|
||||||
|
_homeResponse = result.value;
|
||||||
|
break;
|
||||||
|
case Error<HomeResponseModel>():
|
||||||
|
_errorMessage = result.error.toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isLoading = false;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/core/routes/app_routes.dart';
|
import 'package:tm_app/core/routes/app_routes.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/home/home_response/home_response_model.dart';
|
||||||
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
|
|
||||||
import '../widgets.dart';
|
import '../widgets.dart';
|
||||||
|
|
||||||
@@ -12,49 +15,63 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: Consumer<HomeViewModel>(
|
||||||
|
builder: (context, homeViewModel, child) {
|
||||||
|
if (homeViewModel.isLoading) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (homeViewModel.errorMessage != null) {
|
||||||
|
return Center(child: Text(homeViewModel.errorMessage!));
|
||||||
|
}
|
||||||
|
|
||||||
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 55),
|
SizedBox(height: 55),
|
||||||
_progressBarsRow(),
|
_progressBarsRow(homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_firstTenderCardsRow(context),
|
_firstTenderCardsRow(context, homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_yourTenderText(),
|
_yourTenderText(),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
_bottomListView(),
|
_bottomListView(homeViewModel.homeResponse!),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow() {
|
Widget _progressBarsRow(HomeResponseModel homeResponse) {
|
||||||
return Row(
|
return Row(
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: 0.75,
|
value: double.parse(homeResponse.partnership ?? '0'),
|
||||||
amount: '75%',
|
amount: homeResponse.partnership ?? '0',
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
SizedBox(width: 106),
|
SizedBox(width: 106),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: 0.88,
|
value: double.parse(homeResponse.selfApply ?? '0'),
|
||||||
amount: '12',
|
amount: homeResponse.selfApply ?? '0',
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
SizedBox(width: 106),
|
SizedBox(width: 106),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.contracting,
|
text: AppStrings.contracting,
|
||||||
value: 0.36,
|
value: double.parse(homeResponse.contracting ?? '0'),
|
||||||
amount: '36',
|
amount: homeResponse.contracting ?? '0',
|
||||||
circularProgressIndicatorWidth: 176,
|
circularProgressIndicatorWidth: 176,
|
||||||
circularProgressIndicatorHeight: 176,
|
circularProgressIndicatorHeight: 176,
|
||||||
),
|
),
|
||||||
@@ -62,7 +79,10 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _firstTenderCardsRow(BuildContext context) {
|
Widget _firstTenderCardsRow(
|
||||||
|
BuildContext context,
|
||||||
|
HomeResponseModel homeResponse,
|
||||||
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -70,7 +90,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: 'assets/icons/arrows.svg',
|
iconPath: 'assets/icons/arrows.svg',
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount: '12',
|
amount: homeResponse.tenderSubmitted ?? '0',
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: Color(0xFF0164FF),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
@@ -84,7 +104,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary10,
|
backgroundColor: AppColors.primary10,
|
||||||
iconPath: 'assets/icons/thumb.svg',
|
iconPath: 'assets/icons/thumb.svg',
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: '03',
|
amount: homeResponse.approvedTenders ?? '0',
|
||||||
textColor: Color(0xFF24848E),
|
textColor: Color(0xFF24848E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
@@ -98,7 +118,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.orange10,
|
backgroundColor: AppColors.orange10,
|
||||||
iconPath: 'assets/icons/shield.svg',
|
iconPath: 'assets/icons/shield.svg',
|
||||||
title: AppStrings.tenderValue,
|
title: AppStrings.tenderValue,
|
||||||
amount: '\$250,000',
|
amount: homeResponse.tenderValue ?? '0',
|
||||||
textColor: Color(0xFFE5821E),
|
textColor: Color(0xFFE5821E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: 178,
|
width: 178,
|
||||||
@@ -110,7 +130,7 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.grey10,
|
backgroundColor: AppColors.grey10,
|
||||||
iconPath: 'assets/icons/edit.svg',
|
iconPath: 'assets/icons/edit.svg',
|
||||||
title: AppStrings.thunderStatus,
|
title: AppStrings.thunderStatus,
|
||||||
amount: '23',
|
amount: homeResponse.thunderStatus ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
textColor: Color(0xFF9E9E9E),
|
||||||
enableTap: false,
|
enableTap: false,
|
||||||
width: 178,
|
width: 178,
|
||||||
@@ -138,15 +158,15 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomListView() {
|
Widget _bottomListView(HomeResponseModel homeResponse) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 740,
|
width: 740,
|
||||||
height: 310.0.h(),
|
height: 310.0.h(),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: 10,
|
itemCount: homeResponse.yourTenders?.length ?? 0,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return TendersListItem();
|
return TendersListItem(tender: homeResponse.yourTenders![index]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tm_app/core/constants/assets.dart';
|
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/routes/app_routes.dart';
|
import 'package:tm_app/core/routes/app_routes.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/home/home_response/home_response_model.dart';
|
||||||
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
import 'package:tm_app/views/shared/tender_app_bar.dart';
|
||||||
|
|
||||||
import '../widgets.dart';
|
import '../widgets.dart';
|
||||||
@@ -15,27 +18,69 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: tenderMobileAppBar(title: AppStrings.home),
|
appBar: tenderMobileAppBar(title: AppStrings.home),
|
||||||
body: SingleChildScrollView(
|
body: Consumer<HomeViewModel>(
|
||||||
|
builder: (context, homeViewModel, child) {
|
||||||
|
if (homeViewModel.isLoading) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (homeViewModel.errorMessage != null) {
|
||||||
|
return Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(24.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 18.0.h()),
|
const Icon(
|
||||||
_progressBarsRow(),
|
Icons.error_outline,
|
||||||
SizedBox(height: 32.0.h()),
|
size: 64,
|
||||||
_firstTenderCardsRow(context),
|
color: Colors.red,
|
||||||
SizedBox(height: 8.0.h()),
|
),
|
||||||
_secondTenderCardsRow(),
|
const SizedBox(height: 16),
|
||||||
SizedBox(height: 32.0.h()),
|
Text(
|
||||||
_yourTenderText(),
|
homeViewModel.errorMessage!,
|
||||||
SizedBox(height: 8.0.h()),
|
textAlign: TextAlign.center,
|
||||||
_bottomListView(),
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.grey.shade700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => homeViewModel.getHome(),
|
||||||
|
child: const Text('Try Again'),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow() {
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 18.0.h()),
|
||||||
|
_progressBarsRow(homeViewModel.homeResponse!),
|
||||||
|
SizedBox(height: 32.0.h()),
|
||||||
|
_firstTenderCardsRow(context, homeViewModel.homeResponse!),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
_secondTenderCardsRow(homeViewModel.homeResponse!),
|
||||||
|
SizedBox(height: 32.0.h()),
|
||||||
|
_yourTenderText(),
|
||||||
|
SizedBox(height: 8.0.h()),
|
||||||
|
_bottomListView(homeViewModel.homeResponse!),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _progressBarsRow(HomeResponseModel homeResponse) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -43,25 +88,28 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: 0.75,
|
value: double.parse(homeResponse.partnership ?? '0'),
|
||||||
amount: '75%',
|
amount: '${homeResponse.partnership}%',
|
||||||
),
|
),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: 0.88,
|
value: double.parse(homeResponse.selfApply ?? '0'),
|
||||||
amount: '12',
|
amount: homeResponse.selfApply ?? '0',
|
||||||
),
|
),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.contracting,
|
text: AppStrings.contracting,
|
||||||
value: 0.36,
|
value: double.parse(homeResponse.contracting ?? '0'),
|
||||||
amount: '36',
|
amount: homeResponse.contracting ?? '0',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _firstTenderCardsRow(BuildContext context) {
|
Widget _firstTenderCardsRow(
|
||||||
|
BuildContext context,
|
||||||
|
HomeResponseModel homeResponse,
|
||||||
|
) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -71,7 +119,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: AssetsManager.arrows,
|
iconPath: AssetsManager.arrows,
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount: '12',
|
amount: homeResponse.tenderSubmitted ?? '0',
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: Color(0xFF0164FF),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -82,7 +130,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary10,
|
backgroundColor: AppColors.primary10,
|
||||||
iconPath: AssetsManager.thumb,
|
iconPath: AssetsManager.thumb,
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: '03',
|
amount: homeResponse.approvedTenders ?? '0',
|
||||||
textColor: Color(0xFF24848E),
|
textColor: Color(0xFF24848E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -94,7 +142,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _secondTenderCardsRow() {
|
Widget _secondTenderCardsRow(HomeResponseModel homeResponse) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -104,7 +152,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.orange10,
|
backgroundColor: AppColors.orange10,
|
||||||
iconPath: AssetsManager.shield,
|
iconPath: AssetsManager.shield,
|
||||||
title: AppStrings.tenderValue,
|
title: AppStrings.tenderValue,
|
||||||
amount: '\$250,000',
|
amount: homeResponse.tenderValue ?? '0',
|
||||||
textColor: Color(0xFFE5821E),
|
textColor: Color(0xFFE5821E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
@@ -113,7 +161,7 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.grey10,
|
backgroundColor: AppColors.grey10,
|
||||||
iconPath: AssetsManager.edit,
|
iconPath: AssetsManager.edit,
|
||||||
title: AppStrings.thunderStatus,
|
title: AppStrings.thunderStatus,
|
||||||
amount: '23',
|
amount: homeResponse.thunderStatus ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
textColor: Color(0xFF9E9E9E),
|
||||||
enableTap: false,
|
enableTap: false,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
@@ -137,16 +185,16 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomListView() {
|
Widget _bottomListView(HomeResponseModel homeResponse) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 310.0.h(),
|
height: 286.0.h(),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w(), vertical: 16.0.h()),
|
||||||
itemCount: 10,
|
itemCount: homeResponse.yourTenders?.length ?? 0,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return TendersListItem();
|
return TendersListItem(tender: homeResponse.yourTenders![index]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/core/routes/app_routes.dart';
|
import 'package:tm_app/core/routes/app_routes.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/home/home_response/home_response_model.dart';
|
||||||
|
import 'package:tm_app/view_models/home_view_model.dart';
|
||||||
|
|
||||||
import '../widgets.dart';
|
import '../widgets.dart';
|
||||||
|
|
||||||
@@ -12,7 +15,19 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: Consumer<HomeViewModel>(
|
||||||
|
builder: (context, homeViewModel, child) {
|
||||||
|
if (homeViewModel.isLoading) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (homeViewModel.errorMessage != null) {
|
||||||
|
return Center(child: Text(homeViewModel.errorMessage!));
|
||||||
|
}
|
||||||
|
|
||||||
|
return SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
24.0.w(),
|
24.0.w(),
|
||||||
@@ -23,46 +38,48 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_progressBarsRow(),
|
_progressBarsRow(homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_firstTenderCardsRow(context),
|
_firstTenderCardsRow(context, homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
_secondTenderCardsRow(),
|
_secondTenderCardsRow(homeViewModel.homeResponse!),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
_yourTenderText(),
|
_yourTenderText(),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
_bottomListView(),
|
_bottomListView(homeViewModel.homeResponse!),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _progressBarsRow() {
|
Widget _progressBarsRow(HomeResponseModel homeResponse) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.partnership,
|
text: AppStrings.partnership,
|
||||||
value: 0.75,
|
value: double.parse(homeResponse.partnership ?? '0'),
|
||||||
amount: '75%',
|
amount: homeResponse.partnership ?? '0',
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
),
|
),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.selfApply,
|
text: AppStrings.selfApply,
|
||||||
value: 0.88,
|
value: double.parse(homeResponse.selfApply ?? '0'),
|
||||||
amount: '12',
|
amount: homeResponse.selfApply ?? '0',
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
),
|
),
|
||||||
ProgressBarColumn(
|
ProgressBarColumn(
|
||||||
text: AppStrings.contracting,
|
text: AppStrings.contracting,
|
||||||
value: 0.36,
|
value: double.parse(homeResponse.contracting ?? '0'),
|
||||||
amount: '36',
|
amount: homeResponse.contracting ?? '0',
|
||||||
circularProgressIndicatorWidth: 176.0,
|
circularProgressIndicatorWidth: 176.0,
|
||||||
circularProgressIndicatorHeight: 176.0,
|
circularProgressIndicatorHeight: 176.0,
|
||||||
strokeWidth: 8.0,
|
strokeWidth: 8.0,
|
||||||
@@ -71,7 +88,10 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _firstTenderCardsRow(BuildContext context) {
|
Widget _firstTenderCardsRow(
|
||||||
|
BuildContext context,
|
||||||
|
HomeResponseModel homeResponse,
|
||||||
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -80,7 +100,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary20,
|
backgroundColor: AppColors.primary20,
|
||||||
iconPath: 'assets/icons/arrows.svg',
|
iconPath: 'assets/icons/arrows.svg',
|
||||||
title: AppStrings.tenderSubmitted,
|
title: AppStrings.tenderSubmitted,
|
||||||
amount: '12',
|
amount: homeResponse.tenderSubmitted ?? '0',
|
||||||
textColor: Color(0xFF0164FF),
|
textColor: Color(0xFF0164FF),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -96,7 +116,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.primary10,
|
backgroundColor: AppColors.primary10,
|
||||||
iconPath: 'assets/icons/thumb.svg',
|
iconPath: 'assets/icons/thumb.svg',
|
||||||
title: AppStrings.approvedTenders,
|
title: AppStrings.approvedTenders,
|
||||||
amount: '03',
|
amount: homeResponse.approvedTenders ?? '0',
|
||||||
textColor: Color(0xFF24848E),
|
textColor: Color(0xFF24848E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -110,7 +130,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _secondTenderCardsRow() {
|
Widget _secondTenderCardsRow(HomeResponseModel homeResponse) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -119,7 +139,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.orange10,
|
backgroundColor: AppColors.orange10,
|
||||||
iconPath: 'assets/icons/shield.svg',
|
iconPath: 'assets/icons/shield.svg',
|
||||||
title: AppStrings.tenderValue,
|
title: AppStrings.tenderValue,
|
||||||
amount: '\$250,000',
|
amount: homeResponse.tenderValue ?? '0',
|
||||||
textColor: Color(0xFFE5821E),
|
textColor: Color(0xFFE5821E),
|
||||||
enableTap: true,
|
enableTap: true,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -133,7 +153,7 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
backgroundColor: AppColors.grey10,
|
backgroundColor: AppColors.grey10,
|
||||||
iconPath: 'assets/icons/edit.svg',
|
iconPath: 'assets/icons/edit.svg',
|
||||||
title: AppStrings.thunderStatus,
|
title: AppStrings.thunderStatus,
|
||||||
amount: '23',
|
amount: homeResponse.thunderStatus ?? '0',
|
||||||
textColor: Color(0xFF9E9E9E),
|
textColor: Color(0xFF9E9E9E),
|
||||||
enableTap: false,
|
enableTap: false,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -156,15 +176,15 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomListView() {
|
Widget _bottomListView(HomeResponseModel homeResponse) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 310.0.h(),
|
height: 310.0.h(),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: 10,
|
itemCount: homeResponse.yourTenders?.length ?? 0,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return TendersListItem();
|
return TendersListItem(tender: homeResponse.yourTenders![index]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class _ProgressBarColumnState extends State<ProgressBarColumn>
|
|||||||
// Create a Tween animation from 0.0 to 0.75
|
// Create a Tween animation from 0.0 to 0.75
|
||||||
_animation = Tween<double>(
|
_animation = Tween<double>(
|
||||||
begin: 0.0,
|
begin: 0.0,
|
||||||
end: widget.value,
|
end: widget.value / 100,
|
||||||
).animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut));
|
).animate(CurvedAnimation(parent: _controller, curve: Curves.easeOut));
|
||||||
|
|
||||||
// Start the animation
|
// Start the animation
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
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/data/services/model/home/tender/tender_model.dart';
|
||||||
|
|
||||||
import '../../core/constants/assets.dart';
|
import '../../core/constants/assets.dart';
|
||||||
import '../../core/theme/colors.dart';
|
import '../../core/theme/colors.dart';
|
||||||
import '../../core/utils/size_config.dart';
|
import '../../core/utils/size_config.dart';
|
||||||
|
|
||||||
class TendersListItem extends StatelessWidget {
|
class TendersListItem extends StatelessWidget {
|
||||||
const TendersListItem({super.key});
|
const TendersListItem({required this.tender, super.key});
|
||||||
|
final TenderModel tender;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -17,7 +19,7 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
margin: EdgeInsetsDirectional.only(end: 16.0.w()),
|
margin: EdgeInsetsDirectional.only(end: 16.0.w()),
|
||||||
width: 320.0.w(),
|
width: 320.0.w(),
|
||||||
height: 309.0.h(),
|
height: 280.0.h(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 16.0.h()),
|
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 16.0.h()),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -26,7 +28,7 @@ class TendersListItem extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'2025-05-21',
|
tender.createdTime ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.0.sp(),
|
fontSize: 12.0.sp(),
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@@ -42,7 +44,7 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Completed',
|
tender.status ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.0.sp(),
|
fontSize: 12.0.sp(),
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@@ -54,7 +56,7 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 12.0.h()),
|
SizedBox(height: 12.0.h()),
|
||||||
Text(
|
Text(
|
||||||
'Lorem ipsum dolor sit amet consectetur. Sed mi tortor eu purus senectus.',
|
tender.title ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.0.sp(),
|
fontSize: 16.0.sp(),
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -63,7 +65,9 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
Text(
|
Text(
|
||||||
'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. Suscipit ...',
|
tender.description ?? '',
|
||||||
|
maxLines: 3,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0.sp(),
|
fontSize: 14.0.sp(),
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@@ -76,7 +80,7 @@ class TendersListItem extends StatelessWidget {
|
|||||||
SvgPicture.asset(AssetsManager.location),
|
SvgPicture.asset(AssetsManager.location),
|
||||||
SizedBox(width: 1.0.w()),
|
SizedBox(width: 1.0.w()),
|
||||||
Text(
|
Text(
|
||||||
'Location',
|
tender.location ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.0.sp(),
|
fontSize: 12.0.sp(),
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@@ -99,7 +103,7 @@ class TendersListItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
'Self Control',
|
tender.type ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.0.sp(),
|
fontSize: 12.0.sp(),
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ dev_dependencies:
|
|||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^5.0.0
|
flutter_lints: ^5.0.0
|
||||||
|
flutter_gen_runner:
|
||||||
build_runner: ^2.5.4
|
build_runner: ^2.5.4
|
||||||
go_router_builder: ^3.0.0
|
go_router_builder: ^3.0.0
|
||||||
|
json_serializable: ^6.9.5
|
||||||
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
|||||||
Reference in New Issue
Block a user