added abilty to edit and delete collections
This commit is contained in:
@@ -3,6 +3,8 @@ import 'package:flutter/services.dart';
|
||||
|
||||
import '../model/bookmark.dart';
|
||||
import '../model/maps_link_metadata.dart';
|
||||
import 'edit_dialog_widgets/edit_dialog_actions.dart';
|
||||
import 'edit_dialog_widgets/edit_dialog_title.dart';
|
||||
|
||||
class CreateBookmarkDialog extends StatelessWidget {
|
||||
const CreateBookmarkDialog({
|
||||
@@ -13,6 +15,7 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
this.selectedBookmark,
|
||||
this.selectedMapsLink,
|
||||
});
|
||||
|
||||
final void Function(Bookmark bookmark)? onSavePressed;
|
||||
final void Function()? onDeletePressed;
|
||||
final int collectionId;
|
||||
@@ -36,25 +39,10 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Create Bookmark'),
|
||||
|
||||
if (selectedBookmark != null)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
onDeletePressed?.call();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
'Delete',
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
),
|
||||
],
|
||||
title: EditDialogTitle(
|
||||
dialogType: DialogType.bookmark,
|
||||
onDeletePressed: onDeletePressed,
|
||||
),
|
||||
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -115,33 +103,23 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text('Cancel'),
|
||||
),
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
final bookmark =
|
||||
selectedBookmark?.copyWith(
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
) ??
|
||||
Bookmark(
|
||||
collectionId: collectionId,
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
);
|
||||
onSavePressed?.call(bookmark);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Icon(Icons.save),
|
||||
),
|
||||
],
|
||||
EditDialogActions(
|
||||
onSavePressed: () {
|
||||
final bookmark =
|
||||
selectedBookmark?.copyWith(
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
) ??
|
||||
Bookmark(
|
||||
collectionId: collectionId,
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
);
|
||||
onSavePressed?.call(bookmark);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user