@@ -8,6 +8,7 @@ import 'package:gsy_github_app_flutter/widget/GSYListState.dart';
88import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart' ;
99import 'package:gsy_github_app_flutter/widget/GSYSelectItemWidget.dart' ;
1010import 'package:gsy_github_app_flutter/widget/GSYTitleBar.dart' ;
11+ import 'package:flutter_slidable/flutter_slidable.dart' ;
1112import 'package:gsy_github_app_flutter/common/model/Notification.dart' as Model;
1213
1314/**
@@ -25,12 +26,38 @@ class NotifyPage extends StatefulWidget {
2526
2627// ignore: mixin_inherits_from_not_object
2728class _NotifyPageState extends GSYListState <NotifyPage > {
28- int selectIndex;
29+ final SlidableController slidableController = new SlidableController ();
30+
31+ int selectIndex = 0 ;
2932
3033 _NotifyPageState ();
3134
32- _renderEventItem (index) {
35+ _renderItem (index) {
3336 Model .Notification notification = pullLoadWidgetControl.dataList[index];
37+ if (selectIndex != 0 ) {
38+ return _renderEventItem (notification);
39+ }
40+ return new Slidable (
41+ controller: slidableController,
42+ delegate: new SlidableDrawerDelegate (),
43+ actionExtentRatio: 0.25 ,
44+ child: _renderEventItem (notification),
45+ secondaryActions: < Widget > [
46+ new IconSlideAction (
47+ caption: GSYStrings .notify_readed,
48+ color: Colors .redAccent,
49+ icon: Icons .delete,
50+ onTap: () {
51+ UserDao .setNotificationAsReadDao (notification.id.toString ()).then ((res) {
52+ showRefreshLoading ();
53+ });
54+ },
55+ ),
56+ ],
57+ );
58+ }
59+
60+ _renderEventItem (Model .Notification notification) {
3461 EventViewModel eventViewModel = EventViewModel .fromNotify (notification);
3562 return new EventItem (eventViewModel, onPressed: () {
3663 if (notification.unread) {
@@ -113,7 +140,7 @@ class _NotifyPageState extends GSYListState<NotifyPage> {
113140 ),
114141 body: GSYPullLoadWidget (
115142 pullLoadWidgetControl,
116- (BuildContext context, int index) => _renderEventItem (index),
143+ (BuildContext context, int index) => _renderItem (index),
117144 handleRefresh,
118145 onLoadMore,
119146 refreshKey: refreshIndicatorKey,
0 commit comments