@@ -24,8 +24,11 @@ class NotifyPage extends StatefulWidget {
2424}
2525
2626class _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.
0 commit comments