feat: outlet information page

This commit is contained in:
efrilm 2025-08-19 11:08:33 +07:00
parent de11c1243c
commit 590bb3329c
21 changed files with 2652 additions and 104 deletions

View File

@ -0,0 +1,40 @@
import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../../domain/outlet/outlet.dart';
part 'current_outlet_loader_event.dart';
part 'current_outlet_loader_state.dart';
part 'current_outlet_loader_bloc.freezed.dart';
@injectable
class CurrentOutletLoaderBloc
extends Bloc<CurrentOutletLoaderEvent, CurrentOutletLoaderState> {
final IOutletRepository _repository;
CurrentOutletLoaderBloc(this._repository)
: super(CurrentOutletLoaderState.initial()) {
on<CurrentOutletLoaderEvent>(_onCurrentOutletLoaderEvent);
}
Future<void> _onCurrentOutletLoaderEvent(
CurrentOutletLoaderEvent event,
Emitter<CurrentOutletLoaderState> emit,
) {
return event.map(
fetched: (e) async {
emit(state.copyWith(isFetching: true, failureOptionOutlet: none()));
final result = await _repository.currentOutlet();
var data = result.fold(
(f) => state.copyWith(failureOptionOutlet: optionOf(f)),
(currentOutlet) => state.copyWith(outlet: currentOutlet),
);
emit(data.copyWith(isFetching: false));
},
);
}
}

View File

@ -0,0 +1,382 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'current_outlet_loader_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$CurrentOutletLoaderEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Fetched value) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Fetched value)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CurrentOutletLoaderEventCopyWith<$Res> {
factory $CurrentOutletLoaderEventCopyWith(
CurrentOutletLoaderEvent value,
$Res Function(CurrentOutletLoaderEvent) then,
) = _$CurrentOutletLoaderEventCopyWithImpl<$Res, CurrentOutletLoaderEvent>;
}
/// @nodoc
class _$CurrentOutletLoaderEventCopyWithImpl<
$Res,
$Val extends CurrentOutletLoaderEvent
>
implements $CurrentOutletLoaderEventCopyWith<$Res> {
_$CurrentOutletLoaderEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CurrentOutletLoaderEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
abstract class _$$FetchedImplCopyWith<$Res> {
factory _$$FetchedImplCopyWith(
_$FetchedImpl value,
$Res Function(_$FetchedImpl) then,
) = __$$FetchedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$FetchedImplCopyWithImpl<$Res>
extends _$CurrentOutletLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
implements _$$FetchedImplCopyWith<$Res> {
__$$FetchedImplCopyWithImpl(
_$FetchedImpl _value,
$Res Function(_$FetchedImpl) _then,
) : super(_value, _then);
/// Create a copy of CurrentOutletLoaderEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
class _$FetchedImpl implements _Fetched {
const _$FetchedImpl();
@override
String toString() {
return 'CurrentOutletLoaderEvent.fetched()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
return fetched();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
return fetched?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? fetched,
required TResult orElse(),
}) {
if (fetched != null) {
return fetched();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Fetched value) fetched,
}) {
return fetched(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Fetched value)? fetched,
}) {
return fetched?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (fetched != null) {
return fetched(this);
}
return orElse();
}
}
abstract class _Fetched implements CurrentOutletLoaderEvent {
const factory _Fetched() = _$FetchedImpl;
}
/// @nodoc
mixin _$CurrentOutletLoaderState {
Outlet get outlet => throw _privateConstructorUsedError;
Option<OutletFailure> get failureOptionOutlet =>
throw _privateConstructorUsedError;
bool get isFetching => throw _privateConstructorUsedError;
/// Create a copy of CurrentOutletLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CurrentOutletLoaderStateCopyWith<CurrentOutletLoaderState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CurrentOutletLoaderStateCopyWith<$Res> {
factory $CurrentOutletLoaderStateCopyWith(
CurrentOutletLoaderState value,
$Res Function(CurrentOutletLoaderState) then,
) = _$CurrentOutletLoaderStateCopyWithImpl<$Res, CurrentOutletLoaderState>;
@useResult
$Res call({
Outlet outlet,
Option<OutletFailure> failureOptionOutlet,
bool isFetching,
});
$OutletCopyWith<$Res> get outlet;
}
/// @nodoc
class _$CurrentOutletLoaderStateCopyWithImpl<
$Res,
$Val extends CurrentOutletLoaderState
>
implements $CurrentOutletLoaderStateCopyWith<$Res> {
_$CurrentOutletLoaderStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CurrentOutletLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? outlet = null,
Object? failureOptionOutlet = null,
Object? isFetching = null,
}) {
return _then(
_value.copyWith(
outlet: null == outlet
? _value.outlet
: outlet // ignore: cast_nullable_to_non_nullable
as Outlet,
failureOptionOutlet: null == failureOptionOutlet
? _value.failureOptionOutlet
: failureOptionOutlet // ignore: cast_nullable_to_non_nullable
as Option<OutletFailure>,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
}
/// Create a copy of CurrentOutletLoaderState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OutletCopyWith<$Res> get outlet {
return $OutletCopyWith<$Res>(_value.outlet, (value) {
return _then(_value.copyWith(outlet: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$CurrentOutletLoaderStateImplCopyWith<$Res>
implements $CurrentOutletLoaderStateCopyWith<$Res> {
factory _$$CurrentOutletLoaderStateImplCopyWith(
_$CurrentOutletLoaderStateImpl value,
$Res Function(_$CurrentOutletLoaderStateImpl) then,
) = __$$CurrentOutletLoaderStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
Outlet outlet,
Option<OutletFailure> failureOptionOutlet,
bool isFetching,
});
@override
$OutletCopyWith<$Res> get outlet;
}
/// @nodoc
class __$$CurrentOutletLoaderStateImplCopyWithImpl<$Res>
extends
_$CurrentOutletLoaderStateCopyWithImpl<
$Res,
_$CurrentOutletLoaderStateImpl
>
implements _$$CurrentOutletLoaderStateImplCopyWith<$Res> {
__$$CurrentOutletLoaderStateImplCopyWithImpl(
_$CurrentOutletLoaderStateImpl _value,
$Res Function(_$CurrentOutletLoaderStateImpl) _then,
) : super(_value, _then);
/// Create a copy of CurrentOutletLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? outlet = null,
Object? failureOptionOutlet = null,
Object? isFetching = null,
}) {
return _then(
_$CurrentOutletLoaderStateImpl(
outlet: null == outlet
? _value.outlet
: outlet // ignore: cast_nullable_to_non_nullable
as Outlet,
failureOptionOutlet: null == failureOptionOutlet
? _value.failureOptionOutlet
: failureOptionOutlet // ignore: cast_nullable_to_non_nullable
as Option<OutletFailure>,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// @nodoc
class _$CurrentOutletLoaderStateImpl implements _CurrentOutletLoaderState {
const _$CurrentOutletLoaderStateImpl({
required this.outlet,
required this.failureOptionOutlet,
this.isFetching = false,
});
@override
final Outlet outlet;
@override
final Option<OutletFailure> failureOptionOutlet;
@override
@JsonKey()
final bool isFetching;
@override
String toString() {
return 'CurrentOutletLoaderState(outlet: $outlet, failureOptionOutlet: $failureOptionOutlet, isFetching: $isFetching)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CurrentOutletLoaderStateImpl &&
(identical(other.outlet, outlet) || other.outlet == outlet) &&
(identical(other.failureOptionOutlet, failureOptionOutlet) ||
other.failureOptionOutlet == failureOptionOutlet) &&
(identical(other.isFetching, isFetching) ||
other.isFetching == isFetching));
}
@override
int get hashCode =>
Object.hash(runtimeType, outlet, failureOptionOutlet, isFetching);
/// Create a copy of CurrentOutletLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CurrentOutletLoaderStateImplCopyWith<_$CurrentOutletLoaderStateImpl>
get copyWith =>
__$$CurrentOutletLoaderStateImplCopyWithImpl<
_$CurrentOutletLoaderStateImpl
>(this, _$identity);
}
abstract class _CurrentOutletLoaderState implements CurrentOutletLoaderState {
const factory _CurrentOutletLoaderState({
required final Outlet outlet,
required final Option<OutletFailure> failureOptionOutlet,
final bool isFetching,
}) = _$CurrentOutletLoaderStateImpl;
@override
Outlet get outlet;
@override
Option<OutletFailure> get failureOptionOutlet;
@override
bool get isFetching;
/// Create a copy of CurrentOutletLoaderState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CurrentOutletLoaderStateImplCopyWith<_$CurrentOutletLoaderStateImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@ -0,0 +1,6 @@
part of 'current_outlet_loader_bloc.dart';
@freezed
class CurrentOutletLoaderEvent with _$CurrentOutletLoaderEvent {
const factory CurrentOutletLoaderEvent.fetched() = _Fetched;
}

View File

@ -0,0 +1,15 @@
part of 'current_outlet_loader_bloc.dart';
@freezed
class CurrentOutletLoaderState with _$CurrentOutletLoaderState {
const factory CurrentOutletLoaderState({
required Outlet outlet,
required Option<OutletFailure> failureOptionOutlet,
@Default(false) bool isFetching,
}) = _CurrentOutletLoaderState;
factory CurrentOutletLoaderState.initial() => CurrentOutletLoaderState(
outlet: Outlet.empty(),
failureOptionOutlet: none(),
);
}

View File

@ -27,4 +27,7 @@ class ApiPath {
// Order
static const String order = '/api/v1/orders';
// Outlet
static const String outlet = '/api/v1/outlets';
}

View File

@ -0,0 +1,32 @@
part of '../outlet.dart';
@freezed
class Outlet with _$Outlet {
const factory Outlet({
required String id,
required String organizationId,
required String name,
required String address,
required String phoneNumber,
required String businessType,
required String currency,
required int taxRate,
required bool isActive,
required DateTime createdAt,
required DateTime updatedAt,
}) = _Outlet;
factory Outlet.empty() => Outlet(
id: '',
organizationId: '',
name: '',
address: '',
phoneNumber: '',
businessType: '',
currency: '',
taxRate: 0,
isActive: false,
createdAt: DateTime(1970),
updatedAt: DateTime(1970),
);
}

View File

@ -0,0 +1,10 @@
part of '../outlet.dart';
@freezed
sealed class OutletFailure with _$OutletFailure {
const factory OutletFailure.serverError(ApiFailure failure) = _ServerError;
const factory OutletFailure.unexpectedError() = _UnexpectedError;
const factory OutletFailure.empty() = _Empty;
const factory OutletFailure.dynamicErrorMessage(String erroMessage) =
_DynamicErrorMessage;
}

View File

@ -0,0 +1,10 @@
import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import '../../common/api/api_failure.dart';
part 'outlet.freezed.dart';
part 'entities/outlet_entity.dart';
part 'failures/outlet_failure.dart';
part 'repositories/i_outlet_repository.dart';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
part of '../outlet.dart';
abstract class IOutletRepository {
Future<Either<OutletFailure, Outlet>> currentOutlet();
}

View File

@ -0,0 +1,39 @@
import 'dart:developer';
import 'package:data_channel/data_channel.dart';
import 'package:injectable/injectable.dart';
import '../../../common/api/api_client.dart';
import '../../../common/api/api_failure.dart';
import '../../../common/function/app_function.dart';
import '../../../common/url/api_path.dart';
import '../../../domain/outlet/outlet.dart';
import '../outlet_dtos.dart';
@injectable
class OutletRemoteDataProvider {
final ApiClient _apiClient;
final String _logName = 'OutletRemoteDataProvider';
OutletRemoteDataProvider(this._apiClient);
Future<DC<OutletFailure, OutletDto>> fetchById({required outletId}) async {
try {
final response = await _apiClient.get(
'${ApiPath.outlet}/detail/$outletId',
headers: getAuthorizationHeader(),
);
if (response.data['data'] == null) {
return DC.error(OutletFailure.empty());
}
final dto = OutletDto.fromJson(response.data['data']);
return DC.data(dto);
} on ApiFailure catch (e, s) {
log('fetchOutletByIdError', name: _logName, error: e, stackTrace: s);
return DC.error(OutletFailure.serverError(e));
}
}
}

View File

@ -0,0 +1,44 @@
part of '../outlet_dtos.dart';
@freezed
class OutletDto with _$OutletDto {
const OutletDto._();
const factory OutletDto({
@JsonKey(name: 'id') String? id,
@JsonKey(name: 'organization_id') String? organizationId,
@JsonKey(name: 'name') String? name,
@JsonKey(name: 'address') String? address,
@JsonKey(name: 'phone_number') String? phoneNumber,
@JsonKey(name: 'business_type') String? businessType,
@JsonKey(name: 'currency') String? currency,
@JsonKey(name: 'tax_rate') int? taxRate,
@JsonKey(name: 'is_active') bool? isActive,
@JsonKey(name: 'created_at') String? createdAt,
@JsonKey(name: 'updated_at') String? updatedAt,
}) = _OutletDto;
factory OutletDto.fromJson(Map<String, dynamic> json) =>
_$OutletDtoFromJson(json);
/// Mapper ke domain
Outlet toDomain() {
return Outlet(
id: id ?? '',
organizationId: organizationId ?? '',
name: name ?? '',
address: address ?? '',
phoneNumber: phoneNumber ?? '',
businessType: businessType ?? '',
currency: currency ?? '',
taxRate: taxRate ?? 0,
isActive: isActive ?? false,
createdAt: createdAt != null
? DateTime.tryParse(createdAt!) ?? DateTime(1970)
: DateTime(1970),
updatedAt: updatedAt != null
? DateTime.tryParse(updatedAt!) ?? DateTime(1970)
: DateTime(1970),
);
}
}

View File

@ -0,0 +1,8 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import '../../domain/outlet/outlet.dart';
part 'outlet_dtos.freezed.dart';
part 'outlet_dtos.g.dart';
part 'dto/outlet_dto.dart';

View File

@ -0,0 +1,431 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'outlet_dtos.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
OutletDto _$OutletDtoFromJson(Map<String, dynamic> json) {
return _OutletDto.fromJson(json);
}
/// @nodoc
mixin _$OutletDto {
@JsonKey(name: 'id')
String? get id => throw _privateConstructorUsedError;
@JsonKey(name: 'organization_id')
String? get organizationId => throw _privateConstructorUsedError;
@JsonKey(name: 'name')
String? get name => throw _privateConstructorUsedError;
@JsonKey(name: 'address')
String? get address => throw _privateConstructorUsedError;
@JsonKey(name: 'phone_number')
String? get phoneNumber => throw _privateConstructorUsedError;
@JsonKey(name: 'business_type')
String? get businessType => throw _privateConstructorUsedError;
@JsonKey(name: 'currency')
String? get currency => throw _privateConstructorUsedError;
@JsonKey(name: 'tax_rate')
int? get taxRate => throw _privateConstructorUsedError;
@JsonKey(name: 'is_active')
bool? get isActive => throw _privateConstructorUsedError;
@JsonKey(name: 'created_at')
String? get createdAt => throw _privateConstructorUsedError;
@JsonKey(name: 'updated_at')
String? get updatedAt => throw _privateConstructorUsedError;
/// Serializes this OutletDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of OutletDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$OutletDtoCopyWith<OutletDto> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OutletDtoCopyWith<$Res> {
factory $OutletDtoCopyWith(OutletDto value, $Res Function(OutletDto) then) =
_$OutletDtoCopyWithImpl<$Res, OutletDto>;
@useResult
$Res call({
@JsonKey(name: 'id') String? id,
@JsonKey(name: 'organization_id') String? organizationId,
@JsonKey(name: 'name') String? name,
@JsonKey(name: 'address') String? address,
@JsonKey(name: 'phone_number') String? phoneNumber,
@JsonKey(name: 'business_type') String? businessType,
@JsonKey(name: 'currency') String? currency,
@JsonKey(name: 'tax_rate') int? taxRate,
@JsonKey(name: 'is_active') bool? isActive,
@JsonKey(name: 'created_at') String? createdAt,
@JsonKey(name: 'updated_at') String? updatedAt,
});
}
/// @nodoc
class _$OutletDtoCopyWithImpl<$Res, $Val extends OutletDto>
implements $OutletDtoCopyWith<$Res> {
_$OutletDtoCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OutletDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? organizationId = freezed,
Object? name = freezed,
Object? address = freezed,
Object? phoneNumber = freezed,
Object? businessType = freezed,
Object? currency = freezed,
Object? taxRate = freezed,
Object? isActive = freezed,
Object? createdAt = freezed,
Object? updatedAt = freezed,
}) {
return _then(
_value.copyWith(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
organizationId: freezed == organizationId
? _value.organizationId
: organizationId // ignore: cast_nullable_to_non_nullable
as String?,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
address: freezed == address
? _value.address
: address // ignore: cast_nullable_to_non_nullable
as String?,
phoneNumber: freezed == phoneNumber
? _value.phoneNumber
: phoneNumber // ignore: cast_nullable_to_non_nullable
as String?,
businessType: freezed == businessType
? _value.businessType
: businessType // ignore: cast_nullable_to_non_nullable
as String?,
currency: freezed == currency
? _value.currency
: currency // ignore: cast_nullable_to_non_nullable
as String?,
taxRate: freezed == taxRate
? _value.taxRate
: taxRate // ignore: cast_nullable_to_non_nullable
as int?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
createdAt: freezed == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as String?,
updatedAt: freezed == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$OutletDtoImplCopyWith<$Res>
implements $OutletDtoCopyWith<$Res> {
factory _$$OutletDtoImplCopyWith(
_$OutletDtoImpl value,
$Res Function(_$OutletDtoImpl) then,
) = __$$OutletDtoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: 'id') String? id,
@JsonKey(name: 'organization_id') String? organizationId,
@JsonKey(name: 'name') String? name,
@JsonKey(name: 'address') String? address,
@JsonKey(name: 'phone_number') String? phoneNumber,
@JsonKey(name: 'business_type') String? businessType,
@JsonKey(name: 'currency') String? currency,
@JsonKey(name: 'tax_rate') int? taxRate,
@JsonKey(name: 'is_active') bool? isActive,
@JsonKey(name: 'created_at') String? createdAt,
@JsonKey(name: 'updated_at') String? updatedAt,
});
}
/// @nodoc
class __$$OutletDtoImplCopyWithImpl<$Res>
extends _$OutletDtoCopyWithImpl<$Res, _$OutletDtoImpl>
implements _$$OutletDtoImplCopyWith<$Res> {
__$$OutletDtoImplCopyWithImpl(
_$OutletDtoImpl _value,
$Res Function(_$OutletDtoImpl) _then,
) : super(_value, _then);
/// Create a copy of OutletDto
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = freezed,
Object? organizationId = freezed,
Object? name = freezed,
Object? address = freezed,
Object? phoneNumber = freezed,
Object? businessType = freezed,
Object? currency = freezed,
Object? taxRate = freezed,
Object? isActive = freezed,
Object? createdAt = freezed,
Object? updatedAt = freezed,
}) {
return _then(
_$OutletDtoImpl(
id: freezed == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String?,
organizationId: freezed == organizationId
? _value.organizationId
: organizationId // ignore: cast_nullable_to_non_nullable
as String?,
name: freezed == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String?,
address: freezed == address
? _value.address
: address // ignore: cast_nullable_to_non_nullable
as String?,
phoneNumber: freezed == phoneNumber
? _value.phoneNumber
: phoneNumber // ignore: cast_nullable_to_non_nullable
as String?,
businessType: freezed == businessType
? _value.businessType
: businessType // ignore: cast_nullable_to_non_nullable
as String?,
currency: freezed == currency
? _value.currency
: currency // ignore: cast_nullable_to_non_nullable
as String?,
taxRate: freezed == taxRate
? _value.taxRate
: taxRate // ignore: cast_nullable_to_non_nullable
as int?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
createdAt: freezed == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as String?,
updatedAt: freezed == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$OutletDtoImpl extends _OutletDto {
const _$OutletDtoImpl({
@JsonKey(name: 'id') this.id,
@JsonKey(name: 'organization_id') this.organizationId,
@JsonKey(name: 'name') this.name,
@JsonKey(name: 'address') this.address,
@JsonKey(name: 'phone_number') this.phoneNumber,
@JsonKey(name: 'business_type') this.businessType,
@JsonKey(name: 'currency') this.currency,
@JsonKey(name: 'tax_rate') this.taxRate,
@JsonKey(name: 'is_active') this.isActive,
@JsonKey(name: 'created_at') this.createdAt,
@JsonKey(name: 'updated_at') this.updatedAt,
}) : super._();
factory _$OutletDtoImpl.fromJson(Map<String, dynamic> json) =>
_$$OutletDtoImplFromJson(json);
@override
@JsonKey(name: 'id')
final String? id;
@override
@JsonKey(name: 'organization_id')
final String? organizationId;
@override
@JsonKey(name: 'name')
final String? name;
@override
@JsonKey(name: 'address')
final String? address;
@override
@JsonKey(name: 'phone_number')
final String? phoneNumber;
@override
@JsonKey(name: 'business_type')
final String? businessType;
@override
@JsonKey(name: 'currency')
final String? currency;
@override
@JsonKey(name: 'tax_rate')
final int? taxRate;
@override
@JsonKey(name: 'is_active')
final bool? isActive;
@override
@JsonKey(name: 'created_at')
final String? createdAt;
@override
@JsonKey(name: 'updated_at')
final String? updatedAt;
@override
String toString() {
return 'OutletDto(id: $id, organizationId: $organizationId, name: $name, address: $address, phoneNumber: $phoneNumber, businessType: $businessType, currency: $currency, taxRate: $taxRate, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OutletDtoImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.organizationId, organizationId) ||
other.organizationId == organizationId) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.address, address) || other.address == address) &&
(identical(other.phoneNumber, phoneNumber) ||
other.phoneNumber == phoneNumber) &&
(identical(other.businessType, businessType) ||
other.businessType == businessType) &&
(identical(other.currency, currency) ||
other.currency == currency) &&
(identical(other.taxRate, taxRate) || other.taxRate == taxRate) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive) &&
(identical(other.createdAt, createdAt) ||
other.createdAt == createdAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
organizationId,
name,
address,
phoneNumber,
businessType,
currency,
taxRate,
isActive,
createdAt,
updatedAt,
);
/// Create a copy of OutletDto
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OutletDtoImplCopyWith<_$OutletDtoImpl> get copyWith =>
__$$OutletDtoImplCopyWithImpl<_$OutletDtoImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$OutletDtoImplToJson(this);
}
}
abstract class _OutletDto extends OutletDto {
const factory _OutletDto({
@JsonKey(name: 'id') final String? id,
@JsonKey(name: 'organization_id') final String? organizationId,
@JsonKey(name: 'name') final String? name,
@JsonKey(name: 'address') final String? address,
@JsonKey(name: 'phone_number') final String? phoneNumber,
@JsonKey(name: 'business_type') final String? businessType,
@JsonKey(name: 'currency') final String? currency,
@JsonKey(name: 'tax_rate') final int? taxRate,
@JsonKey(name: 'is_active') final bool? isActive,
@JsonKey(name: 'created_at') final String? createdAt,
@JsonKey(name: 'updated_at') final String? updatedAt,
}) = _$OutletDtoImpl;
const _OutletDto._() : super._();
factory _OutletDto.fromJson(Map<String, dynamic> json) =
_$OutletDtoImpl.fromJson;
@override
@JsonKey(name: 'id')
String? get id;
@override
@JsonKey(name: 'organization_id')
String? get organizationId;
@override
@JsonKey(name: 'name')
String? get name;
@override
@JsonKey(name: 'address')
String? get address;
@override
@JsonKey(name: 'phone_number')
String? get phoneNumber;
@override
@JsonKey(name: 'business_type')
String? get businessType;
@override
@JsonKey(name: 'currency')
String? get currency;
@override
@JsonKey(name: 'tax_rate')
int? get taxRate;
@override
@JsonKey(name: 'is_active')
bool? get isActive;
@override
@JsonKey(name: 'created_at')
String? get createdAt;
@override
@JsonKey(name: 'updated_at')
String? get updatedAt;
/// Create a copy of OutletDto
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OutletDtoImplCopyWith<_$OutletDtoImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@ -0,0 +1,37 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'outlet_dtos.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$OutletDtoImpl _$$OutletDtoImplFromJson(Map<String, dynamic> json) =>
_$OutletDtoImpl(
id: json['id'] as String?,
organizationId: json['organization_id'] as String?,
name: json['name'] as String?,
address: json['address'] as String?,
phoneNumber: json['phone_number'] as String?,
businessType: json['business_type'] as String?,
currency: json['currency'] as String?,
taxRate: (json['tax_rate'] as num?)?.toInt(),
isActive: json['is_active'] as bool?,
createdAt: json['created_at'] as String?,
updatedAt: json['updated_at'] as String?,
);
Map<String, dynamic> _$$OutletDtoImplToJson(_$OutletDtoImpl instance) =>
<String, dynamic>{
'id': instance.id,
'organization_id': instance.organizationId,
'name': instance.name,
'address': instance.address,
'phone_number': instance.phoneNumber,
'business_type': instance.businessType,
'currency': instance.currency,
'tax_rate': instance.taxRate,
'is_active': instance.isActive,
'created_at': instance.createdAt,
'updated_at': instance.updatedAt,
};

View File

@ -0,0 +1,36 @@
import 'dart:developer';
import 'package:dartz/dartz.dart';
import 'package:injectable/injectable.dart';
import '../../../domain/outlet/outlet.dart';
import '../../auth/datasources/local_data_provider.dart';
import '../datasource/remote_data_provider.dart';
@Injectable(as: IOutletRepository)
class OutletRepository implements IOutletRepository {
final OutletRemoteDataProvider _dataProvider;
final AuthLocalDataProvider _authLocalDataProvider;
final String _logName = 'OutletRepository';
OutletRepository(this._dataProvider, this._authLocalDataProvider);
@override
Future<Either<OutletFailure, Outlet>> currentOutlet() async {
try {
final authData = await _authLocalDataProvider.currentUser();
final result = await _dataProvider.fetchById(outletId: authData.outletId);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
} catch (e, s) {
log('currentOutletError', name: _logName, error: e, stackTrace: s);
return left(const OutletFailure.unexpectedError());
}
}
}

View File

@ -36,6 +36,8 @@ import 'package:apskel_owner_flutter/application/language/language_bloc.dart'
as _i455;
import 'package:apskel_owner_flutter/application/order/order_loader/order_loader_bloc.dart'
as _i1058;
import 'package:apskel_owner_flutter/application/outlet/current_outlet_loader/current_outlet_loader_bloc.dart'
as _i337;
import 'package:apskel_owner_flutter/application/product/product_loader/product_loader_bloc.dart'
as _i458;
import 'package:apskel_owner_flutter/common/api/api_client.dart' as _i115;
@ -53,6 +55,7 @@ import 'package:apskel_owner_flutter/domain/auth/auth.dart' as _i49;
import 'package:apskel_owner_flutter/domain/category/category.dart' as _i1020;
import 'package:apskel_owner_flutter/domain/customer/customer.dart' as _i48;
import 'package:apskel_owner_flutter/domain/order/order.dart' as _i219;
import 'package:apskel_owner_flutter/domain/outlet/outlet.dart' as _i197;
import 'package:apskel_owner_flutter/domain/product/product.dart' as _i419;
import 'package:apskel_owner_flutter/env.dart' as _i6;
import 'package:apskel_owner_flutter/infrastructure/analytic/datasource/remote_data_provider.dart'
@ -77,6 +80,10 @@ import 'package:apskel_owner_flutter/infrastructure/order/datasource/remote_data
as _i130;
import 'package:apskel_owner_flutter/infrastructure/order/repositories/order_repository.dart'
as _i641;
import 'package:apskel_owner_flutter/infrastructure/outlet/datasource/remote_data_provider.dart'
as _i27;
import 'package:apskel_owner_flutter/infrastructure/outlet/repositories/outlet_repository.dart'
as _i13;
import 'package:apskel_owner_flutter/infrastructure/product/datasources/remote_data_provider.dart'
as _i823;
import 'package:apskel_owner_flutter/infrastructure/product/repositories/product_repository.dart'
@ -148,6 +155,9 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i1006.CustomerRemoteDataProvider>(
() => _i1006.CustomerRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i27.OutletRemoteDataProvider>(
() => _i27.OutletRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i48.ICustomerRepository>(
() => _i550.CustomerRepository(gh<_i1006.CustomerRemoteDataProvider>()),
);
@ -175,6 +185,12 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i1020.ICategoryRepository>(
() => _i869.CategoryRepository(gh<_i333.CategoryRemoteDataProvider>()),
);
gh.factory<_i197.IOutletRepository>(
() => _i13.OutletRepository(
gh<_i27.OutletRemoteDataProvider>(),
gh<_i991.AuthLocalDataProvider>(),
),
);
gh.factory<_i458.ProductLoaderBloc>(
() => _i458.ProductLoaderBloc(gh<_i419.IProductRepository>()),
);
@ -184,6 +200,9 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i889.SalesLoaderBloc>(
() => _i889.SalesLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i337.CurrentOutletLoaderBloc>(
() => _i337.CurrentOutletLoaderBloc(gh<_i197.IOutletRepository>()),
);
gh.factory<_i221.ProductAnalyticLoaderBloc>(
() => _i221.ProductAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);

View File

@ -0,0 +1,403 @@
import 'package:flutter/material.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../application/outlet/current_outlet_loader/current_outlet_loader_bloc.dart';
import '../../../common/theme/theme.dart';
import '../../../domain/outlet/outlet.dart';
import '../../../injection.dart';
import '../../components/appbar/appbar.dart';
// Outlet Information Page
@RoutePage()
class OutletInformationPage extends StatefulWidget implements AutoRouteWrapper {
const OutletInformationPage({super.key});
@override
State<OutletInformationPage> createState() => _OutletInformationPageState();
@override
Widget wrappedRoute(BuildContext context) => BlocProvider(
create: (_) =>
getIt<CurrentOutletLoaderBloc>()
..add(CurrentOutletLoaderEvent.fetched()),
child: this,
);
}
class _OutletInformationPageState extends State<OutletInformationPage>
with TickerProviderStateMixin {
late ScrollController _scrollController;
late AnimationController _fadeController;
late AnimationController _slideController;
late Animation<double> _fadeAnimation;
late Animation<Offset> _slideAnimation;
@override
void initState() {
super.initState();
_scrollController = ScrollController();
_fadeController = AnimationController(
duration: const Duration(milliseconds: 800),
vsync: this,
);
_slideController = AnimationController(
duration: const Duration(milliseconds: 600),
vsync: this,
);
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(parent: _fadeController, curve: Curves.easeInOut),
);
_slideAnimation =
Tween<Offset>(begin: const Offset(0, 0.3), end: Offset.zero).animate(
CurvedAnimation(parent: _slideController, curve: Curves.easeOutBack),
);
// Start animations
_fadeController.forward();
_slideController.forward();
}
@override
void dispose() {
_scrollController.dispose();
_fadeController.dispose();
_slideController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.background,
body: CustomScrollView(
controller: _scrollController,
slivers: [
SliverAppBar(
expandedHeight: 120.0,
floating: false,
pinned: true,
flexibleSpace: CustomAppBar(title: 'Outlet Information'),
),
SliverToBoxAdapter(
child: FadeTransition(
opacity: _fadeAnimation,
child: SlideTransition(
position: _slideAnimation,
child: _buildContent(),
),
),
),
],
),
);
}
Widget _buildContent() {
return BlocBuilder<CurrentOutletLoaderBloc, CurrentOutletLoaderState>(
builder: (context, state) {
return Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHeaderCard(state.outlet),
const SizedBox(height: 20),
_buildInfoSection(state.outlet),
const SizedBox(height: 20),
_buildContactSection(state.outlet),
const SizedBox(height: 20),
_buildBusinessSection(state.outlet),
const SizedBox(height: 20),
_buildStatusSection(state.outlet),
const SizedBox(height: 20),
_buildTimestampSection(state.outlet),
],
),
);
},
);
}
Widget _buildHeaderCard(Outlet outlet) {
return TweenAnimationBuilder<double>(
duration: const Duration(milliseconds: 800),
tween: Tween(begin: 0.0, end: 1.0),
builder: (context, value, child) {
return Transform.scale(
scale: 0.8 + (0.2 * value),
child: Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: AppColor.primaryGradient,
),
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: AppColor.primary.withOpacity(0.3),
blurRadius: 20,
offset: const Offset(0, 10),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(12),
),
child: Icon(Icons.store, color: AppColor.white, size: 24),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
outlet.name,
style: AppStyle.h5.copyWith(
color: AppColor.white,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 4),
Text(
outlet.businessType,
style: AppStyle.md.copyWith(
color: AppColor.white.withOpacity(0.9),
),
),
],
),
),
],
),
],
),
),
);
},
);
}
Widget _buildInfoSection(Outlet outlet) {
return _buildAnimatedCard(
delay: 200,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle('General Information', Icons.info_outline),
const SizedBox(height: 16),
_buildInfoRow('Outlet ID', outlet.id, Icons.fingerprint),
_buildInfoRow(
'Organization ID',
outlet.organizationId,
Icons.business,
),
_buildInfoRow('Address', outlet.address, Icons.location_on),
],
),
);
}
Widget _buildContactSection(Outlet outlet) {
return _buildAnimatedCard(
delay: 400,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle('Contact Information', Icons.contact_phone),
const SizedBox(height: 16),
_buildInfoRow('Phone Number', outlet.phoneNumber, Icons.phone),
],
),
);
}
Widget _buildBusinessSection(Outlet outlet) {
return _buildAnimatedCard(
delay: 600,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle('Business Settings', Icons.settings_applications),
const SizedBox(height: 16),
_buildInfoRow('Currency', outlet.currency, Icons.monetization_on),
_buildInfoRow('Tax Rate', '${outlet.taxRate}%', Icons.percent),
],
),
);
}
Widget _buildStatusSection(Outlet outlet) {
return _buildAnimatedCard(
delay: 800,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle('Status', Icons.toggle_on),
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
decoration: BoxDecoration(
color: outlet.isActive
? AppColor.success.withOpacity(0.1)
: AppColor.error.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: outlet.isActive
? AppColor.success.withOpacity(0.3)
: AppColor.error.withOpacity(0.3),
),
),
child: Row(
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: outlet.isActive ? AppColor.success : AppColor.error,
shape: BoxShape.circle,
),
),
const SizedBox(width: 12),
Text(
outlet.isActive ? 'Active' : 'Inactive',
style: AppStyle.md.copyWith(
color: outlet.isActive ? AppColor.success : AppColor.error,
fontWeight: FontWeight.w600,
),
),
],
),
),
],
),
);
}
Widget _buildTimestampSection(Outlet outlet) {
return _buildAnimatedCard(
delay: 1000,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle('Timestamps', Icons.schedule),
const SizedBox(height: 16),
_buildInfoRow(
'Created At',
_formatDateTime(outlet.createdAt),
Icons.add_circle_outline,
),
_buildInfoRow(
'Updated At',
_formatDateTime(outlet.updatedAt),
Icons.update,
),
],
),
);
}
Widget _buildAnimatedCard({required Widget child, required int delay}) {
return TweenAnimationBuilder<double>(
duration: Duration(milliseconds: 600 + delay),
tween: Tween(begin: 0.0, end: 1.0),
builder: (context, value, _) {
return Transform.translate(
offset: Offset(0, 30 * (1 - value)),
child: Opacity(
opacity: value,
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColor.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: AppColor.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 5),
),
],
),
child: child,
),
),
);
},
);
}
Widget _buildSectionTitle(String title, IconData icon) {
return Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppColor.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(icon, color: AppColor.primary, size: 20),
),
const SizedBox(width: 12),
Text(
title,
style: AppStyle.lg.copyWith(
fontWeight: FontWeight.bold,
color: AppColor.textPrimary,
),
),
],
);
}
Widget _buildInfoRow(String label, String value, IconData icon) {
return Padding(
padding: const EdgeInsets.only(bottom: 16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(icon, color: AppColor.textSecondary, size: 20),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: AppStyle.sm.copyWith(
color: AppColor.textSecondary,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 4),
Text(
value,
style: AppStyle.md.copyWith(
color: AppColor.textPrimary,
fontWeight: FontWeight.w600,
),
),
],
),
),
],
),
);
}
String _formatDateTime(DateTime dateTime) {
return '${dateTime.day}/${dateTime.month}/${dateTime.year} ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
}
}

View File

@ -43,9 +43,7 @@ class ProfileBusinessSetting extends StatelessWidget {
icon: Icons.business_outlined,
title: 'Outlet Information',
subtitle: 'Manage your Outlet details',
onTap: () {
// Navigate to business info
},
onTap: () => context.router.push(OutletInformationRoute()),
),
ProfileDivider(),

View File

@ -55,5 +55,8 @@ class AppRouter extends RootStackRouter {
// Order
AutoRoute(page: OrderDetailRoute.page),
// Outlet
AutoRoute(page: OutletInformationRoute.page),
];
}

View File

@ -9,7 +9,7 @@
// coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:apskel_owner_flutter/domain/order/order.dart' as _i22;
import 'package:apskel_owner_flutter/domain/order/order.dart' as _i23;
import 'package:apskel_owner_flutter/presentation/pages/auth/login/login_page.dart'
as _i8;
import 'package:apskel_owner_flutter/presentation/pages/customer/customer_page.dart'
@ -32,50 +32,52 @@ import 'package:apskel_owner_flutter/presentation/pages/order/order_detail/order
as _i10;
import 'package:apskel_owner_flutter/presentation/pages/order/order_list/order_page.dart'
as _i11;
import 'package:apskel_owner_flutter/presentation/pages/product/product_analytic/product_analytic_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/outlet/outlet_information_page.dart'
as _i12;
import 'package:apskel_owner_flutter/presentation/pages/product/product_list/product_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/product/product_analytic/product_analytic_page.dart'
as _i13;
import 'package:apskel_owner_flutter/presentation/pages/profile/profile_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/product/product_list/product_page.dart'
as _i14;
import 'package:apskel_owner_flutter/presentation/pages/purchase/purchase_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/profile/profile_page.dart'
as _i15;
import 'package:apskel_owner_flutter/presentation/pages/report/report_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/purchase/purchase_page.dart'
as _i16;
import 'package:apskel_owner_flutter/presentation/pages/sales/sales_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/report/report_page.dart'
as _i17;
import 'package:apskel_owner_flutter/presentation/pages/schedule/schedule_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/sales/sales_page.dart'
as _i18;
import 'package:apskel_owner_flutter/presentation/pages/splash/splash_page.dart'
import 'package:apskel_owner_flutter/presentation/pages/schedule/schedule_page.dart'
as _i19;
import 'package:auto_route/auto_route.dart' as _i20;
import 'package:flutter/material.dart' as _i21;
import 'package:apskel_owner_flutter/presentation/pages/splash/splash_page.dart'
as _i20;
import 'package:auto_route/auto_route.dart' as _i21;
import 'package:flutter/material.dart' as _i22;
/// generated route for
/// [_i1.CustomerPage]
class CustomerRoute extends _i20.PageRouteInfo<void> {
const CustomerRoute({List<_i20.PageRouteInfo>? children})
class CustomerRoute extends _i21.PageRouteInfo<void> {
const CustomerRoute({List<_i21.PageRouteInfo>? children})
: super(CustomerRoute.name, initialChildren: children);
static const String name = 'CustomerRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i1.CustomerPage());
return _i21.WrappedRoute(child: const _i1.CustomerPage());
},
);
}
/// generated route for
/// [_i2.DailyTasksFormPage]
class DailyTasksFormRoute extends _i20.PageRouteInfo<void> {
const DailyTasksFormRoute({List<_i20.PageRouteInfo>? children})
class DailyTasksFormRoute extends _i21.PageRouteInfo<void> {
const DailyTasksFormRoute({List<_i21.PageRouteInfo>? children})
: super(DailyTasksFormRoute.name, initialChildren: children);
static const String name = 'DailyTasksFormRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i2.DailyTasksFormPage();
@ -85,16 +87,16 @@ class DailyTasksFormRoute extends _i20.PageRouteInfo<void> {
/// generated route for
/// [_i3.ErrorPage]
class ErrorRoute extends _i20.PageRouteInfo<ErrorRouteArgs> {
class ErrorRoute extends _i21.PageRouteInfo<ErrorRouteArgs> {
ErrorRoute({
_i21.Key? key,
_i22.Key? key,
String? title,
String? message,
_i21.VoidCallback? onRetry,
_i21.VoidCallback? onBack,
_i22.VoidCallback? onRetry,
_i22.VoidCallback? onBack,
String? errorCode,
_i21.IconData? errorIcon,
List<_i20.PageRouteInfo>? children,
_i22.IconData? errorIcon,
List<_i21.PageRouteInfo>? children,
}) : super(
ErrorRoute.name,
args: ErrorRouteArgs(
@ -111,7 +113,7 @@ class ErrorRoute extends _i20.PageRouteInfo<ErrorRouteArgs> {
static const String name = 'ErrorRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
final args = data.argsAs<ErrorRouteArgs>(
@ -141,19 +143,19 @@ class ErrorRouteArgs {
this.errorIcon,
});
final _i21.Key? key;
final _i22.Key? key;
final String? title;
final String? message;
final _i21.VoidCallback? onRetry;
final _i22.VoidCallback? onRetry;
final _i21.VoidCallback? onBack;
final _i22.VoidCallback? onBack;
final String? errorCode;
final _i21.IconData? errorIcon;
final _i22.IconData? errorIcon;
@override
String toString() {
@ -163,29 +165,29 @@ class ErrorRouteArgs {
/// generated route for
/// [_i4.FinancePage]
class FinanceRoute extends _i20.PageRouteInfo<void> {
const FinanceRoute({List<_i20.PageRouteInfo>? children})
class FinanceRoute extends _i21.PageRouteInfo<void> {
const FinanceRoute({List<_i21.PageRouteInfo>? children})
: super(FinanceRoute.name, initialChildren: children);
static const String name = 'FinanceRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i4.FinancePage());
return _i21.WrappedRoute(child: const _i4.FinancePage());
},
);
}
/// generated route for
/// [_i5.HomePage]
class HomeRoute extends _i20.PageRouteInfo<void> {
const HomeRoute({List<_i20.PageRouteInfo>? children})
class HomeRoute extends _i21.PageRouteInfo<void> {
const HomeRoute({List<_i21.PageRouteInfo>? children})
: super(HomeRoute.name, initialChildren: children);
static const String name = 'HomeRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i5.HomePage();
@ -195,29 +197,29 @@ class HomeRoute extends _i20.PageRouteInfo<void> {
/// generated route for
/// [_i6.InventoryPage]
class InventoryRoute extends _i20.PageRouteInfo<void> {
const InventoryRoute({List<_i20.PageRouteInfo>? children})
class InventoryRoute extends _i21.PageRouteInfo<void> {
const InventoryRoute({List<_i21.PageRouteInfo>? children})
: super(InventoryRoute.name, initialChildren: children);
static const String name = 'InventoryRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i6.InventoryPage());
return _i21.WrappedRoute(child: const _i6.InventoryPage());
},
);
}
/// generated route for
/// [_i7.LanguagePage]
class LanguageRoute extends _i20.PageRouteInfo<void> {
const LanguageRoute({List<_i20.PageRouteInfo>? children})
class LanguageRoute extends _i21.PageRouteInfo<void> {
const LanguageRoute({List<_i21.PageRouteInfo>? children})
: super(LanguageRoute.name, initialChildren: children);
static const String name = 'LanguageRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i7.LanguagePage();
@ -227,29 +229,29 @@ class LanguageRoute extends _i20.PageRouteInfo<void> {
/// generated route for
/// [_i8.LoginPage]
class LoginRoute extends _i20.PageRouteInfo<void> {
const LoginRoute({List<_i20.PageRouteInfo>? children})
class LoginRoute extends _i21.PageRouteInfo<void> {
const LoginRoute({List<_i21.PageRouteInfo>? children})
: super(LoginRoute.name, initialChildren: children);
static const String name = 'LoginRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i8.LoginPage());
return _i21.WrappedRoute(child: const _i8.LoginPage());
},
);
}
/// generated route for
/// [_i9.MainPage]
class MainRoute extends _i20.PageRouteInfo<void> {
const MainRoute({List<_i20.PageRouteInfo>? children})
class MainRoute extends _i21.PageRouteInfo<void> {
const MainRoute({List<_i21.PageRouteInfo>? children})
: super(MainRoute.name, initialChildren: children);
static const String name = 'MainRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i9.MainPage();
@ -259,11 +261,11 @@ class MainRoute extends _i20.PageRouteInfo<void> {
/// generated route for
/// [_i10.OrderDetailPage]
class OrderDetailRoute extends _i20.PageRouteInfo<OrderDetailRouteArgs> {
class OrderDetailRoute extends _i21.PageRouteInfo<OrderDetailRouteArgs> {
OrderDetailRoute({
_i21.Key? key,
required _i22.Order order,
List<_i20.PageRouteInfo>? children,
_i22.Key? key,
required _i23.Order order,
List<_i21.PageRouteInfo>? children,
}) : super(
OrderDetailRoute.name,
args: OrderDetailRouteArgs(key: key, order: order),
@ -272,7 +274,7 @@ class OrderDetailRoute extends _i20.PageRouteInfo<OrderDetailRouteArgs> {
static const String name = 'OrderDetailRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
final args = data.argsAs<OrderDetailRouteArgs>();
@ -284,9 +286,9 @@ class OrderDetailRoute extends _i20.PageRouteInfo<OrderDetailRouteArgs> {
class OrderDetailRouteArgs {
const OrderDetailRouteArgs({this.key, required this.order});
final _i21.Key? key;
final _i22.Key? key;
final _i22.Order order;
final _i23.Order order;
@override
String toString() {
@ -296,144 +298,160 @@ class OrderDetailRouteArgs {
/// generated route for
/// [_i11.OrderPage]
class OrderRoute extends _i20.PageRouteInfo<void> {
const OrderRoute({List<_i20.PageRouteInfo>? children})
class OrderRoute extends _i21.PageRouteInfo<void> {
const OrderRoute({List<_i21.PageRouteInfo>? children})
: super(OrderRoute.name, initialChildren: children);
static const String name = 'OrderRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i11.OrderPage());
return _i21.WrappedRoute(child: const _i11.OrderPage());
},
);
}
/// generated route for
/// [_i12.ProductAnalyticPage]
class ProductAnalyticRoute extends _i20.PageRouteInfo<void> {
const ProductAnalyticRoute({List<_i20.PageRouteInfo>? children})
/// [_i12.OutletInformationPage]
class OutletInformationRoute extends _i21.PageRouteInfo<void> {
const OutletInformationRoute({List<_i21.PageRouteInfo>? children})
: super(OutletInformationRoute.name, initialChildren: children);
static const String name = 'OutletInformationRoute';
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i21.WrappedRoute(child: const _i12.OutletInformationPage());
},
);
}
/// generated route for
/// [_i13.ProductAnalyticPage]
class ProductAnalyticRoute extends _i21.PageRouteInfo<void> {
const ProductAnalyticRoute({List<_i21.PageRouteInfo>? children})
: super(ProductAnalyticRoute.name, initialChildren: children);
static const String name = 'ProductAnalyticRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i12.ProductAnalyticPage());
return _i21.WrappedRoute(child: const _i13.ProductAnalyticPage());
},
);
}
/// generated route for
/// [_i13.ProductPage]
class ProductRoute extends _i20.PageRouteInfo<void> {
const ProductRoute({List<_i20.PageRouteInfo>? children})
/// [_i14.ProductPage]
class ProductRoute extends _i21.PageRouteInfo<void> {
const ProductRoute({List<_i21.PageRouteInfo>? children})
: super(ProductRoute.name, initialChildren: children);
static const String name = 'ProductRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i13.ProductPage());
return _i21.WrappedRoute(child: const _i14.ProductPage());
},
);
}
/// generated route for
/// [_i14.ProfilePage]
class ProfileRoute extends _i20.PageRouteInfo<void> {
const ProfileRoute({List<_i20.PageRouteInfo>? children})
/// [_i15.ProfilePage]
class ProfileRoute extends _i21.PageRouteInfo<void> {
const ProfileRoute({List<_i21.PageRouteInfo>? children})
: super(ProfileRoute.name, initialChildren: children);
static const String name = 'ProfileRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i14.ProfilePage());
return _i21.WrappedRoute(child: const _i15.ProfilePage());
},
);
}
/// generated route for
/// [_i15.PurchasePage]
class PurchaseRoute extends _i20.PageRouteInfo<void> {
const PurchaseRoute({List<_i20.PageRouteInfo>? children})
/// [_i16.PurchasePage]
class PurchaseRoute extends _i21.PageRouteInfo<void> {
const PurchaseRoute({List<_i21.PageRouteInfo>? children})
: super(PurchaseRoute.name, initialChildren: children);
static const String name = 'PurchaseRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i15.PurchasePage();
return const _i16.PurchasePage();
},
);
}
/// generated route for
/// [_i16.ReportPage]
class ReportRoute extends _i20.PageRouteInfo<void> {
const ReportRoute({List<_i20.PageRouteInfo>? children})
/// [_i17.ReportPage]
class ReportRoute extends _i21.PageRouteInfo<void> {
const ReportRoute({List<_i21.PageRouteInfo>? children})
: super(ReportRoute.name, initialChildren: children);
static const String name = 'ReportRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i16.ReportPage());
return _i21.WrappedRoute(child: const _i17.ReportPage());
},
);
}
/// generated route for
/// [_i17.SalesPage]
class SalesRoute extends _i20.PageRouteInfo<void> {
const SalesRoute({List<_i20.PageRouteInfo>? children})
/// [_i18.SalesPage]
class SalesRoute extends _i21.PageRouteInfo<void> {
const SalesRoute({List<_i21.PageRouteInfo>? children})
: super(SalesRoute.name, initialChildren: children);
static const String name = 'SalesRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return _i20.WrappedRoute(child: const _i17.SalesPage());
return _i21.WrappedRoute(child: const _i18.SalesPage());
},
);
}
/// generated route for
/// [_i18.SchedulePage]
class ScheduleRoute extends _i20.PageRouteInfo<void> {
const ScheduleRoute({List<_i20.PageRouteInfo>? children})
/// [_i19.SchedulePage]
class ScheduleRoute extends _i21.PageRouteInfo<void> {
const ScheduleRoute({List<_i21.PageRouteInfo>? children})
: super(ScheduleRoute.name, initialChildren: children);
static const String name = 'ScheduleRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i18.SchedulePage();
return const _i19.SchedulePage();
},
);
}
/// generated route for
/// [_i19.SplashPage]
class SplashRoute extends _i20.PageRouteInfo<void> {
const SplashRoute({List<_i20.PageRouteInfo>? children})
/// [_i20.SplashPage]
class SplashRoute extends _i21.PageRouteInfo<void> {
const SplashRoute({List<_i21.PageRouteInfo>? children})
: super(SplashRoute.name, initialChildren: children);
static const String name = 'SplashRoute';
static _i20.PageInfo page = _i20.PageInfo(
static _i21.PageInfo page = _i21.PageInfo(
name,
builder: (data) {
return const _i19.SplashPage();
return const _i20.SplashPage();
},
);
}