Skip to content

Commit

Permalink
fix #882
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed May 22, 2024
1 parent b71b055 commit 9ff3455
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
54 changes: 33 additions & 21 deletions lib/page/notify_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ class NotifyPage extends StatefulWidget {
}

class _NotifyPageState extends State<NotifyPage>
with AutomaticKeepAliveClientMixin<NotifyPage>, GSYListState<NotifyPage> {
final SlidableController slidableController = SlidableController();
with
AutomaticKeepAliveClientMixin<NotifyPage>,
GSYListState<NotifyPage>,
SingleTickerProviderStateMixin {
late SlidableController slidableController;

int selectIndex = 0;

Expand All @@ -40,26 +43,29 @@ class _NotifyPageState extends State<NotifyPage>
return Slidable(
key: ValueKey<String>("${index}_$selectIndex"),
controller: slidableController,
actionPane: const SlidableBehindActionPane(),
actionExtentRatio: 0.25,
child: _renderEventItem(notification),
dismissal: SlidableDismissal(
child: const SlidableDrawerDismissal(),
onDismissed: (actionType) {},
endActionPane: ActionPane(
motion: const ScrollMotion(),
dismissible: DismissiblePane(onDismissed: () {
UserDao.setNotificationAsReadDao(notification.id.toString())
.then((res) {
showRefreshLoading();
});
}),
children: [
SlidableAction(
label: GSYLocalizations.i18n(context)!.notify_readed,
backgroundColor: Colors.redAccent,
icon: Icons.delete,
onPressed: (c) {
UserDao.setNotificationAsReadDao(notification.id.toString())
.then((res) {
showRefreshLoading();
});
},
),
],
),
secondaryActions: <Widget>[
IconSlideAction(
caption: GSYLocalizations.i18n(context)!.notify_readed,
color: Colors.redAccent,
icon: Icons.delete,
onTap: () {
UserDao.setNotificationAsReadDao(notification.id.toString())
.then((res) {
showRefreshLoading();
});
},
),
],
child: _renderEventItem(notification),
);
}

Expand Down Expand Up @@ -115,6 +121,12 @@ class _NotifyPageState extends State<NotifyPage>
return await _getDataLogic();
}

@override
void initState() {
super.initState();
slidableController = SlidableController(this);
}

@override
Widget build(BuildContext context) {
super.build(context); // See AutomaticKeepAliveClientMixin.
Expand Down
14 changes: 7 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ packages:
dependency: "direct main"
description:
name: flutter_slidable
sha256: c7607eb808cdef19c8468246e95a133308aeaeb3971cdd9edfb9d5e31cedfbe9
sha256: "673403d2eeef1f9e8483bd6d8d92aae73b1d8bd71f382bc3930f699c731bc27c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
version: "3.1.0"
flutter_spinkit:
dependency: "direct main"
description:
Expand Down Expand Up @@ -501,10 +501,10 @@ packages:
dependency: transitive
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.18.1"
version: "0.19.0"
io:
dependency: transitive
description:
Expand Down Expand Up @@ -581,10 +581,10 @@ packages:
dependency: "direct main"
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.11.0"
version: "1.12.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1263,5 +1263,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=3.2.0-0 <4.0.0"
dart: ">=3.3.0-0 <4.0.0"
flutter: ">=3.13.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
sqflite: 2.3.0
pub_semver: 2.1.4
flutter_svg: 2.0.7
flutter_slidable: ^0.6.0-nullsafety.0
flutter_slidable: 3.1.0
dio: 5.3.1
#fconsole: 2.2.1
path_provider: 2.1.0
Expand Down

0 comments on commit 9ff3455

Please sign in to comment.