Implemented note templates and enhanced usability by adjusting the dimension of the note dialogs

This commit is contained in:
Dennis Nemec
2026-01-08 14:10:21 +01:00
parent 6a53d2d716
commit ffdd7fa0ff
6 changed files with 98 additions and 56 deletions

View File

@ -13,6 +13,11 @@ import 'package:hl_lieferservice/widget/operations/bloc/operation_bloc.dart';
import 'package:hl_lieferservice/widget/operations/bloc/operation_event.dart';
import 'package:image_picker/image_picker.dart';
enum NoteAction {
addNote,
addImage
}
class NoteOverview extends StatefulWidget {
final List<NoteInformation> notes;
final List<NoteTemplate> templates;
@ -35,12 +40,15 @@ class _NoteOverviewState extends State<NoteOverview> {
final _imagePicker = ImagePicker();
Widget _notes() {
for (final note in widget.notes) {
debugPrint("Note: ${note.note.content}");
debugPrint("NOTE Article: ${note.article?.name.toString()}");
}
return NoteList(notes: widget.notes, deliveryId: widget.deliveryId);
}
Widget _images() {
debugPrint("IMAGES: ${widget.images}");
return NoteImageOverview(
images: widget.images,
deliveryId: widget.deliveryId,
@ -50,11 +58,11 @@ class _NoteOverviewState extends State<NoteOverview> {
void _onAddNote(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return NoteAddDialog(
builder: (_) {
return BlocProvider.value(value: context.read<NoteBloc>(), child: NoteAddDialog(
delivery: widget.deliveryId,
templates: widget.templates,
);
));
},
);
}
@ -107,10 +115,21 @@ class _NoteOverviewState extends State<NoteOverview> {
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(right: 25),
child: PopupMenuButton(
itemBuilder: (context) {
child: PopupMenuButton<NoteAction>(
onSelected: (NoteAction action) {
switch (action) {
case NoteAction.addNote:
_onAddNote(context);
break;
case NoteAction.addImage:
_onAddImage(context);
break;
}
},
itemBuilder: (_) {
return [
PopupMenuItem(
PopupMenuItem<NoteAction>(
value: NoteAction.addNote,
child: Row(
children: [
Icon(
@ -123,9 +142,9 @@ class _NoteOverviewState extends State<NoteOverview> {
),
],
),
onTap: () => _onAddNote(context),
),
PopupMenuItem(
PopupMenuItem<NoteAction>(
value: NoteAction.addImage,
child: Row(
children: [
Icon(
@ -138,7 +157,6 @@ class _NoteOverviewState extends State<NoteOverview> {
),
],
),
onTap: () => _onAddImage(context),
),
];
},