feat:消息页面添加全部清除功能

This commit is contained in:
anfe 2024-05-30 15:02:15 +08:00
parent 23ccd71b06
commit 26792c6c7f
4 changed files with 25 additions and 29 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -608,7 +608,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -24,7 +24,8 @@ class MessageListXHJPage extends StatefulWidget {
State<MessageListXHJPage> createState() => _MessageListXHJPageState();
}
class _MessageListXHJPageState extends State<MessageListXHJPage> with TickerProviderStateMixin {
class _MessageListXHJPageState extends State<MessageListXHJPage>
with TickerProviderStateMixin {
final MessageListLogic logic = Get.put(MessageListLogic());
final MessageListState state = Get.find<MessageListLogic>().state;
@ -45,31 +46,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage> with TickerProv
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: widget.showAppBar
? TitleAppBar(
barTitle: TranslationLoader.lanKeys!.message!.tr,
haveBack: true,
actionsList: <Widget>[
TextButton(
child: Text(
'清空'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog('是否清空?'.tr,
() async {
logic.deletAllMessageDataRequest();
});
} else {
logic.showToast('演示模式'.tr);
}
},
),
],
backgroundColor: AppColors.mainColor)
: null,
appBar: null,
body: Column(
children: <Widget>[
SizedBox(
@ -135,7 +112,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage> with TickerProv
final MessageItemEntity messageItemEntity =
state.itemDataList[index];
return Slidable(
key: ValueKey(messageItemEntity.id),
key: ValueKey<String?>(messageItemEntity.id),
endActionPane: ActionPane(
extentRatio: 0.2,
motion: const ScrollMotion(),
@ -169,6 +146,25 @@ class _MessageListXHJPageState extends State<MessageListXHJPage> with TickerProv
),
],
),
floatingActionButton: FloatingActionButton(
backgroundColor: AppColors.mainColor,
child: Icon(
Icons.delete_sweep,
color: AppColors.blackColor,
),
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog('是否清空?'.tr, () async {
logic.deletAllMessageDataRequest();
});
} else {
logic.showToast('演示模式'.tr);
}
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(100.r))),
),
);
}