Skip to content

Commit 4cc58a2

Browse files
committed
Add unlink button
1 parent 14e5ac4 commit 4cc58a2

File tree

13 files changed

+402
-369
lines changed

13 files changed

+402
-369
lines changed

api/pubspec.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ packages:
5353
dependency: transitive
5454
description:
5555
name: build
56-
sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0
56+
sha256: "74273591bd8b7f82eeb1f191c1b65a6576535bbfd5ca3722778b07d5702d33cc"
5757
url: "https://pub.dev"
5858
source: hosted
59-
version: "2.4.2"
59+
version: "2.5.3"
6060
build_config:
6161
dependency: transitive
6262
description:
@@ -77,26 +77,26 @@ packages:
7777
dependency: transitive
7878
description:
7979
name: build_resolvers
80-
sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0
80+
sha256: badce70566085f2e87434531c4a6bc8e833672f755fc51146d612245947e91c9
8181
url: "https://pub.dev"
8282
source: hosted
83-
version: "2.4.4"
83+
version: "2.5.3"
8484
build_runner:
8585
dependency: "direct dev"
8686
description:
8787
name: build_runner
88-
sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99"
88+
sha256: b9070a4127033777c0e63195f6f117ed16a351ed676f6313b095cf4f328c0b82
8989
url: "https://pub.dev"
9090
source: hosted
91-
version: "2.4.15"
91+
version: "2.5.3"
9292
build_runner_core:
9393
dependency: transitive
9494
description:
9595
name: build_runner_core
96-
sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021"
96+
sha256: "1cdfece3eeb3f1263f7dbf5bcc0cba697bd0c22d2c866cb4b578c954dbb09bcf"
9797
url: "https://pub.dev"
9898
source: hosted
99-
version: "8.0.0"
99+
version: "9.1.1"
100100
built_collection:
101101
dependency: transitive
102102
description:
@@ -558,10 +558,10 @@ packages:
558558
dependency: transitive
559559
description:
560560
name: watcher
561-
sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104"
561+
sha256: "0b7fd4a0bbc4b92641dbf20adfd7e3fd1398fe17102d94b674234563e110088a"
562562
url: "https://pub.dev"
563563
source: hosted
564-
version: "1.1.1"
564+
version: "1.1.2"
565565
web:
566566
dependency: transitive
567567
description:

app/lib/blocs/sourced_paging.dart

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class SourcedPagingBloc<T>
7272
final state = this.state;
7373
if (state is SourcedPagingSuccess<T>) {
7474
final items = state.dates.map((e) => e
75-
.where((i) =>
75+
.whereNot((i) =>
7676
i.model == event.item &&
7777
(event.source == null || (i.source == event.source)))
7878
.toList());
@@ -167,13 +167,17 @@ class SourcedPagingBloc<T>
167167
void removeSourced(T item) => add(SourcedPagingRemoved(item));
168168
}
169169

170-
Future<List<T>?> Function(String source, SourceService service, int offset, int limit, int date) _buildDatedFetch<T>(ItemFetcher<T> fetch) => (String source,
171-
SourceService service, int offset, int limit, int date) async {
172-
final items = await fetch(source, service, offset, limit);
173-
return items;
174-
};
175-
Future<List<T>?> Function(String source, SourceService service, int offset, int limit, int date) _buildDatedFetchSource<T>(SourceFetcher<T> fetch) => (String source,
176-
SourceService service, int offset, int limit, int date) async {
177-
final items = await fetch(service, offset, limit);
178-
return items;
179-
};
170+
Future<List<T>?> Function(
171+
String source, SourceService service, int offset, int limit, int date)
172+
_buildDatedFetch<T>(ItemFetcher<T> fetch) => (String source,
173+
SourceService service, int offset, int limit, int date) async {
174+
final items = await fetch(source, service, offset, limit);
175+
return items;
176+
};
177+
Future<List<T>?> Function(
178+
String source, SourceService service, int offset, int limit, int date)
179+
_buildDatedFetchSource<T>(SourceFetcher<T> fetch) => (String source,
180+
SourceService service, int offset, int limit, int date) async {
181+
final items = await fetch(service, offset, limit);
182+
return items;
183+
};

app/lib/l10n/app_en.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,5 +325,6 @@
325325
"exportSettingsToFile": "Export settings to file",
326326
"alarm": "Alarm",
327327
"enabled": "Enabled",
328-
"countdown": "Countdown"
328+
"countdown": "Countdown",
329+
"unlink": "Unlink"
329330
}

app/lib/pages/calendar/page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class _CalendarBodyViewState extends State<CalendarBodyView> {
235235
);
236236
}
237237

238-
void _onFilterChanged(value) {
238+
void _onFilterChanged(CalendarFilter value) {
239239
setState(() {
240240
_filter = value;
241241
});

app/lib/pages/groups/view.dart

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ class _GroupsViewState<T extends DescriptiveModel>
5858
child: PagedListView.source(
5959
bloc: _bloc,
6060
itemBuilder: (context, item, index) {
61+
Future<void> onDelete() async {
62+
await widget.connector.disconnect(
63+
widget.model.id!,
64+
item.id!,
65+
);
66+
_bloc.removeSourced(item);
67+
}
68+
6169
return Dismissible(
6270
key: ValueKey(item.id),
6371
background: Container(color: Colors.red),
64-
onDismissed: (direction) {
65-
widget.connector.disconnect(
66-
widget.model.id!,
67-
item.id!,
68-
);
69-
_bloc.removeSourced(item);
70-
},
72+
onDismissed: (direction) => onDelete(),
7173
child: ListTile(
7274
title: Text(item.name),
7375
onTap: () async {
@@ -80,6 +82,12 @@ class _GroupsViewState<T extends DescriptiveModel>
8082
);
8183
_bloc.refresh();
8284
},
85+
trailing: IconButton(
86+
icon:
87+
const PhosphorIcon(PhosphorIconsLight.linkBreak),
88+
tooltip: AppLocalizations.of(context).unlink,
89+
onPressed: onDelete,
90+
),
8391
),
8492
);
8593
},

app/lib/pages/notes/view.dart

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,19 @@ class _NotesViewState<T extends DescriptiveModel> extends State<NotesView<T>> {
5959
child: PagedListView<Note>.source(
6060
bloc: _bloc,
6161
itemBuilder: (context, item, index) {
62+
Future<void> onDelete() async {
63+
widget.connector.disconnect(
64+
widget.model.id!,
65+
item.id!,
66+
);
67+
_bloc.removeSourced(item);
68+
}
69+
6270
var status = item.status;
6371
return Dismissible(
6472
key: ValueKey(item.id),
6573
background: Container(color: Colors.red),
66-
onDismissed: (direction) {
67-
widget.connector.disconnect(
68-
widget.model.id!,
69-
item.id!,
70-
);
71-
_bloc.removeSourced(item);
72-
},
74+
onDismissed: (direction) => onDelete(),
7375
child: ListTile(
7476
title: Text(item.name),
7577
leading: status == null
@@ -104,6 +106,12 @@ class _NotesViewState<T extends DescriptiveModel> extends State<NotesView<T>> {
104106
);
105107
_bloc.refresh();
106108
},
109+
trailing: IconButton(
110+
icon:
111+
const PhosphorIcon(PhosphorIconsLight.linkBreak),
112+
tooltip: AppLocalizations.of(context).unlink,
113+
onPressed: onDelete,
114+
),
107115
),
108116
);
109117
},

app/lib/pages/resources/view.dart

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ class _ResourcesViewState<T extends DescriptiveModel>
5656
child: PagedListView<Resource>.source(
5757
bloc: _bloc,
5858
itemBuilder: (context, item, index) {
59+
Future<void> onDelete() async {
60+
await widget.connector.disconnect(
61+
widget.model.id!,
62+
item.id!,
63+
);
64+
_bloc.removeSourced(item);
65+
}
66+
5967
return Dismissible(
6068
key: ValueKey(item.id),
6169
background: Container(color: Colors.red),
62-
onDismissed: (direction) {
63-
widget.connector.disconnect(
64-
widget.model.id!,
65-
item.id!,
66-
);
67-
_bloc.removeSourced(item);
68-
},
70+
onDismissed: (direction) => onDelete(),
6971
child: ListTile(
7072
title: Text(item.name),
7173
onTap: () async {
@@ -78,6 +80,12 @@ class _ResourcesViewState<T extends DescriptiveModel>
7880
);
7981
_bloc.refresh();
8082
},
83+
trailing: IconButton(
84+
icon:
85+
const PhosphorIcon(PhosphorIconsLight.linkBreak),
86+
tooltip: AppLocalizations.of(context).unlink,
87+
onPressed: onDelete,
88+
),
8189
),
8290
);
8391
},

app/lib/pages/users/view.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ class _UsersViewState<T extends DescriptiveModel> extends State<UsersView<T>> {
5757
child: PagedListView.source(
5858
bloc: _bloc,
5959
itemBuilder: (context, item, index) {
60+
void onDelete() async {
61+
widget.connector.disconnect(widget.model.id!, item.id!);
62+
_bloc.removeSourced(item);
63+
}
64+
6065
return Dismissible(
6166
key: ValueKey(item.id),
6267
background: Container(color: Colors.red),
63-
onDismissed: (direction) {
64-
widget.connector.disconnect(widget.model.id!, item.id!);
65-
_bloc.removeSourced(item);
66-
},
68+
onDismissed: (direction) => onDelete(),
6769
child: ListTile(
6870
title: Text(item.name),
6971
onTap: () async {
@@ -76,6 +78,12 @@ class _UsersViewState<T extends DescriptiveModel> extends State<UsersView<T>> {
7678
);
7779
_bloc.refresh();
7880
},
81+
trailing: IconButton(
82+
icon:
83+
const PhosphorIcon(PhosphorIconsLight.linkBreak),
84+
tooltip: AppLocalizations.of(context).unlink,
85+
onPressed: onDelete,
86+
),
7987
),
8088
);
8189
},

app/pubspec.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ packages:
6969
dependency: transitive
7070
description:
7171
name: build
72-
sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0
72+
sha256: "74273591bd8b7f82eeb1f191c1b65a6576535bbfd5ca3722778b07d5702d33cc"
7373
url: "https://pub.dev"
7474
source: hosted
75-
version: "2.4.2"
75+
version: "2.5.3"
7676
build_config:
7777
dependency: transitive
7878
description:
@@ -93,26 +93,26 @@ packages:
9393
dependency: transitive
9494
description:
9595
name: build_resolvers
96-
sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0
96+
sha256: badce70566085f2e87434531c4a6bc8e833672f755fc51146d612245947e91c9
9797
url: "https://pub.dev"
9898
source: hosted
99-
version: "2.4.4"
99+
version: "2.5.3"
100100
build_runner:
101101
dependency: "direct dev"
102102
description:
103103
name: build_runner
104-
sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99"
104+
sha256: b9070a4127033777c0e63195f6f117ed16a351ed676f6313b095cf4f328c0b82
105105
url: "https://pub.dev"
106106
source: hosted
107-
version: "2.4.15"
107+
version: "2.5.3"
108108
build_runner_core:
109109
dependency: transitive
110110
description:
111111
name: build_runner_core
112-
sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021"
112+
sha256: "1cdfece3eeb3f1263f7dbf5bcc0cba697bd0c22d2c866cb4b578c954dbb09bcf"
113113
url: "https://pub.dev"
114114
source: hosted
115-
version: "8.0.0"
115+
version: "9.1.1"
116116
built_collection:
117117
dependency: transitive
118118
description:
@@ -529,10 +529,10 @@ packages:
529529
dependency: "direct main"
530530
description:
531531
name: go_router
532-
sha256: b453934c36e289cef06525734d1e676c1f91da9e22e2017d9dcab6ce0f999175
532+
sha256: "02ff498f6279470ff7f60c998a69b872f26696ceec237c8402e63a2133868ddf"
533533
url: "https://pub.dev"
534534
source: hosted
535-
version: "15.1.3"
535+
version: "15.2.3"
536536
graphs:
537537
dependency: transitive
538538
description:
@@ -1113,10 +1113,10 @@ packages:
11131113
dependency: "direct main"
11141114
description:
11151115
name: sqflite_common_ffi
1116-
sha256: "1f3ef3888d3bfbb47785cc1dda0dc7dd7ebd8c1955d32a9e8e9dae1e38d1c4c1"
1116+
sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988"
11171117
url: "https://pub.dev"
11181118
source: hosted
1119-
version: "2.3.5"
1119+
version: "2.3.6"
11201120
sqflite_common_ffi_web:
11211121
dependency: "direct main"
11221122
description:
@@ -1153,10 +1153,10 @@ packages:
11531153
dependency: "direct main"
11541154
description:
11551155
name: sqlite3_flutter_libs
1156-
sha256: "7986c26234c0a5cf4fd83ff4ee39d4195b1f47cdb50a949ec7987ede4dcbdc2a"
1156+
sha256: e07232b998755fe795655c56d1f5426e0190c9c435e1752d39e7b1cd33699c71
11571157
url: "https://pub.dev"
11581158
source: hosted
1159-
version: "0.5.33"
1159+
version: "0.5.34"
11601160
stack_trace:
11611161
dependency: transitive
11621162
description:
@@ -1345,10 +1345,10 @@ packages:
13451345
dependency: transitive
13461346
description:
13471347
name: watcher
1348-
sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104"
1348+
sha256: "0b7fd4a0bbc4b92641dbf20adfd7e3fd1398fe17102d94b674234563e110088a"
13491349
url: "https://pub.dev"
13501350
source: hosted
1351-
version: "1.1.1"
1351+
version: "1.1.2"
13521352
web:
13531353
dependency: transitive
13541354
description:
@@ -1377,10 +1377,10 @@ packages:
13771377
dependency: transitive
13781378
description:
13791379
name: win32
1380-
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
1380+
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
13811381
url: "https://pub.dev"
13821382
source: hosted
1383-
version: "5.13.0"
1383+
version: "5.14.0"
13841384
window_manager:
13851385
dependency: "direct main"
13861386
description:
@@ -1415,4 +1415,4 @@ packages:
14151415
version: "3.1.3"
14161416
sdks:
14171417
dart: ">=3.8.0 <4.0.0"
1418-
flutter: ">=3.32.2"
1418+
flutter: ">=3.32.4"

app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ version: 0.5.0+12
1919

2020
environment:
2121
sdk: ">=3.0.0 <4.0.0"
22-
flutter: 3.32.2
22+
flutter: 3.32.4
2323

2424
dependencies:
2525
flutter:

0 commit comments

Comments
 (0)