消息样式修改

This commit is contained in:
2026-02-09 17:57:00 +08:00
parent 9cd87b0535
commit 26c5f9d67a
3 changed files with 152 additions and 91 deletions

View File

@@ -36,7 +36,7 @@ class ReservationPage extends GetView<ReservationController> {
_buildSystemTips(), _buildSystemTips(),
SizedBox(height: 24), SizedBox(height: 24),
_buildLogoutButton(), _buildLogoutButton(),
SizedBox(height: 75.h), SizedBox(height: 95.h),
], ],
), ),
), ),

View File

@@ -80,10 +80,10 @@ class MallPage extends GetView<MallController> {
], ],
), ),
), ),
IconButton( /*IconButton(
onPressed: () {}, onPressed: () {},
icon: const Icon(Icons.notifications_none, color: Color(0xFF333333)), icon: const Icon(Icons.notifications_none, color: Color(0xFF333333)),
), ),*/
], ],
), ),
); );

View File

@@ -12,40 +12,63 @@ class MessagePage extends GetView<MessageController> {
Get.put(MessageController()); Get.put(MessageController());
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFFF5F5F5), backgroundColor: const Color(0xFFF7F9FB),
appBar: AppBar(title: const Text('消息通知'), centerTitle: true), appBar: AppBar(
body: Column( title: const Text('消息通知'),
centerTitle: true,
backgroundColor: Colors.white,
foregroundColor: Colors.black,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, size: 20),
onPressed: () => Get.back(),
),
),
body: Stack(
children: [ children: [
Expanded( Obx(() => SmartRefresher(
child: Obx(() => SmartRefresher( controller: controller.refreshController,
controller: controller.refreshController, enablePullUp: true,
enablePullUp: true, onRefresh: controller.onRefresh,
onRefresh: controller.onRefresh, onLoading: controller.onLoading,
onLoading: controller.onLoading, child: ListView.builder(
child: ListView.separated( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
padding: const EdgeInsets.all(12), itemCount: controller.messageList.length,
itemCount: controller.messageList.length, itemBuilder: (context, index) {
separatorBuilder: (_, __) => const SizedBox(height: 12), return _buildMessageItem(context, controller.messageList[index]);
itemBuilder: (context, index) { },
return _buildMessageItem(context, controller.messageList[index]); ),
}, )),
),
)),
),
Obx(() => !controller.allRead.value Obx(() => !controller.allRead.value
? Container( ? Positioned(
padding: const EdgeInsets.all(16), right: 20,
color: Colors.white, bottom: 50,
child: ElevatedButton( child: GestureDetector(
onPressed: controller.markAllRead, onTap: controller.markAllRead,
style: ElevatedButton.styleFrom( child: Container(
backgroundColor: Colors.blue, padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
minimumSize: const Size(double.infinity, 44), decoration: BoxDecoration(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), color: const Color(0xFF007A45),
), borderRadius: BorderRadius.circular(30),
child: const Text('全部标为已读', style: TextStyle(fontSize: 16, color: Colors.white)), boxShadow: [
), BoxShadow(
) color: Colors.black.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: const Text(
'全部已读',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
),
)
: const SizedBox.shrink()), : const SizedBox.shrink()),
], ],
), ),
@@ -53,54 +76,92 @@ class MessagePage extends GetView<MessageController> {
} }
Widget _buildMessageItem(BuildContext context, MessageModel item) { Widget _buildMessageItem(BuildContext context, MessageModel item) {
return GestureDetector( return IntrinsicHeight(
onTap: () { child: Row(
controller.markRead(item); crossAxisAlignment: CrossAxisAlignment.stretch,
_showMessageDialog(context, item); children: [
}, // 左侧时间轴线条和圆点
child: Container( SizedBox(
padding: const EdgeInsets.all(16), width: 40,
decoration: BoxDecoration( child: Stack(
color: Colors.white, alignment: Alignment.topCenter,
borderRadius: BorderRadius.circular(8), children: [
), Container(
child: Row( width: 1.5,
crossAxisAlignment: CrossAxisAlignment.start, color: const Color(0xFFD8E2EE),
children: [ ),
Container( Positioned(
margin: const EdgeInsets.only(top: 6, right: 12), top: 25,
width: 8, child: Container(
height: 8, width: 12,
decoration: BoxDecoration( height: 12,
color: item.isRead == 1 ? Colors.grey[300] : const Color(0xFFFAAD14), decoration: BoxDecoration(
shape: BoxShape.circle, color: item.isRead == 1
? const Color(0xFFAAB6C3)
: const Color(0xFF4CAF50),
shape: BoxShape.circle,
border: Border.all(color: Colors.white, width: 2),
),
),
),
],
),
),
// 右侧内容卡片
Expanded(
child: GestureDetector(
onTap: () {
controller.markRead(item);
_showMessageDialog(context, item);
},
child: Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.02),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF333333),
),
),
const SizedBox(height: 10),
Text(
item.content,
style: const TextStyle(
fontSize: 14,
color: Color(0xFF666666),
height: 1.4,
),
),
const SizedBox(height: 12),
Text(
item.createTime,
style: const TextStyle(
fontSize: 12,
color: Color(0xFFCCCCCC),
),
),
],
),
), ),
), ),
Expanded( ),
child: Column( ],
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black87),
),
const SizedBox(height: 8),
Text(
item.content,
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 8),
Text(
item.createTime,
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
),
],
),
),
],
),
), ),
); );
} }
@@ -111,7 +172,7 @@ class MessagePage extends GetView<MessageController> {
barrierDismissible: true, barrierDismissible: true,
builder: (context) { builder: (context) {
return Dialog( return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: Container( child: Container(
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
child: Column( child: Column(
@@ -122,22 +183,22 @@ class MessagePage extends GetView<MessageController> {
item.title, item.title,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 12), const SizedBox(height: 16),
Text( Text(
item.content, item.content,
style: const TextStyle(fontSize: 15, height: 1.5, color: Colors.black87), style: const TextStyle(
fontSize: 15, height: 1.5, color: Color(0xFF333333)),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: OutlinedButton( child: TextButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
style: OutlinedButton.styleFrom( style: TextButton.styleFrom(
side: const BorderSide(color: Colors.blue), foregroundColor: const Color(0xFF007A45),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
), ),
child: const Text('确认', style: TextStyle(color: Colors.blue)), child: const Text('确认',
style: TextStyle(fontWeight: FontWeight.bold)),
), ),
), ),
], ],
@@ -147,4 +208,4 @@ class MessagePage extends GetView<MessageController> {
}, },
); );
} }
} }