course-work/lib/ui/courierdetails.dart

82 lines
3.1 KiB
Dart
Raw Normal View History

2022-12-27 06:23:01 +00:00
part of 'courierspage.dart';
class CouriersDetails extends StatelessWidget {
const CouriersDetails({super.key});
@override
Widget build(final BuildContext context) => BrandBottomSheet(
child: BlocProvider(
create: (final BuildContext context) => CourierFormCubit(
cubit: context.read<CouriersCubit>(),
),
child: Builder(
builder: (final BuildContext context) =>
BlocListener<CourierFormCubit, 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<CourierFormCubit>().name,
decoration: const InputDecoration(
labelText: 'Имя',
),
),
),
const SizedBox(height: 20),
CubitFormTextField(
formFieldCubit:
context.read<CourierFormCubit>().surname,
decoration: const InputDecoration(
alignLabelWithHint: false,
labelText: 'Фамилия',
),
),
const SizedBox(height: 20),
CubitFormTextField(
formFieldCubit:
context.read<CourierFormCubit>().phone,
decoration: const InputDecoration(
alignLabelWithHint: false,
labelText: 'Телефон',
),
),
const SizedBox(height: 30),
FilledButton(
onPressed: () =>
context.read<CourierFormCubit>().trySubmit(),
title: 'Создать',
),
const SizedBox(height: 40),
],
),
),
],
),
),
),
),
);
}