added error handling for invalid urls

This commit is contained in:
2026-01-14 20:50:36 +01:00
parent be6a44e7f0
commit c0f92fac58
3 changed files with 44 additions and 14 deletions

View File

@@ -66,8 +66,9 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
selectedCollection: selectedCollection,
onSavePressed: onCollectionSaved,
onDeletePressed: () {
Storage.deleteCollection(selectedCollection);
setState(() {});
Storage.deleteCollection(
selectedCollection,
).whenComplete(() => setState(() {}));
},
),
);
@@ -79,7 +80,9 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
addingNewBookmark = provider.currentMapsLinkMetadata != null;
return Scaffold(
appBar: AppBar(
title: addingNewBookmark ? Text('Choose Collection') : null,
title: addingNewBookmark
? Text('Choose Collection')
: Text('Collections'),
actions: [
if (addingNewBookmark)
TextButton(
@@ -92,11 +95,15 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
onPressed: onAddButtonPressed,
child: Icon(Icons.add),
),
body: ListView.builder(
itemBuilder: (context, index) =>
collectionsListItemBuilder(context, collections.elementAt(index)),
itemCount: collections.length,
),
body: collections.isNotEmpty
? ListView.builder(
itemBuilder: (context, index) => collectionsListItemBuilder(
context,
collections.elementAt(index),
),
itemCount: collections.length,
)
: Center(child: Text('Create your first Collection to get started!')),
);
}
}