89 lines
3.5 KiB
Dart
89 lines
3.5 KiB
Dart
|
part of 'itemspage.dart';
|
||
|
|
||
|
class ItemsDetails extends StatelessWidget {
|
||
|
const ItemsDetails({super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(final BuildContext context) => BrandBottomSheet(
|
||
|
child: BlocProvider(
|
||
|
create: (final BuildContext context) => ItemFormCubit(
|
||
|
cubit: context.read<ItemsCubit>(),
|
||
|
),
|
||
|
child: Builder(
|
||
|
builder: (final BuildContext context) =>
|
||
|
BlocListener<ItemFormCubit, 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<ItemFormCubit>().title,
|
||
|
decoration: const InputDecoration(
|
||
|
labelText: 'Название',
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(height: 20),
|
||
|
CubitFormTextField(
|
||
|
formFieldCubit:
|
||
|
context.read<ItemFormCubit>().description,
|
||
|
decoration: const InputDecoration(
|
||
|
alignLabelWithHint: false,
|
||
|
labelText: 'Описание',
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(height: 20),
|
||
|
CubitFormIntField(
|
||
|
formFieldCubit: context.read<ItemFormCubit>().price,
|
||
|
decoration: const InputDecoration(
|
||
|
alignLabelWithHint: false,
|
||
|
labelText: 'Цена',
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(height: 20),
|
||
|
CubitFormIntField(
|
||
|
formFieldCubit:
|
||
|
context.read<ItemFormCubit>().quantity,
|
||
|
decoration: const InputDecoration(
|
||
|
alignLabelWithHint: false,
|
||
|
labelText: 'Количество',
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(height: 30),
|
||
|
FilledButton(
|
||
|
onPressed: () =>
|
||
|
context.read<ItemFormCubit>().trySubmit(),
|
||
|
title: 'Создать',
|
||
|
),
|
||
|
const SizedBox(height: 40),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|