feat:修改鑫泓佳消息页面
This commit is contained in:
parent
5c1072e615
commit
4a18988613
BIN
star_lock/images/news_not_read.png
Normal file
BIN
star_lock/images/news_not_read.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
star_lock/images/news_read.png
Normal file
BIN
star_lock/images/news_read.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@ -316,7 +316,7 @@ SPEC CHECKSUMS:
|
|||||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||||
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
||||||
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
|
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
|
||||||
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
|
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||||
fluwx: daa284756ce53442b3d0417ceeda66e981906811
|
fluwx: daa284756ce53442b3d0417ceeda66e981906811
|
||||||
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
|
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
|
||||||
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
|
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
|
||||||
|
|||||||
@ -109,8 +109,8 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return 'https://lock.skychip.top';
|
return 'https://lock.skychip.top';
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return 'https://lock.xhjcn.ltd';
|
// return 'https://lock.xhjcn.ltd';
|
||||||
// return 'https://pre.lock.star-lock.cn';
|
return 'https://pre.lock.star-lock.cn';
|
||||||
default:
|
default:
|
||||||
throw Exception('flavor[$name] apiPrefix not found');
|
throw Exception('flavor[$name] apiPrefix not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
|
|||||||
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
|
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
|
||||||
import 'package:star_lock/mine/mall/lockMall_page.dart';
|
import 'package:star_lock/mine/mall/lockMall_page.dart';
|
||||||
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
|
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
|
||||||
|
import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
@ -64,7 +65,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
|||||||
pageView(
|
pageView(
|
||||||
widget: SafeArea(
|
widget: SafeArea(
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: MessageListPage(
|
child: MessageListXHJPage(
|
||||||
showAppBar: false,
|
showAppBar: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
235
star_lock/lib/mine/message/messageList/messageList_xhj_page.dart
Normal file
235
star_lock/lib/mine/message/messageList/messageList_xhj_page.dart
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
|
import '../../../appRouters.dart';
|
||||||
|
import '../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../tools/dateTool.dart';
|
||||||
|
import '../../../tools/showTipView.dart';
|
||||||
|
import '../../../tools/storage.dart';
|
||||||
|
import '../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../translations/trans_lib.dart';
|
||||||
|
import 'messageList_entity.dart';
|
||||||
|
import 'messageList_logic.dart';
|
||||||
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
|
|
||||||
|
class MessageListXHJPage extends StatefulWidget {
|
||||||
|
MessageListXHJPage({Key? key, this.showAppBar = true}) : super(key: key);
|
||||||
|
bool showAppBar;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MessageListXHJPage> createState() => _MessageListXHJPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MessageListXHJPageState extends State<MessageListXHJPage>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
|
final logic = Get.put(MessageListLogic());
|
||||||
|
final state = Get.find<MessageListLogic>().state;
|
||||||
|
|
||||||
|
void getHttpData() {
|
||||||
|
logic.messageListDataRequest().then((MessageListEntity value) {
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
getHttpData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: widget.showAppBar
|
||||||
|
? TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.message!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
actionsList: [
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
"清空".tr,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
|
if (isDemoMode == false) {
|
||||||
|
ShowTipView().showIosTipWithContentDialog("是否清空?".tr,
|
||||||
|
() async {
|
||||||
|
logic.deletAllMessageDataRequest();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
logic.showToast("演示模式".tr);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
backgroundColor: AppColors.mainColor)
|
||||||
|
: null,
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 1.sw,
|
||||||
|
height: 0.2.sw,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 15.w),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 25.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: const DecorationImage(
|
||||||
|
image: AssetImage('images/xhj_main_bg.jpg'),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(20.r),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.15),
|
||||||
|
offset: const Offset(0, 0),
|
||||||
|
blurRadius: 10.r,
|
||||||
|
spreadRadius: 0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'智能分析',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.blackColor,
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'精准识别设备事件,过滤无效信息',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.blackColor.withOpacity(0.6),
|
||||||
|
fontSize: 20.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: EasyRefreshTool(onRefresh: () {
|
||||||
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
|
}, onLoad: () {
|
||||||
|
getHttpData();
|
||||||
|
}, child: Obx(() {
|
||||||
|
return state.itemDataList.isEmpty
|
||||||
|
? NoData()
|
||||||
|
: SlidableAutoCloseBehavior(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: state.itemDataList.length,
|
||||||
|
padding: EdgeInsets.only(top: 20.h),
|
||||||
|
itemBuilder: (c, index) {
|
||||||
|
MessageItemEntity messageItemEntity =
|
||||||
|
state.itemDataList[index];
|
||||||
|
return Slidable(
|
||||||
|
key: ValueKey(messageItemEntity.id),
|
||||||
|
endActionPane: ActionPane(
|
||||||
|
extentRatio: 0.2,
|
||||||
|
motion: const ScrollMotion(),
|
||||||
|
children: [
|
||||||
|
SlidableAction(
|
||||||
|
onPressed: (BuildContext context) {
|
||||||
|
logic.deletMessageDataRequest(
|
||||||
|
messageItemEntity.id!, () {
|
||||||
|
logic.pageNo = 1;
|
||||||
|
getHttpData();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
label: '删除'.tr,
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _messageListItem(messageItemEntity, () {
|
||||||
|
Get.toNamed(Routers.messageDetailPage,
|
||||||
|
arguments: {
|
||||||
|
"messageItemEntity": messageItemEntity
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _messageListItem(
|
||||||
|
MessageItemEntity messageItemEntity, Function() action) {
|
||||||
|
bool isNotRead = messageItemEntity.readAt! == 0;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: action,
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 12.h, horizontal: 15.w),
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20.w),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.15),
|
||||||
|
offset: const Offset(0, 0),
|
||||||
|
blurRadius: 10.r,
|
||||||
|
spreadRadius: 0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
isNotRead ? 'images/news_not_read.png' : 'images/news_read.png',
|
||||||
|
width: 48.r,
|
||||||
|
height: 48.r),
|
||||||
|
SizedBox(width: 15.w),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
messageItemEntity.data!,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp,
|
||||||
|
color: messageItemEntity.readAt! == 0
|
||||||
|
? AppColors.blackColor
|
||||||
|
: AppColors.placeholderTextColor),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 5.h,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
DateTool().dateToYMDHNString(
|
||||||
|
messageItemEntity.createdAt!.toString()),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: messageItemEntity.readAt! == 0
|
||||||
|
? AppColors.blackColor
|
||||||
|
: AppColors.placeholderTextColor)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
|
|
||||||
class TitleAppBar extends AppBar {
|
class TitleAppBar extends AppBar {
|
||||||
@override
|
@override
|
||||||
@ -38,6 +40,8 @@ class TitleAppBar extends AppBar {
|
|||||||
class _TitleAppBarState extends State<TitleAppBar> {
|
class _TitleAppBarState extends State<TitleAppBar> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Color defaultColor = F.sw(
|
||||||
|
defaultCall: () => Colors.white, xhjCall: () => AppColors.blackColor);
|
||||||
return AppBar(
|
return AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
leading: widget.haveOtherLeftWidget!
|
leading: widget.haveOtherLeftWidget!
|
||||||
@ -45,7 +49,7 @@ class _TitleAppBarState extends State<TitleAppBar> {
|
|||||||
: (widget.haveBack ?? false
|
: (widget.haveBack ?? false
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: Icon(Icons.arrow_back_ios,
|
icon: Icon(Icons.arrow_back_ios,
|
||||||
color: widget.iconColor ?? Colors.white),
|
color: widget.iconColor ?? defaultColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (widget.backAction != null) {
|
if (widget.backAction != null) {
|
||||||
widget.backAction!();
|
widget.backAction!();
|
||||||
@ -57,12 +61,14 @@ class _TitleAppBarState extends State<TitleAppBar> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
: Container()),
|
: Container()),
|
||||||
backgroundColor: widget.backgroundColor ?? Colors.white,
|
backgroundColor: F.sw(
|
||||||
|
defaultCall: () => widget.backgroundColor ?? defaultColor,
|
||||||
|
xhjCall: () => Colors.white),
|
||||||
title: widget.haveTitleWidget!
|
title: widget.haveTitleWidget!
|
||||||
? widget.titleWidget
|
? widget.titleWidget
|
||||||
: Text(widget.barTitle ?? '',
|
: Text(widget.barTitle ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.titleColor ?? Colors.white,
|
color: widget.titleColor ?? defaultColor,
|
||||||
fontSize: 28.sp,
|
fontSize: 28.sp,
|
||||||
fontWeight: FontWeight.w600)),
|
fontWeight: FontWeight.w600)),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user