61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import '../../../../application/table/table_form/table_form_bloc.dart';
|
|
import '../../button/button.dart';
|
|
import '../../field/field.dart';
|
|
import '../../spaces/space.dart';
|
|
import '../dialog.dart';
|
|
|
|
class TableCreateDialog extends StatelessWidget {
|
|
const TableCreateDialog({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<TableFormBloc, TableFormState>(
|
|
builder: (context, state) {
|
|
return CustomModalDialog(
|
|
title: 'Tambah Meja',
|
|
subtitle: 'Silahkan isi data meja',
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
horizontal: 16.0,
|
|
vertical: 24.0,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
AppTextFormField(
|
|
label: 'Nama Meja',
|
|
onChanged: (value) {
|
|
context.read<TableFormBloc>().add(
|
|
TableFormEvent.nameChanged(value),
|
|
);
|
|
},
|
|
),
|
|
SpaceHeight(16),
|
|
AppTextFormField(
|
|
label: 'Kapasitas',
|
|
keyboardType: TextInputType.number,
|
|
onChanged: (value) {
|
|
context.read<TableFormBloc>().add(
|
|
TableFormEvent.capacityChanged(value),
|
|
);
|
|
},
|
|
),
|
|
SpaceHeight(24),
|
|
AppElevatedButton.filled(
|
|
onPressed: () {
|
|
context.read<TableFormBloc>().add(
|
|
const TableFormEvent.created(),
|
|
);
|
|
},
|
|
label: "Simpan",
|
|
isLoading: state.isCreating,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|