added workflow to add bookmark from share intent
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../model/bookmark.dart';
|
||||
import '../model/maps_link_metadata.dart';
|
||||
|
||||
class CreateBookmarkDialog extends StatelessWidget {
|
||||
const CreateBookmarkDialog({
|
||||
@@ -9,10 +10,12 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
required this.collectionId,
|
||||
required this.onSavePressed,
|
||||
this.selectedBookmark,
|
||||
this.selectedMapsLink,
|
||||
});
|
||||
final void Function(Bookmark bookmark) onSavePressed;
|
||||
final int collectionId;
|
||||
final Bookmark? selectedBookmark;
|
||||
final MapsLinkMetadata? selectedMapsLink;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -20,6 +23,12 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
final linkController = TextEditingController();
|
||||
final descriptionController = TextEditingController();
|
||||
|
||||
if (selectedMapsLink != null) {
|
||||
nameController.text = selectedMapsLink!.placeName;
|
||||
linkController.text = selectedMapsLink!.url;
|
||||
descriptionController.text = selectedMapsLink!.description;
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: Text('Create Bookmark'),
|
||||
content: SingleChildScrollView(
|
||||
@@ -82,19 +91,28 @@ class CreateBookmarkDialog extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
onSavePressed(
|
||||
Bookmark(
|
||||
collectionId: collectionId,
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Icon(Icons.save),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text('Cancel'),
|
||||
),
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
onSavePressed(
|
||||
Bookmark(
|
||||
collectionId: collectionId,
|
||||
name: nameController.text,
|
||||
link: linkController.text,
|
||||
description: descriptionController.text,
|
||||
),
|
||||
);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Icon(Icons.save),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user