118 lines
4.9 KiB
Dart
118 lines
4.9 KiB
Dart
part of 'orderspage.dart';
|
|
|
|
class OrdersDetails extends StatelessWidget {
|
|
const OrdersDetails({super.key});
|
|
|
|
@override
|
|
Widget build(final BuildContext context) => BrandBottomSheet(
|
|
child: BlocProvider(
|
|
create: (final BuildContext context) => OrderFormCubit(
|
|
cubit: context.read<OrdersCubit>(),
|
|
),
|
|
child: Builder(
|
|
builder: (final BuildContext context) =>
|
|
BlocListener<OrderFormCubit, FormCubitState>(
|
|
listener:
|
|
(final BuildContext context, final FormCubitState state) {
|
|
if (state.isSubmitted) {
|
|
Navigator.pop(context);
|
|
}
|
|
},
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
AppBar(
|
|
title: const Padding(
|
|
padding: EdgeInsets.only(top: 4.0),
|
|
child: Text('Новый заказ!'),
|
|
),
|
|
),
|
|
const SizedBox(width: 14),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const SizedBox(width: 14),
|
|
IntrinsicHeight(
|
|
child: CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().title,
|
|
decoration: const InputDecoration(
|
|
labelText: 'Наименование',
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().description,
|
|
decoration: const InputDecoration(
|
|
alignLabelWithHint: false,
|
|
labelText: 'Описание',
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().address,
|
|
decoration: const InputDecoration(
|
|
alignLabelWithHint: false,
|
|
labelText: 'Адрес доставки',
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().customerName,
|
|
decoration: const InputDecoration(
|
|
alignLabelWithHint: false,
|
|
labelText: 'Имя заказчика',
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().customerPhone,
|
|
decoration: const InputDecoration(
|
|
alignLabelWithHint: false,
|
|
labelText: 'Телефон заказчика',
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().orderDate,
|
|
decoration: const InputDecoration(
|
|
alignLabelWithHint: false,
|
|
labelText: 'Дата заказа',
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
CubitFormTextField(
|
|
formFieldCubit:
|
|
context.read<OrderFormCubit>().deliveryDate,
|
|
decoration: const InputDecoration(
|
|
alignLabelWithHint: false,
|
|
labelText: 'Дата доставки',
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
FilledButton(
|
|
onPressed: () =>
|
|
context.read<OrderFormCubit>().trySubmit(),
|
|
title: 'Создать',
|
|
),
|
|
const SizedBox(height: 40),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|