6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit f09eb11c
Changed files
.../presentation/app/cart_cubit.freezed.dart | 46 ++++++++++++---------- concierge/lib/domain/models/delivery_location.dart | 17 ++++++++ concierge/lib/domain/models/delivery_method.dart | 17 -------- .../domain/repositories/property_repository.dart | 11 +++++- concierge/lib/presentation/app/cart_cubit.dart | 7 ++++ .../confirm_order/confirm_order_screen.dart | 4 ++ .../widgets/confirm_order_product_list_tile.dart | 11 ++++-- .../screens/payment/bloc/payment_cubit.dart | 10 ++++- .../product_details/product_details_screen.dart | 32 ++------------- 9 files changed, 83 insertions(+), 72 deletions(-)
Diff
diff --git a/concierge/lib/_generated/presentation/app/cart_cubit.freezed.dart b/concierge/lib/_generated/presentation/app/cart_cubit.freezed.dart
index fff55b45..94d590a5 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; String get comment; String get readyTime; 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; 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.comment, comment) || other.comment == comment)&&(identical(other.readyTime, readyTime) || other.readyTime == readyTime)&&(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.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,comment,readyTime,selectedArea);
+int get hashCode => Object.hash(runtimeType,isLoading,error,const DeepCollectionEquality().hash(productsWithQuantity),isDelivery,chargeToRoom,comment,readyTime,deliveryLocation,selectedArea);
@override
String toString() {
- return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, comment: $comment, readyTime: $readyTime, selectedArea: $selectedArea)';
+ return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, chargeToRoom: $chargeToRoom, comment: $comment, readyTime: $readyTime, 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, String comment, String readyTime, AreaDetails? selectedArea
+ bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea
});
@@ -62,15 +62,17 @@ 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? comment = null,Object? readyTime = 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? 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
as AppError,productsWithQuantity: null == productsWithQuantity ? _self.productsWithQuantity : productsWithQuantity // ignore: cast_nullable_to_non_nullable
as Map<int, ProductInCart>,isDelivery: null == isDelivery ? _self.isDelivery : isDelivery // ignore: cast_nullable_to_non_nullable
+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,selectedArea: freezed == selectedArea ? _self.selectedArea : selectedArea // 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?,
));
}
@@ -156,10 +158,10 @@ return $default(_that);case _:
/// }
/// ```
-@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, String comment, String readyTime, 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, 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.comment,_that.readyTime,_that.selectedArea);case _:
+return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocation,_that.selectedArea);case _:
return orElse();
}
@@ -177,10 +179,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, String comment, String readyTime, 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, DeliveryLocation deliveryLocation, AreaDetails? selectedArea) $default,) {final _that = this;
switch (_that) {
case _CartState():
-return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.comment,_that.readyTime,_that.selectedArea);case _:
+return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocation,_that.selectedArea);case _:
throw StateError('Unexpected subclass');
}
@@ -197,10 +199,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, String comment, String readyTime, 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, 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.comment,_that.readyTime,_that.selectedArea);case _:
+return $default(_that.isLoading,_that.error,_that.productsWithQuantity,_that.isDelivery,_that.chargeToRoom,_that.comment,_that.readyTime,_that.deliveryLocation,_that.selectedArea);case _:
return null;
}
@@ -212,7 +214,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.comment = "", this.readyTime = "", 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.deliveryLocation = DeliveryLocation.room, this.selectedArea}): _productsWithQuantity = productsWithQuantity,super._();
@override@JsonKey() final bool isLoading;
@@ -225,8 +227,10 @@ class _CartState extends CartState {
}
@override@JsonKey() final bool isDelivery;
+@override@JsonKey() final bool chargeToRoom;
@override@JsonKey() final String comment;
@override@JsonKey() final String readyTime;
+@override@JsonKey() final DeliveryLocation deliveryLocation;
@override final AreaDetails? selectedArea;
/// Create a copy of CartState
@@ -239,16 +243,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.comment, comment) || other.comment == comment)&&(identical(other.readyTime, readyTime) || other.readyTime == readyTime)&&(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.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,comment,readyTime,selectedArea);
+int get hashCode => Object.hash(runtimeType,isLoading,error,const DeepCollectionEquality().hash(_productsWithQuantity),isDelivery,chargeToRoom,comment,readyTime,deliveryLocation,selectedArea);
@override
String toString() {
- return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, comment: $comment, readyTime: $readyTime, selectedArea: $selectedArea)';
+ return 'CartState(isLoading: $isLoading, error: $error, productsWithQuantity: $productsWithQuantity, isDelivery: $isDelivery, chargeToRoom: $chargeToRoom, comment: $comment, readyTime: $readyTime, deliveryLocation: $deliveryLocation, selectedArea: $selectedArea)';
}
@@ -259,7 +263,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, String comment, String readyTime, AreaDetails? selectedArea
+ bool isLoading, AppError error, Map<int, ProductInCart> productsWithQuantity, bool isDelivery, bool chargeToRoom, String comment, String readyTime, DeliveryLocation deliveryLocation, AreaDetails? selectedArea
});
@@ -276,15 +280,17 @@ 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? comment = null,Object? readyTime = 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? 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
as AppError,productsWithQuantity: null == productsWithQuantity ? _self._productsWithQuantity : productsWithQuantity // ignore: cast_nullable_to_non_nullable
as Map<int, ProductInCart>,isDelivery: null == isDelivery ? _self.isDelivery : isDelivery // ignore: cast_nullable_to_non_nullable
+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,selectedArea: freezed == selectedArea ? _self.selectedArea : selectedArea // 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/domain/models/delivery_location.dart b/concierge/lib/domain/models/delivery_location.dart
new file mode 100644
index 00000000..89b8c206
--- /dev/null
+++ b/concierge/lib/domain/models/delivery_location.dart
@@ -0,0 +1,17 @@
+sealed class DeliveryLocation {
+ const DeliveryLocation();
+
+ static const room = Room();
+
+ static area(String code) => Area(code);
+}
+
+class Room extends DeliveryLocation {
+ const Room();
+}
+
+class Area extends DeliveryLocation {
+ final String code;
+
+ const Area(this.code);
+}
diff --git a/concierge/lib/domain/models/delivery_method.dart b/concierge/lib/domain/models/delivery_method.dart
deleted file mode 100644
index 90efd3d9..00000000
--- a/concierge/lib/domain/models/delivery_method.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-sealed class DeliveryMethod {
- const DeliveryMethod();
-
- static const pickUp = PickUp();
-
- static delivery(String time) => Delivery(time);
-}
-
-class PickUp extends DeliveryMethod {
- const PickUp();
-}
-
-class Delivery extends DeliveryMethod {
- final String time;
-
- const Delivery(this.time);
-}
diff --git a/concierge/lib/domain/repositories/property_repository.dart b/concierge/lib/domain/repositories/property_repository.dart
index aa4839e5..b67975e4 100644
--- a/concierge/lib/domain/repositories/property_repository.dart
+++ b/concierge/lib/domain/repositories/property_repository.dart
@@ -4,7 +4,7 @@ import 'package:concierge/data/remote/models/order.dart';
import 'package:concierge/data/remote/models/order_review.dart';
import 'package:concierge/data/remote/models/product.dart';
import 'package:concierge/data/remote/models/property.dart';
-import 'package:concierge/presentation/app/cart_cubit.dart';
+import 'package:concierge/domain/models/delivery_location.dart';
class PropertyRepository {
final ConciergeService _service;
@@ -33,6 +33,8 @@ class PropertyRepository {
required bool isDelivery,
required String readyTime,
required String comment,
+ required bool chargeToRoom,
+ required DeliveryLocation deliveryLocation,
}) async {
final body = {
"products": products,
@@ -40,11 +42,16 @@ class PropertyRepository {
"location_code": locationCode,
"delivery": isDelivery,
"requested_delivery_time": readyTime.isEmpty ? "ASAP" : readyTime,
- "payment_type": "WAITER",
+ "payment_type": chargeToRoom ? "ROOM" : "PAYMENT_SERVICE",
"customer_comment": comment,
"order_type": "PRODUCT",
"ga_client_id": "GA1.2.1247178081.1736166148",
};
+ if (deliveryLocation is Room) {
+ body["room"] = "203";
+ } else if (deliveryLocation is Area) {
+ body["location_code"] = deliveryLocation.code;
+ }
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 6a696c82..d9d32b3c 100644
--- a/concierge/lib/presentation/app/cart_cubit.dart
+++ b/concierge/lib/presentation/app/cart_cubit.dart
@@ -1,6 +1,7 @@
import 'package:concierge/data/remote/models/area_details.dart';
import 'package:concierge/data/remote/models/product.dart';
import 'package:concierge/domain/models/data_state.dart';
+import 'package:concierge/domain/models/delivery_location.dart';
import 'package:concierge/presentation/app/concierge_cubit.dart';
import 'package:concierge/presentation/base/base_cubit.dart';
import 'package:concierge/domain/models/app_error.dart';
@@ -71,6 +72,10 @@ 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
@@ -80,8 +85,10 @@ abstract class CartState with _$CartState {
@Default(AppError.none) AppError error,
@Default({}) Map<int, ProductInCart> productsWithQuantity,
@Default(false) bool isDelivery,
+ @Default(true) bool chargeToRoom,
@Default("") String comment,
@Default("") String readyTime,
+ @Default(DeliveryLocation.room) DeliveryLocation deliveryLocation,
AreaDetails? selectedArea,
}) = _CartState;
diff --git a/concierge/lib/presentation/screens/confirm_order/confirm_order_screen.dart b/concierge/lib/presentation/screens/confirm_order/confirm_order_screen.dart
index 83d77454..e9ca6fe8 100644
--- a/concierge/lib/presentation/screens/confirm_order/confirm_order_screen.dart
+++ b/concierge/lib/presentation/screens/confirm_order/confirm_order_screen.dart
@@ -1,6 +1,7 @@
import 'package:concierge/presentation/app/cart_cubit.dart';
import 'package:concierge/presentation/screens/confirm_order/widgets/confirm_order_action_bar.dart';
import 'package:concierge/presentation/screens/confirm_order/widgets/confirm_order_product_list_tile.dart';
+import 'package:concierge/presentation/screens/confirm_order/widgets/select_payment_method.dart';
import 'package:concierge/presentation/screens/payment/payment_route.dart';
import 'package:concierge/presentation/widgets/bevelled_app_bar.dart';
import 'package:concierge/presentation/widgets/comment_field.dart';
@@ -43,6 +44,9 @@ class ConfirmOrderScreen extends StatelessWidget {
...buildCommentField(context),
const Gap(36),
Text("Betaling", style: TextStyle(fontSize: 20)),
+ const Gap(16),
+ SelectPaymentMethod(),
+ const Gap(40),
],
),
),
diff --git a/concierge/lib/presentation/screens/confirm_order/widgets/confirm_order_product_list_tile.dart b/concierge/lib/presentation/screens/confirm_order/widgets/confirm_order_product_list_tile.dart
index bab9ee0c..6d3f7aa4 100644
--- a/concierge/lib/presentation/screens/confirm_order/widgets/confirm_order_product_list_tile.dart
+++ b/concierge/lib/presentation/screens/confirm_order/widgets/confirm_order_product_list_tile.dart
@@ -5,7 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:gap/gap.dart';
class ConfirmOrderProductListTile extends StatelessWidget {
- const ConfirmOrderProductListTile({super.key, required this.product});
+ const ConfirmOrderProductListTile({super.key, required this.product});
final Product product;
@@ -18,8 +18,13 @@ class ConfirmOrderProductListTile extends StatelessWidget {
children: [
Text("${quantity}x"),
const Gap(16),
- Text(product.title),
- Expanded(child: Spacer()),
+ Expanded(
+ child: Text(
+ product.title,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
const Gap(16),
Text("$price kr."),
],
diff --git a/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart b/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart
index 5ca61a43..1b684ac9 100644
--- a/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart
+++ b/concierge/lib/presentation/screens/payment/bloc/payment_cubit.dart
@@ -22,8 +22,13 @@ class PaymentCubit extends BaseCubit<PaymentState> {
"options": [
...product.variant.entries.map(
(entry) => {
- "option": entry.key,
- "answer": entry.value,
+ "id": entry.key,
+ "answers": [
+ {
+ "id": entry.value,
+ "is_selected": true,
+ },
+ ],
},
),
],
@@ -37,6 +42,7 @@ class PaymentCubit extends BaseCubit<PaymentState> {
locationCode: "_cartCubit.state",
readyTime: _cartCubit.state.readyTime,
comment: _cartCubit.state.comment,
+ chargeToRoom: _cartCubit.state.chargeToRoom,
);
// TODO handling payment
print("qqq response=$response");
diff --git a/concierge/lib/presentation/screens/product_details/product_details_screen.dart b/concierge/lib/presentation/screens/product_details/product_details_screen.dart
index 7d8732e8..0aba8b28 100644
--- a/concierge/lib/presentation/screens/product_details/product_details_screen.dart
+++ b/concierge/lib/presentation/screens/product_details/product_details_screen.dart
@@ -2,6 +2,7 @@ import 'package:concierge/data/remote/models/product.dart';
import 'package:concierge/presentation/screens/product_details/widgets/product_details_app_bar.dart';
import 'package:concierge/presentation/widgets/bevelled_app_bar.dart';
import 'package:concierge/presentation/widgets/padded_column.dart';
+import 'package:concierge/presentation/widgets/toggle_checkmark.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:concierge/presentation/screens/product_details/bloc/product_details_cubit.dart';
@@ -122,7 +123,9 @@ class ProductDetailsScreen extends StatelessWidget {
color: Colors.black,
border: Border.all(color: Colors.grey),
),
- child: buildAnswerCheckmark(answer.id == cubit.state.selectedVariant[option.id]),
+ child: ToggleCheckmark(
+ isSelected: answer.id == cubit.state.selectedVariant[option.id],
+ ),
),
],
),
@@ -132,31 +135,4 @@ class ProductDetailsScreen extends StatelessWidget {
}
}
}
-
- Widget buildAnswerCheckmark(bool isSelected) {
- if (isSelected) {
- return Container(
- height: 20,
- width: 20,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.black,
- ),
- child: Icon(
- Icons.check,
- size: 12,
- color: Colors.white,
- ),
- );
- }
- return Container(
- height: 20,
- width: 20,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: Colors.white,
- border: Border.all(color: Colors.grey, width: 1),
- ),
- );
- }
}