checkout page
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../application/checkout/checkout_form/checkout_form_bloc.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../components/spaces/space.dart';
|
||||
import 'widgets/checkout_left_panel.dart';
|
||||
import 'widgets/checkout_right_panel.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CheckoutPage extends StatelessWidget {
|
||||
const CheckoutPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Hero(
|
||||
tag: 'checkout_screen',
|
||||
child: BlocBuilder<CheckoutFormBloc, CheckoutFormState>(
|
||||
builder: (context, state) {
|
||||
final price = state.items.fold(
|
||||
0,
|
||||
(previousValue, element) =>
|
||||
previousValue +
|
||||
(element.product.price.toInt() +
|
||||
(element.variant?.priceModifier.toInt() ?? 0)) *
|
||||
element.quantity,
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.white,
|
||||
body: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: CheckoutLeftPanel(
|
||||
checkoutState: state,
|
||||
price: price,
|
||||
),
|
||||
),
|
||||
SpaceWidth(2),
|
||||
Expanded(flex: 3, child: CheckoutRightPanel()),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user