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 */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1430; LastUpgradeCheck = 1510;
ORGANIZATIONNAME = ""; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {

View File

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

View File

@ -24,7 +24,8 @@ class MessageListXHJPage extends StatefulWidget {
State<MessageListXHJPage> createState() => _MessageListXHJPageState(); 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 MessageListLogic logic = Get.put(MessageListLogic());
final MessageListState state = Get.find<MessageListLogic>().state; final MessageListState state = Get.find<MessageListLogic>().state;
@ -45,31 +46,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage> with TickerProv
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: widget.showAppBar appBar: null,
? 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,
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
@ -135,7 +112,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage> with TickerProv
final MessageItemEntity messageItemEntity = final MessageItemEntity messageItemEntity =
state.itemDataList[index]; state.itemDataList[index];
return Slidable( return Slidable(
key: ValueKey(messageItemEntity.id), key: ValueKey<String?>(messageItemEntity.id),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), 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))),
),
); );
} }