6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 197b640a

AuthorMikkel Thygesen<mikkelet@gmail.com>
Date2026-03-02 13:26:49 +0100
2922: provide location implemented

Changed files

concierge/example/pubspec.lock                     |  8 ++
 .../presentation/app/cart_cubit.freezed.dart       | 39 +++++----
 .../bloc/provide_location_state.freezed.dart       | 52 ++++++------
 concierge/lib/domain/models/delivery_location.dart |  6 +-
 .../domain/repositories/property_repository.dart   |  3 +-
 concierge/lib/presentation/app/cart_cubit.dart     | 17 +++-
 .../widgets/select_payment_method.dart             | 74 ++---------------
 .../screens/payment/bloc/payment_cubit.dart        |  2 +-
 .../bloc/provide_location_cubit.dart               | 28 ++++++-
 .../bloc/provide_location_state.dart               |  6 +-
 .../provide_location/provide_location_route.dart   |  4 +-
 .../provide_location/provide_location_screen.dart  | 82 ++++++++++++++-----
 .../widgets/provide_location_action_bar.dart       | 45 ++++++++++
 .../widget/delivery_method_picker.dart             |  6 +-
 .../review_order/widget/review_order_app_bar.dart  | 56 +++++++------
 .../lib/presentation/widgets/toggle_list_item.dart | 95 ++++++++++++++++++++++
 concierge/pubspec.yaml                             |  1 +
 17 files changed, 351 insertions(+), 173 deletions(-)

Diff

diff --git a/concierge/example/pubspec.lock b/concierge/example/pubspec.lock
index 0b5b729f..1405973d 100644
--- a/concierge/example/pubspec.lock
+++ b/concierge/example/pubspec.lock
@@ -619,6 +619,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.1"
+ pin_code_fields:
+ dependency: transitive
+ description:
+ name: pin_code_fields
+ sha256: b9c33ef91da2a959dde3eaa0ec90dfca6a90d5b734cb594bb533a01f7f9732fa
+ url: "https://pub.dev"
+ source: hosted
+ version: "9.1.0"
platform:
dependency: transitive
description:
diff --git a/concierge/lib/_generated/presentation/app/cart_cubit.freezed.dart b/concierge/lib/_generated/presentation/app/cart_cubit.freezed.dart
index 94d590a5..e048ac70 100644
--- a/concierge/lib/_generated/presentation/app/cart_cubit.freezed.dart
+++ b/concierge/lib/_generated/presentation/app/cart_cubit.freezed.dart
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$CartState {
- bool get isLoading; AppError get error; Map<int, ProductInCart> get productsWithQuantity; bool get isDelivery; bool get chargeToRoom; String get comment; String get readyTime; DeliveryLocation get deliveryLocation; AreaDetails? get selectedArea;
+ bool get isLoading; AppError get error; Map<int, ProductInCart> get productsWithQuantity; bool get isDelivery; bool get chargeToRoom; String get comment; String get readyTime; String get deliveryLocationCode; DeliveryLocation get deliveryLocation; AreaDetails? get selectedArea;
/// Create a copy of CartState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $CartStateCopyWith<CartState> get copyWith => _$CartStateCopyWithImpl<CartState>
@override
bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is CartState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error)&&const DeepCollectionEquality().equals(other.productsWithQuantity, productsWithQuantity)&&(identical(other.isDelivery, isDelivery) || other.isDelivery == isDelivery)&&(identical(other.chargeToRoom, chargeToRoom) || other.chargeToRoom == chargeToRoom)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.readyTime, readyTime) || other.readyTime == readyTime)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation)&&(identical(other.selectedArea, selectedArea) || other.selectedArea == selectedArea));
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is CartState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error)&&const DeepCollectionEquality().equals(other.productsWithQuantity, productsWithQuantity)&&(identical(other.isDelivery, isDelivery) || other.isDelivery == isDelivery)&&(identical(other.chargeToRoom, chargeToRoom) || other.chargeToRoom == chargeToRoom)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.readyTime, readyTime) || other.readyTime == readyTime)&&(identical(other.deliveryLocationCode, deliveryLocationCode) || other.deliveryLocationCode == deliveryLocationCode)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation)&&(identical(other.selectedArea, selectedArea) || other.selectedArea == selectedArea));
}
@override
-int get hashCode => Object.hash(runtimeType,isLoading,error,const DeepCollectionEquality().hash(productsWithQuantity),isDelivery,chargeToRoom,comment,readyTime,deliveryLocation,selectedArea);
+int get hashCode => Object.hash(runtimeType,isLoading,error,const DeepCollectionEquality().hash(productsWithQuantity),isDelivery,chargeToRoom,comment,readyTime,deliveryLocationCode,deliveryLocation,selectedArea);
@override
String toString() {
- return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, chargeToRoom: $chargeToRoom, comment: $comment, readyTime: $readyTime, deliveryLocation: $deliveryLocation, selectedArea: $selectedArea)';
+ return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, chargeToRoom: $chargeToRoom, comment: $comment, readyTime: $readyTime, deliveryLocationCode: $deliveryLocationCode, deliveryLocation: $deliveryLocation, selectedArea: $selectedArea)';
}
@@ -45,7 +45,7 @@ abstract mixin class $CartStateCopyWith<$Res> {
factory $CartStateCopyWith(CartState value, $Res Function(CartState) _then) = _$CartStateCopyWithImpl;
@useResult
$Res call({
- bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea
+ bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, String deliveryLocationCode, DeliveryLocation deliveryLocation, AreaDetails? selectedArea
});
@@ -62,7 +62,7 @@ class _$CartStateCopyWithImpl<$Res>
/// Create a copy of CartState
/// with the given fields replaced by the non-null parameter values.
-@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? error = null,Object? productsWithQuantity = null,Object? isDelivery = null,Object? chargeToRoom = null,Object? comment = null,Object? readyTime = null,Object? deliveryLocation = null,Object? selectedArea = freezed,}) {
+@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? error = null,Object? productsWithQuantity = null,Object? isDelivery = null,Object? chargeToRoom = null,Object? comment = null,Object? readyTime = null,Object? deliveryLocationCode = null,Object? deliveryLocation = null,Object? selectedArea = freezed,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
@@ -71,6 +71,7 @@ as Map<int, ProductInCart>,isDelivery: null == isDelivery ? _self.isDelivery : i
as bool,chargeToRoom: null == chargeToRoom ? _self.chargeToRoom : chargeToRoom // ignore: cast_nullable_to_non_nullable
as bool,comment: null == comment ? _self.comment : comment // ignore: cast_nullable_to_non_nullable
as String,readyTime: null == readyTime ? _self.readyTime : readyTime // ignore: cast_nullable_to_non_nullable
+as String,deliveryLocationCode: null == deliveryLocationCode ? _self.deliveryLocationCode : deliveryLocationCode // ignore: cast_nullable_to_non_nullable
as String,deliveryLocation: null == deliveryLocation ? _self.deliveryLocation : deliveryLocation // ignore: cast_nullable_to_non_nullable
as DeliveryLocation,selectedArea: freezed == selectedArea ? _self.selectedArea : selectedArea // ignore: cast_nullable_to_non_nullable
as AreaDetails?,
@@ -158,10 +159,10 @@ return $default(_that);case _:
/// }
/// ```
-@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea)? $default,{required TResult orElse(),}) {final _that = this;
+@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, String deliveryLocationCode, DeliveryLocation deliveryLocation, AreaDetails? selectedArea)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _CartState() when $default != null:
-return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocation,_that.selectedArea);case _:
+return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocationCode,_that.deliveryLocation,_that.selectedArea);case _:
return orElse();
}
@@ -179,10 +180,10 @@ return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isD
/// }
/// ```
-@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea) $default,) {final _that = this;
+@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, String deliveryLocationCode, DeliveryLocation deliveryLocation, AreaDetails? selectedArea) $default,) {final _that = this;
switch (_that) {
case _CartState():
-return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocation,_that.selectedArea);case _:
+return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocationCode,_that.deliveryLocation,_that.selectedArea);case _:
throw StateError('Unexpected subclass');
}
@@ -199,10 +200,10 @@ return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isD
/// }
/// ```
-@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea)? $default,) {final _that = this;
+@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, String deliveryLocationCode, DeliveryLocation deliveryLocation, AreaDetails? selectedArea)? $default,) {final _that = this;
switch (_that) {
case _CartState() when $default != null:
-return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocation,_that.selectedArea);case _:
+return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocationCode,_that.deliveryLocation,_that.selectedArea);case _:
return null;
}
@@ -214,7 +215,7 @@ return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isD
class _CartState extends CartState {
- const _CartState({this.isLoading = false, this.error = AppError.none, final Map<int, ProductInCart> productsWithQuantity = const {}, this.isDelivery = false, this.chargeToRoom = true, this.comment = "", this.readyTime = "", this.deliveryLocation = DeliveryLocation.room, this.selectedArea}): _productsWithQuantity = productsWithQuantity,super._();
+ const _CartState({this.isLoading = false, this.error = AppError.none, final Map<int, ProductInCart> productsWithQuantity = const {}, this.isDelivery = false, this.chargeToRoom = true, this.comment = "", this.readyTime = "", this.deliveryLocationCode = "", this.deliveryLocation = DeliveryLocation.room, this.selectedArea}): _productsWithQuantity = productsWithQuantity,super._();
@override@JsonKey() final bool isLoading;
@@ -230,6 +231,7 @@ class _CartState extends CartState {
@override@JsonKey() final bool chargeToRoom;
@override@JsonKey() final String comment;
@override@JsonKey() final String readyTime;
+@override@JsonKey() final String deliveryLocationCode;
@override@JsonKey() final DeliveryLocation deliveryLocation;
@override final AreaDetails? selectedArea;
@@ -243,16 +245,16 @@ _$CartStateCopyWith<_CartState> get copyWith => __$CartStateCopyWithImpl<_CartSt
@override
bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error)&&const DeepCollectionEquality().equals(other._productsWithQuantity, _productsWithQuantity)&&(identical(other.isDelivery, isDelivery) || other.isDelivery == isDelivery)&&(identical(other.chargeToRoom, chargeToRoom) || other.chargeToRoom == chargeToRoom)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.readyTime, readyTime) || other.readyTime == readyTime)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation)&&(identical(other.selectedArea, selectedArea) || other.selectedArea == selectedArea));
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is _CartState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error)&&const DeepCollectionEquality().equals(other._productsWithQuantity, _productsWithQuantity)&&(identical(other.isDelivery, isDelivery) || other.isDelivery == isDelivery)&&(identical(other.chargeToRoom, chargeToRoom) || other.chargeToRoom == chargeToRoom)&&(identical(other.comment, comment) || other.comment == comment)&&(identical(other.readyTime, readyTime) || other.readyTime == readyTime)&&(identical(other.deliveryLocationCode, deliveryLocationCode) || other.deliveryLocationCode == deliveryLocationCode)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation)&&(identical(other.selectedArea, selectedArea) || other.selectedArea == selectedArea));
}
@override
-int get hashCode => Object.hash(runtimeType,isLoading,error,const DeepCollectionEquality().hash(_productsWithQuantity),isDelivery,chargeToRoom,comment,readyTime,deliveryLocation,selectedArea);
+int get hashCode => Object.hash(runtimeType,isLoading,error,const DeepCollectionEquality().hash(_productsWithQuantity),isDelivery,chargeToRoom,comment,readyTime,deliveryLocationCode,deliveryLocation,selectedArea);
@override
String toString() {
- return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, chargeToRoom: $chargeToRoom, comment: $comment, readyTime: $readyTime, deliveryLocation: $deliveryLocation, selectedArea: $selectedArea)';
+ return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, chargeToRoom: $chargeToRoom, comment: $comment, readyTime: $readyTime, deliveryLocationCode: $deliveryLocationCode, deliveryLocation: $deliveryLocation, selectedArea: $selectedArea)';
}
@@ -263,7 +265,7 @@ abstract mixin class _$CartStateCopyWith<$Res> implements $CartStateCopyWith<$Re
factory _$CartStateCopyWith(_CartState value, $Res Function(_CartState) _then) = __$CartStateCopyWithImpl;
@override @useResult
$Res call({
- bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea
+ bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, String deliveryLocationCode, DeliveryLocation deliveryLocation, AreaDetails? selectedArea
});
@@ -280,7 +282,7 @@ class __$CartStateCopyWithImpl<$Res>
/// Create a copy of CartState
/// with the given fields replaced by the non-null parameter values.
-@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? error = null,Object? productsWithQuantity = null,Object? isDelivery = null,Object? chargeToRoom = null,Object? comment = null,Object? readyTime = null,Object? deliveryLocation = null,Object? selectedArea = freezed,}) {
+@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? error = null,Object? productsWithQuantity = null,Object? isDelivery = null,Object? chargeToRoom = null,Object? comment = null,Object? readyTime = null,Object? deliveryLocationCode = null,Object? deliveryLocation = null,Object? selectedArea = freezed,}) {
return _then(_CartState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
@@ -289,6 +291,7 @@ as Map<int, ProductInCart>,isDelivery: null == isDelivery ? _self.isDelivery : i
as bool,chargeToRoom: null == chargeToRoom ? _self.chargeToRoom : chargeToRoom // ignore: cast_nullable_to_non_nullable
as bool,comment: null == comment ? _self.comment : comment // ignore: cast_nullable_to_non_nullable
as String,readyTime: null == readyTime ? _self.readyTime : readyTime // ignore: cast_nullable_to_non_nullable
+as String,deliveryLocationCode: null == deliveryLocationCode ? _self.deliveryLocationCode : deliveryLocationCode // ignore: cast_nullable_to_non_nullable
as String,deliveryLocation: null == deliveryLocation ? _self.deliveryLocation : deliveryLocation // ignore: cast_nullable_to_non_nullable
as DeliveryLocation,selectedArea: freezed == selectedArea ? _self.selectedArea : selectedArea // ignore: cast_nullable_to_non_nullable
as AreaDetails?,
diff --git a/concierge/lib/_generated/presentation/screens/provide_location/bloc/provide_location_state.freezed.dart b/concierge/lib/_generated/presentation/screens/provide_location/bloc/provide_location_state.freezed.dart
index 23e5f40a..3c0e1186 100644
--- a/concierge/lib/_generated/presentation/screens/provide_location/bloc/provide_location_state.freezed.dart
+++ b/concierge/lib/_generated/presentation/screens/provide_location/bloc/provide_location_state.freezed.dart
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ProvideLocationState {
- bool get isLoading; AppError get error;
+ String get deliveryLocationCode; DeliveryLocation get deliveryLocation;
/// Create a copy of ProvideLocationState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $ProvideLocationStateCopyWith<ProvideLocationState> get copyWith => _$ProvideLoc
@override
bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is ProvideLocationState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error));
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is ProvideLocationState&&(identical(other.deliveryLocationCode, deliveryLocationCode) || other.deliveryLocationCode == deliveryLocationCode)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation));
}
@override
-int get hashCode => Object.hash(runtimeType,isLoading,error);
+int get hashCode => Object.hash(runtimeType,deliveryLocationCode,deliveryLocation);
@override
String toString() {
- return 'ProvideLocationState(isLoading: $isLoading, error: $error)';
+ return 'ProvideLocationState(deliveryLocationCode: $deliveryLocationCode, deliveryLocation: $deliveryLocation)';
}
@@ -45,7 +45,7 @@ abstract mixin class $ProvideLocationStateCopyWith<$Res> {
factory $ProvideLocationStateCopyWith(ProvideLocationState value, $Res Function(ProvideLocationState) _then) = _$ProvideLocationStateCopyWithImpl;
@useResult
$Res call({
- bool isLoading, AppError error
+ String deliveryLocationCode, DeliveryLocation deliveryLocation
});
@@ -62,11 +62,11 @@ class _$ProvideLocationStateCopyWithImpl<$Res>
/// Create a copy of ProvideLocationState
/// with the given fields replaced by the non-null parameter values.
-@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? error = null,}) {
+@pragma('vm:prefer-inline') @override $Res call({Object? deliveryLocationCode = null,Object? deliveryLocation = null,}) {
return _then(_self.copyWith(
-isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
-as bool,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
-as AppError,
+deliveryLocationCode: null == deliveryLocationCode ? _self.deliveryLocationCode : deliveryLocationCode // ignore: cast_nullable_to_non_nullable
+as String,deliveryLocation: null == deliveryLocation ? _self.deliveryLocation : deliveryLocation // ignore: cast_nullable_to_non_nullable
+as DeliveryLocation,
));
}
@@ -151,10 +151,10 @@ return $default(_that);case _:
/// }
/// ```
-@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, AppError error)? $default,{required TResult orElse(),}) {final _that = this;
+@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String deliveryLocationCode, DeliveryLocation deliveryLocation)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ProvideLocationState() when $default != null:
-return $default(_that.isLoading,_that.error);case _:
+return $default(_that.deliveryLocationCode,_that.deliveryLocation);case _:
return orElse();
}
@@ -172,10 +172,10 @@ return $default(_that.isLoading,_that.error);case _:
/// }
/// ```
-@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, AppError error) $default,) {final _that = this;
+@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String deliveryLocationCode, DeliveryLocation deliveryLocation) $default,) {final _that = this;
switch (_that) {
case _ProvideLocationState():
-return $default(_that.isLoading,_that.error);case _:
+return $default(_that.deliveryLocationCode,_that.deliveryLocation);case _:
throw StateError('Unexpected subclass');
}
@@ -192,10 +192,10 @@ return $default(_that.isLoading,_that.error);case _:
/// }
/// ```
-@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, AppError error)? $default,) {final _that = this;
+@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String deliveryLocationCode, DeliveryLocation deliveryLocation)? $default,) {final _that = this;
switch (_that) {
case _ProvideLocationState() when $default != null:
-return $default(_that.isLoading,_that.error);case _:
+return $default(_that.deliveryLocationCode,_that.deliveryLocation);case _:
return null;
}
@@ -207,11 +207,11 @@ return $default(_that.isLoading,_that.error);case _:
class _ProvideLocationState implements ProvideLocationState {
- const _ProvideLocationState({this.isLoading = false, this.error = AppError.none});
+ const _ProvideLocationState({this.deliveryLocationCode = "", this.deliveryLocation = DeliveryLocation.room});
-@override@JsonKey() final bool isLoading;
-@override@JsonKey() final AppError error;
+@override@JsonKey() final String deliveryLocationCode;
+@override@JsonKey() final DeliveryLocation deliveryLocation;
/// Create a copy of ProvideLocationState
/// with the given fields replaced by the non-null parameter values.
@@ -223,16 +223,16 @@ _$ProvideLocationStateCopyWith<_ProvideLocationState> get copyWith => __$Provide
@override
bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProvideLocationState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error));
+ return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProvideLocationState&&(identical(other.deliveryLocationCode, deliveryLocationCode) || other.deliveryLocationCode == deliveryLocationCode)&&(identical(other.deliveryLocation, deliveryLocation) || other.deliveryLocation == deliveryLocation));
}
@override
-int get hashCode => Object.hash(runtimeType,isLoading,error);
+int get hashCode => Object.hash(runtimeType,deliveryLocationCode,deliveryLocation);
@override
String toString() {
- return 'ProvideLocationState(isLoading: $isLoading, error: $error)';
+ return 'ProvideLocationState(deliveryLocationCode: $deliveryLocationCode, deliveryLocation: $deliveryLocation)';
}
@@ -243,7 +243,7 @@ abstract mixin class _$ProvideLocationStateCopyWith<$Res> implements $ProvideLoc
factory _$ProvideLocationStateCopyWith(_ProvideLocationState value, $Res Function(_ProvideLocationState) _then) = __$ProvideLocationStateCopyWithImpl;
@override @useResult
$Res call({
- bool isLoading, AppError error
+ String deliveryLocationCode, DeliveryLocation deliveryLocation
});
@@ -260,11 +260,11 @@ class __$ProvideLocationStateCopyWithImpl<$Res>
/// Create a copy of ProvideLocationState
/// with the given fields replaced by the non-null parameter values.
-@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? error = null,}) {
+@override @pragma('vm:prefer-inline') $Res call({Object? deliveryLocationCode = null,Object? deliveryLocation = null,}) {
return _then(_ProvideLocationState(
-isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
-as bool,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
-as AppError,
+deliveryLocationCode: null == deliveryLocationCode ? _self.deliveryLocationCode : deliveryLocationCode // ignore: cast_nullable_to_non_nullable
+as String,deliveryLocation: null == deliveryLocation ? _self.deliveryLocation : deliveryLocation // ignore: cast_nullable_to_non_nullable
+as DeliveryLocation,
));
}
diff --git a/concierge/lib/domain/models/delivery_location.dart b/concierge/lib/domain/models/delivery_location.dart
index 89b8c206..5058cf9c 100644
--- a/concierge/lib/domain/models/delivery_location.dart
+++ b/concierge/lib/domain/models/delivery_location.dart
@@ -3,7 +3,7 @@ sealed class DeliveryLocation {
static const room = Room();
- static area(String code) => Area(code);
+ static const area = Area();
}
class Room extends DeliveryLocation {
@@ -11,7 +11,5 @@ class Room extends DeliveryLocation {
}
class Area extends DeliveryLocation {
- final String code;
-
- const Area(this.code);
+ const Area();
}
diff --git a/concierge/lib/domain/repositories/property_repository.dart b/concierge/lib/domain/repositories/property_repository.dart
index b67975e4..54b2569b 100644
--- a/concierge/lib/domain/repositories/property_repository.dart
+++ b/concierge/lib/domain/repositories/property_repository.dart
@@ -39,7 +39,6 @@ class PropertyRepository {
final body = {
"products": products,
"area_id": areaId,
- "location_code": locationCode,
"delivery": isDelivery,
"requested_delivery_time": readyTime.isEmpty ? "ASAP" : readyTime,
"payment_type": chargeToRoom ? "ROOM" : "PAYMENT_SERVICE",
@@ -50,7 +49,7 @@ class PropertyRepository {
if (deliveryLocation is Room) {
body["room"] = "203";
} else if (deliveryLocation is Area) {
- body["location_code"] = deliveryLocation.code;
+ body["location_code"] = locationCode;
}
final response = await _service.createOrder(body);
return response.data;
diff --git a/concierge/lib/presentation/app/cart_cubit.dart b/concierge/lib/presentation/app/cart_cubit.dart
index d9d32b3c..c7a5bdb4 100644
--- a/concierge/lib/presentation/app/cart_cubit.dart
+++ b/concierge/lib/presentation/app/cart_cubit.dart
@@ -50,6 +50,18 @@ class CartCubit extends BaseCubit<CartState> {
safeEmit(state.copyWith(selectedArea: area, productsWithQuantity: {}));
}
+ void updatePaymentMethod(bool chargeToRoom) {
+ safeEmit(state.copyWith(chargeToRoom: chargeToRoom));
+ }
+
+ void updateLocation(DeliveryLocation deliveryLocation) {
+ safeEmit(state.copyWith(deliveryLocation: deliveryLocation));
+ }
+
+ void updateLocationCode(String code) {
+ safeEmit(state.copyWith(deliveryLocationCode: code));
+ }
+
int get totalItems {
if (state.productsWithQuantity.isEmpty) return 0;
return state.productsWithQuantity.values
@@ -72,10 +84,6 @@ class CartCubit extends BaseCubit<CartState> {
if (dataState is Success<Product> && getQuantity(productId) > 0) yield dataState.data;
}
}
-
- void updatePaymentMethod(bool chargeToRoom) {
- safeEmit(state.copyWith(chargeToRoom: chargeToRoom));
- }
}
@freezed
@@ -88,6 +96,7 @@ abstract class CartState with _$CartState {
@Default(true) bool chargeToRoom,
@Default("") String comment,
@Default("") String readyTime,
+ @Default("") String deliveryLocationCode,
@Default(DeliveryLocation.room) DeliveryLocation deliveryLocation,
AreaDetails? selectedArea,
}) = _CartState;
diff --git a/concierge/lib/presentation/screens/confirm_order/widgets/select_payment_method.dart b/concierge/lib/presentation/screens/confirm_order/widgets/select_payment_method.dart
index 0ef48dd4..997ad6db 100644
--- a/concierge/lib/presentation/screens/confirm_order/widgets/select_payment_method.dart
+++ b/concierge/lib/presentation/screens/confirm_order/widgets/select_payment_method.dart
@@ -1,6 +1,5 @@
import 'package:concierge/presentation/app/cart_cubit.dart';
-import 'package:concierge/presentation/theme/app_colors.dart';
-import 'package:concierge/presentation/widgets/toggle_checkmark.dart';
+import 'package:concierge/presentation/widgets/toggle_list_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:gap/gap.dart';
@@ -46,69 +45,14 @@ class SelectPaymentMethod extends StatelessWidget {
required bool isChargeToRoom,
}) {
final cartCubit = context.read<CartCubit>();
-
- final Color bgColor;
- final Color iconBgColor;
- final Border? borderSide;
- if (isSelected) {
- bgColor = AppColors.colorSecondary;
- iconBgColor = Color(0xFFD7C9B9);
- borderSide = null;
- } else {
- bgColor = Colors.white;
- iconBgColor = AppColors.colorSecondary;
- borderSide = Border.all(color: Colors.grey.shade300, width: 1);
- }
-
- return Ink(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(16),
- color: bgColor,
- border: borderSide,
- ),
- child: InkWell(
- borderRadius: BorderRadius.circular(16),
- onTap: () {
- cartCubit.updatePaymentMethod(isChargeToRoom);
- },
- child: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Row(
- children: [
- Container(
- width: 36,
- height: 36,
- decoration: BoxDecoration(shape: BoxShape.circle, color: iconBgColor),
- child: Icon(
- icon,
- size: 20,
- color: Colors.black,
- ),
- ),
- Gap(12),
- Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(title, style: TextStyle(color: Colors.black)),
- Text(
- subtitle,
- style: TextStyle(
- color: Colors.black.withAlpha((0.5 * 255).toInt()),
- fontSize: 12,
- ),
- ),
- ],
- ),
- Spacer(),
- ToggleCheckmark(
- isSelected: isSelected,
- size: 32,
- ),
- ],
- ),
- ),
- ),
+ return ToggleListItem(
+ icon: icon,
+ title: title,
+ subtitle: subtitle,
+ isSelected: isSelected,
+ onClick: (_) {
+ cartCubit.updatePaymentMethod(isChargeToRoom);
+ },
);
}
}
diff --git a/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart b/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart
index cc955382..3d53ed28 100644
--- a/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart
+++ b/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart
@@ -39,7 +39,7 @@ class PaymentCubit extends BaseCubit<PaymentState> {
products: products.toList(),
areaId: area.id,
isDelivery: _cartCubit.state.isDelivery,
- locationCode: "_cartCubit.state",
+ locationCode: _cartCubit.state.deliveryLocationCode,
deliveryLocation: _cartCubit.state.deliveryLocation,
readyTime: _cartCubit.state.readyTime,
comment: _cartCubit.state.comment,
diff --git a/concierge/lib/presentation/screens/provide_location/bloc/provide_location_cubit.dart b/concierge/lib/presentation/screens/provide_location/bloc/provide_location_cubit.dart
index 21874548..66ddb394 100644
--- a/concierge/lib/presentation/screens/provide_location/bloc/provide_location_cubit.dart
+++ b/concierge/lib/presentation/screens/provide_location/bloc/provide_location_cubit.dart
@@ -1,12 +1,34 @@
+import 'package:concierge/domain/models/delivery_location.dart';
+import 'package:concierge/presentation/app/cart_cubit.dart';
import 'package:concierge/presentation/base/base_cubit.dart';
import 'package:concierge/presentation/screens/provide_location/bloc/provide_location_state.dart';
class ProvideLocationCubit extends BaseCubit<ProvideLocationState> {
- ProvideLocationCubit() : super(const ProvideLocationState()) {
+ final CartCubit _cartCubit;
+
+ ProvideLocationCubit(this._cartCubit) : super(const ProvideLocationState()) {
init();
}
Future<void> init() async {
-
+ safeEmit(
+ state.copyWith(
+ deliveryLocationCode: _cartCubit.state.deliveryLocationCode,
+ deliveryLocation: _cartCubit.state.deliveryLocation,
+ ),
+ );
+ }
+
+ void updateLocation(DeliveryLocation deliveryLocation) {
+ safeEmit(state.copyWith(deliveryLocation: deliveryLocation));
+ }
+
+ void updateLocationCode(String code) {
+ safeEmit(state.copyWith(deliveryLocationCode: code));
+ }
+
+ void onConfirmClicked() {
+ _cartCubit.updateLocationCode(state.deliveryLocationCode);
+ _cartCubit.updateLocation(state.deliveryLocation);
}
-}
\ No newline at end of file
+}
diff --git a/concierge/lib/presentation/screens/provide_location/bloc/provide_location_state.dart b/concierge/lib/presentation/screens/provide_location/bloc/provide_location_state.dart
index d4bb64e8..5ff908ec 100644
--- a/concierge/lib/presentation/screens/provide_location/bloc/provide_location_state.dart
+++ b/concierge/lib/presentation/screens/provide_location/bloc/provide_location_state.dart
@@ -1,12 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:concierge/domain/models/app_error.dart';
+import '../../../../domain/models/delivery_location.dart';
+
part '../../../../_generated/presentation/screens/provide_location/bloc/provide_location_state.freezed.dart';
@freezed
abstract class ProvideLocationState with _$ProvideLocationState {
const factory ProvideLocationState({
- @Default(false) bool isLoading,
- @Default(AppError.none) AppError error,
+ @Default("") String deliveryLocationCode,
+ @Default(DeliveryLocation.room) DeliveryLocation deliveryLocation,
}) = _ProvideLocationState;
}
\ No newline at end of file
diff --git a/concierge/lib/presentation/screens/provide_location/provide_location_route.dart b/concierge/lib/presentation/screens/provide_location/provide_location_route.dart
index e9fb00c7..35588efc 100644
--- a/concierge/lib/presentation/screens/provide_location/provide_location_route.dart
+++ b/concierge/lib/presentation/screens/provide_location/provide_location_route.dart
@@ -1,4 +1,5 @@
import 'package:concierge/presentation/navigation/transitions/slide_in_transition.dart';
+import 'package:concierge/presentation/screens/provide_location/bloc/provide_location_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:concierge/presentation/navigation/app_routes.dart';
@@ -10,12 +11,13 @@ part '../../../_generated/presentation/screens/provide_location/provide_location
@TypedGoRoute<ProvideLocationRoute>(path: AppRoutes.provideLocation)
class ProvideLocationRoute extends GoRouteData with $ProvideLocationRoute {
+
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return slideInTransition(
state: state,
child: BlocProvider(
- create: (context) => ProvideLocationCubit(),
+ create: (context) => ProvideLocationCubit(context.read()),
child: ProvideLocationScreen(),
),
);
diff --git a/concierge/lib/presentation/screens/provide_location/provide_location_screen.dart b/concierge/lib/presentation/screens/provide_location/provide_location_screen.dart
index 55f85e56..a2de090d 100644
--- a/concierge/lib/presentation/screens/provide_location/provide_location_screen.dart
+++ b/concierge/lib/presentation/screens/provide_location/provide_location_screen.dart
@@ -1,39 +1,83 @@
-import 'package:concierge/presentation/screens/confirm_order/confirm_order_route.dart';
+import 'package:concierge/domain/models/delivery_location.dart';
+import 'package:concierge/presentation/screens/provide_location/widgets/provide_location_action_bar.dart';
+import 'package:concierge/presentation/theme/app_colors.dart';
+import 'package:concierge/presentation/widgets/bevelled_app_bar.dart';
+import 'package:concierge/presentation/widgets/padded_column.dart';
+import 'package:concierge/presentation/widgets/toggle_list_item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:concierge/presentation/screens/provide_location/bloc/provide_location_cubit.dart';
import 'package:concierge/presentation/screens/provide_location/bloc/provide_location_state.dart';
+import 'package:gap/gap.dart';
+import 'package:pin_code_fields/pin_code_fields.dart';
class ProvideLocationScreen extends StatelessWidget {
const ProvideLocationScreen({super.key});
@override
Widget build(BuildContext context) {
- return BlocBuilder<ProvideLocationCubit, ProvideLocationState>(
+ return BlocBuilder<ProvideLocationCubit, ProvideLocationState>(
builder: (context, state) {
final cubit = context.read<ProvideLocationCubit>();
- return MultiBlocListener(
- listeners: [
- BlocListener<ProvideLocationCubit, ProvideLocationState>(
- listenWhen: (prev, curr) => prev.isLoading && curr.error.isError,
- listener: (context, state) {},
- ),
- ],
- child: Scaffold(
- appBar: AppBar(),
- body: Center(
- child: Column(
+ return Scaffold(
+ bottomNavigationBar: ProvideLocationActionBar(),
+ body: Stack(
+ children: [
+ PaddedColumn(
+ padding: EdgeInsets.symmetric(horizontal: 16),
children: [
- Text("ProvideLocation"),
- TextButton(
- onPressed: () {
- ConfirmOrderRoute().push(context);
+ Gap(100),
+ Gap(32),
+ Text(
+ "Angiv Lokation",
+ style: TextStyle(fontSize: 20),
+ ),
+ Gap(48),
+ ToggleListItem(
+ icon: Icons.bed_outlined,
+ title: "Levering til værelset",
+ subtitle: "Værelse 345",
+ isSelected: cubit.state.deliveryLocation is Room,
+ onClick: (_) {
+ cubit.updateLocation(DeliveryLocation.room);
+ },
+ ),
+ Gap(12),
+ ToggleListItem(
+ icon: Icons.bed_outlined,
+ title: "Levering til lokation",
+ subtitle: "Angiv 4-cifret lokationsnummer",
+ isSelected: cubit.state.deliveryLocation is Area,
+ onClick: (_) {
+ cubit.updateLocation(DeliveryLocation.area);
},
- child: Text("Bekræft ordre"),
+ onSelectedExtra: Padding(
+ padding: const EdgeInsets.only(top: 24.0),
+ child: MaterialPinField(
+ length: 4,
+ initialValue: cubit.state.deliveryLocationCode,
+ onCompleted: (pin) {},
+ onChanged: (value) {
+ cubit.updateLocationCode(value);
+ },
+ theme: MaterialPinTheme(
+ shape: MaterialPinShape.filled,
+ fillColor: AppColors.sandColor[10],
+ completeFillColor: AppColors.sandColor[10],
+ focusedFillColor: AppColors.sandColor[10],
+ filledFillColor: AppColors.sandColor[10],
+ textStyle: TextStyle(fontSize: 30),
+ cellSize: Size(70, 70),
+ borderRadius: BorderRadius.circular(12),
+ ),
+ ),
+ ),
),
+ Gap(12),
],
),
- ),
+ BevelledAppBar(),
+ ],
),
);
},
diff --git a/concierge/lib/presentation/screens/provide_location/widgets/provide_location_action_bar.dart b/concierge/lib/presentation/screens/provide_location/widgets/provide_location_action_bar.dart
new file mode 100644
index 00000000..b62b948e
--- /dev/null
+++ b/concierge/lib/presentation/screens/provide_location/widgets/provide_location_action_bar.dart
@@ -0,0 +1,45 @@
+import 'package:concierge/presentation/app/cart_cubit.dart';
+import 'package:concierge/presentation/screens/provide_location/bloc/provide_location_cubit.dart';
+import 'package:concierge/presentation/theme/app_colors.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:go_router/go_router.dart';
+
+class ProvideLocationActionBar extends StatelessWidget {
+ const ProvideLocationActionBar({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final cubit = context.read<ProvideLocationCubit>();
+ final cartCubit = context.read<CartCubit>();
+ return Container(
+ decoration: BoxDecoration(
+ border: Border(top: BorderSide(color: Colors.grey.shade300, width: 1)),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: SizedBox(
+ child: SafeArea(
+ child: ElevatedButton(
+ style: ButtonStyle(
+ backgroundColor: WidgetStateMapper({
+ WidgetState.disabled: Colors.grey,
+ WidgetState.any: AppColors.sandColor,
+ }),
+ ),
+ onPressed: () {
+ cubit.onConfirmClicked();
+ cartCubit.updateDelivery(true);
+ context.pop();
+ },
+ child: Text(
+ "Bekræft lokation",
+ style: TextStyle(color: Colors.white),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/concierge/lib/presentation/screens/review_order/widget/delivery_method_picker.dart b/concierge/lib/presentation/screens/review_order/widget/delivery_method_picker.dart
index cddb4394..f59e2ffa 100644
--- a/concierge/lib/presentation/screens/review_order/widget/delivery_method_picker.dart
+++ b/concierge/lib/presentation/screens/review_order/widget/delivery_method_picker.dart
@@ -1,4 +1,5 @@
import 'package:concierge/presentation/app/cart_cubit.dart';
+import 'package:concierge/presentation/screens/provide_location/provide_location_route.dart';
import 'package:concierge/presentation/theme/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -10,6 +11,7 @@ class DeliveryMethodPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cartCubit = context.watch<CartCubit>();
+ final deliveryPrice = cartCubit.state.selectedArea?.deliveryPrice;
return Row(
children: [
Expanded(
@@ -17,9 +19,9 @@ class DeliveryMethodPicker extends StatelessWidget {
context,
isSelected: cartCubit.state.isDelivery,
onClick: () {
- cartCubit.updateDelivery(true);
+ ProvideLocationRoute().push(context);
},
- text: "Levering",
+ text: "Levering | $deliveryPrice kr.",
),
),
const Gap(8),
diff --git a/concierge/lib/presentation/screens/review_order/widget/review_order_app_bar.dart b/concierge/lib/presentation/screens/review_order/widget/review_order_app_bar.dart
index 007482f2..e775b9bd 100644
--- a/concierge/lib/presentation/screens/review_order/widget/review_order_app_bar.dart
+++ b/concierge/lib/presentation/screens/review_order/widget/review_order_app_bar.dart
@@ -1,6 +1,5 @@
import 'package:concierge/presentation/app/cart_cubit.dart';
import 'package:concierge/presentation/screens/confirm_order/confirm_order_route.dart';
-import 'package:concierge/presentation/screens/provide_location/provide_location_route.dart';
import 'package:concierge/presentation/theme/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -11,31 +10,36 @@ class ReviewOrderAppBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cartCubit = context.read<CartCubit>();
- return Padding(
- padding: const EdgeInsets.all(16.0),
- child: SizedBox(
- height: 100,
- child: SafeArea(
- child: ElevatedButton(
- style: ButtonStyle(
- backgroundColor: WidgetStateMapper({
- WidgetState.disabled: Colors.grey,
- WidgetState.any: AppColors.sandColor,
- }),
- ),
- onPressed: cartCubit.products.isEmpty ? null : () => ConfirmOrderRoute().push(context),
- child: Row(
- children: [
- Text(
- "Bekræft bestilling",
- style: TextStyle(color: Colors.white),
- ),
- Spacer(),
- Text(
- "${cartCubit.totalPrice} kr.",
- style: TextStyle(color: Colors.white),
- ),
- ],
+ return Container(
+ decoration: BoxDecoration(
+ border: Border(top: BorderSide(color: Colors.grey.shade300, width: 1)),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: SizedBox(
+ height: 70,
+ child: SafeArea(
+ child: ElevatedButton(
+ style: ButtonStyle(
+ backgroundColor: WidgetStateMapper({
+ WidgetState.disabled: Colors.grey,
+ WidgetState.any: AppColors.sandColor,
+ }),
+ ),
+ onPressed: cartCubit.products.isEmpty ? null : () => ConfirmOrderRoute().push(context),
+ child: Row(
+ children: [
+ Text(
+ "Bekræft bestilling",
+ style: TextStyle(color: Colors.white),
+ ),
+ Spacer(),
+ Text(
+ "${cartCubit.totalPrice} kr.",
+ style: TextStyle(color: Colors.white),
+ ),
+ ],
+ ),
),
),
),
diff --git a/concierge/lib/presentation/widgets/toggle_list_item.dart b/concierge/lib/presentation/widgets/toggle_list_item.dart
new file mode 100644
index 00000000..63855a5d
--- /dev/null
+++ b/concierge/lib/presentation/widgets/toggle_list_item.dart
@@ -0,0 +1,95 @@
+import 'package:concierge/presentation/theme/app_colors.dart';
+import 'package:concierge/presentation/widgets/toggle_checkmark.dart';
+import 'package:flutter/material.dart';
+import 'package:gap/gap.dart';
+
+class ToggleListItem extends StatelessWidget {
+ const ToggleListItem({
+ super.key,
+ required this.icon,
+ required this.title,
+ required this.subtitle,
+ required this.isSelected,
+ required this.onClick,
+ this.onSelectedExtra,
+ });
+
+ final IconData icon;
+ final String title;
+ final String subtitle;
+ final bool isSelected;
+ final Widget? onSelectedExtra;
+ final void Function(bool) onClick;
+
+ @override
+ Widget build(BuildContext context) {
+ final Color bgColor;
+ final Color iconBgColor;
+ final Border? borderSide;
+ if (isSelected) {
+ bgColor = AppColors.colorSecondary;
+ iconBgColor = Color(0xFFD7C9B9);
+ borderSide = null;
+ } else {
+ bgColor = Colors.white;
+ iconBgColor = AppColors.colorSecondary;
+ borderSide = Border.all(color: Colors.grey.shade300, width: 1);
+ }
+
+ return Ink(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(16),
+ color: bgColor,
+ border: borderSide,
+ ),
+ child: InkWell(
+ borderRadius: BorderRadius.circular(16),
+ onTap: () {
+ onClick(!isSelected);
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ children: [
+ Row(
+ children: [
+ Container(
+ width: 36,
+ height: 36,
+ decoration: BoxDecoration(shape: BoxShape.circle, color: iconBgColor),
+ child: Icon(
+ icon,
+ size: 20,
+ color: Colors.black,
+ ),
+ ),
+ Gap(12),
+ Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(title, style: TextStyle(color: Colors.black)),
+ Text(
+ subtitle,
+ style: TextStyle(
+ color: Colors.black.withAlpha((0.5 * 255).toInt()),
+ fontSize: 12,
+ ),
+ ),
+ ],
+ ),
+ Spacer(),
+ ToggleCheckmark(
+ isSelected: isSelected,
+ size: 32,
+ ),
+ ],
+ ),
+ if (isSelected) onSelectedExtra ?? const SizedBox(),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/concierge/pubspec.yaml b/concierge/pubspec.yaml
index fac833f6..a4a10fb2 100644
--- a/concierge/pubspec.yaml
+++ b/concierge/pubspec.yaml
@@ -30,6 +30,7 @@ dependencies:
flutter_secure_storage: ^9.2.4
fpdart: ^1.2.0
flutter_html: ^3.0.0
+ pin_code_fields: ^9.1.0
dev_dependencies:
flutter_test: