Skip to content

Commit 9ff3455

Browse files
committed
fix #882
1 parent b71b055 commit 9ff3455

File tree

3 files changed

+41
-29
lines changed

3 files changed

+41
-29
lines changed

lib/page/notify_page.dart

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ class NotifyPage extends StatefulWidget {
2424
}
2525

2626
class _NotifyPageState extends State<NotifyPage>
27-
with AutomaticKeepAliveClientMixin<NotifyPage>, GSYListState<NotifyPage> {
28-
final SlidableController slidableController = SlidableController();
27+
with
28+
AutomaticKeepAliveClientMixin<NotifyPage>,
29+
GSYListState<NotifyPage>,
30+
SingleTickerProviderStateMixin {
31+
late SlidableController slidableController;
2932

3033
int selectIndex = 0;
3134

@@ -40,26 +43,29 @@ class _NotifyPageState extends State<NotifyPage>
4043
return Slidable(
4144
key: ValueKey<String>("${index}_$selectIndex"),
4245
controller: slidableController,
43-
actionPane: const SlidableBehindActionPane(),
44-
actionExtentRatio: 0.25,
45-
child: _renderEventItem(notification),
46-
dismissal: SlidableDismissal(
47-
child: const SlidableDrawerDismissal(),
48-
onDismissed: (actionType) {},
46+
endActionPane: ActionPane(
47+
motion: const ScrollMotion(),
48+
dismissible: DismissiblePane(onDismissed: () {
49+
UserDao.setNotificationAsReadDao(notification.id.toString())
50+
.then((res) {
51+
showRefreshLoading();
52+
});
53+
}),
54+
children: [
55+
SlidableAction(
56+
label: GSYLocalizations.i18n(context)!.notify_readed,
57+
backgroundColor: Colors.redAccent,
58+
icon: Icons.delete,
59+
onPressed: (c) {
60+
UserDao.setNotificationAsReadDao(notification.id.toString())
61+
.then((res) {
62+
showRefreshLoading();
63+
});
64+
},
65+
),
66+
],
4967
),
50-
secondaryActions: <Widget>[
51-
IconSlideAction(
52-
caption: GSYLocalizations.i18n(context)!.notify_readed,
53-
color: Colors.redAccent,
54-
icon: Icons.delete,
55-
onTap: () {
56-
UserDao.setNotificationAsReadDao(notification.id.toString())
57-
.then((res) {
58-
showRefreshLoading();
59-
});
60-
},
61-
),
62-
],
68+
child: _renderEventItem(notification),
6369
);
6470
}
6571

@@ -115,6 +121,12 @@ class _NotifyPageState extends State<NotifyPage>
115121
return await _getDataLogic();
116122
}
117123

124+
@override
125+
void initState() {
126+
super.initState();
127+
slidableController = SlidableController(this);
128+
}
129+
118130
@override
119131
Widget build(BuildContext context) {
120132
super.build(context); // See AutomaticKeepAliveClientMixin.

pubspec.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@ packages:
336336
dependency: "direct main"
337337
description:
338338
name: flutter_slidable
339-
sha256: c7607eb808cdef19c8468246e95a133308aeaeb3971cdd9edfb9d5e31cedfbe9
339+
sha256: "673403d2eeef1f9e8483bd6d8d92aae73b1d8bd71f382bc3930f699c731bc27c"
340340
url: "https://pub.flutter-io.cn"
341341
source: hosted
342-
version: "0.6.0"
342+
version: "3.1.0"
343343
flutter_spinkit:
344344
dependency: "direct main"
345345
description:
@@ -501,10 +501,10 @@ packages:
501501
dependency: transitive
502502
description:
503503
name: intl
504-
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
504+
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
505505
url: "https://pub.flutter-io.cn"
506506
source: hosted
507-
version: "0.18.1"
507+
version: "0.19.0"
508508
io:
509509
dependency: transitive
510510
description:
@@ -581,10 +581,10 @@ packages:
581581
dependency: "direct main"
582582
description:
583583
name: meta
584-
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
584+
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
585585
url: "https://pub.flutter-io.cn"
586586
source: hosted
587-
version: "1.11.0"
587+
version: "1.12.0"
588588
mime:
589589
dependency: transitive
590590
description:
@@ -1263,5 +1263,5 @@ packages:
12631263
source: hosted
12641264
version: "3.1.0"
12651265
sdks:
1266-
dart: ">=3.2.0-0 <4.0.0"
1266+
dart: ">=3.3.0-0 <4.0.0"
12671267
flutter: ">=3.13.0"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies:
3333
sqflite: 2.3.0
3434
pub_semver: 2.1.4
3535
flutter_svg: 2.0.7
36-
flutter_slidable: ^0.6.0-nullsafety.0
36+
flutter_slidable: 3.1.0
3737
dio: 5.3.1
3838
#fconsole: 2.2.1
3939
path_provider: 2.1.0

0 commit comments

Comments
 (0)