6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 95a10f8c
Changed files
.../screens/product_details/bloc/product_details_cubit.dart | 2 ++ .../screens/product_details/product_details_route.dart | 10 ++++------ .../product_details/widgets/product_details_app_bar.dart | 7 +++++-- 3 files changed, 11 insertions(+), 8 deletions(-)
Diff
diff --git a/concierge/lib/presentation/screens/product_details/bloc/product_details_cubit.dart b/concierge/lib/presentation/screens/product_details/bloc/product_details_cubit.dart
index 58b37da0..98524ce3 100644
--- a/concierge/lib/presentation/screens/product_details/bloc/product_details_cubit.dart
+++ b/concierge/lib/presentation/screens/product_details/bloc/product_details_cubit.dart
@@ -16,12 +16,14 @@ class ProductDetailsCubit extends BaseCubit<ProductDetailsState> {
this._conciergeCubit,
this._cartCubit, {
required this.productId,
+ required this.isEdit,
}) : super(ProductDetailsState()) {
init();
}
late final StreamSubscription<ConciergeState> conciergeStateStream;
final int productId;
+ final bool isEdit;
void handleProductDataState(DataState dataState) {
switch (dataState) {
diff --git a/concierge/lib/presentation/screens/product_details/product_details_route.dart b/concierge/lib/presentation/screens/product_details/product_details_route.dart
index 63591a3e..d02a91a5 100644
--- a/concierge/lib/presentation/screens/product_details/product_details_route.dart
+++ b/concierge/lib/presentation/screens/product_details/product_details_route.dart
@@ -11,19 +11,17 @@ part '../../../_generated/presentation/screens/product_details/product_details_r
@TypedGoRoute<ProductDetailsRoute>(path: AppRoutes.productDetails)
class ProductDetailsRoute extends GoRouteData with $ProductDetailsRoute {
final int id;
+ final bool isEdit;
- const ProductDetailsRoute(this.id);
+ const ProductDetailsRoute(this.id, {this.isEdit = false});
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return slideInTransition(
state: state,
child: BlocProvider(
- create: (context) => ProductDetailsCubit(
- context.read(),
- context.read(),
- productId: id,
- ),
+ create: (context) =>
+ ProductDetailsCubit(context.read(), context.read(), productId: id, isEdit: isEdit),
child: ProductDetailsScreen(),
),
);
diff --git a/concierge/lib/presentation/screens/product_details/widgets/product_details_app_bar.dart b/concierge/lib/presentation/screens/product_details/widgets/product_details_app_bar.dart
index 7cca6dc6..5037378a 100644
--- a/concierge/lib/presentation/screens/product_details/widgets/product_details_app_bar.dart
+++ b/concierge/lib/presentation/screens/product_details/widgets/product_details_app_bar.dart
@@ -30,7 +30,10 @@ class ProductDetailsAppBar extends StatelessWidget {
),
),
const Gap(10),
- Text(state.quantity.toString(), style: TextStyle(fontSize: 18),),
+ Text(
+ state.quantity.toString(),
+ style: TextStyle(fontSize: 18),
+ ),
const Gap(10),
Container(
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.black),
@@ -57,7 +60,7 @@ class ProductDetailsAppBar extends StatelessWidget {
context.pop();
},
child: Text(
- "Add to order",
+ productDetailsCubit.isEdit ? "Opdater bestilling" : "Add to order",
style: TextStyle(color: Colors.white),
),
),