Files

77 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import './message_model.dart';
class MessageDetail extends StatelessWidget {
final EipMessage message;
const MessageDetail({required this.message, super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('訊息內容'),
backgroundColor: Colors.white,
foregroundColor: Colors.black,
elevation: 0.5,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 主旨區塊
Text(
message.subjectLine,
style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold, height: 1.4),
),
const SizedBox(height: 16),
// 寄件資訊區塊
Row(
children: [
CircleAvatar(
backgroundColor: Colors.blueGrey.shade100,
child: const Icon(Icons.person, color: Colors.blueGrey),
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
message.sender, //
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
Text(
message.formattedDate,
style: const TextStyle(fontSize: 14, color: Colors.grey),
),
],
),
],
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 20.0),
child: Divider(),
),
// 訊息內文區塊
Container(
width: double.infinity,
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(10),
),
child: Text(
message.msgContent.isNotEmpty ? message.msgContent : '無內容', //
style: const TextStyle(fontSize: 16, height: 1.6, color: Colors.black87),
),
),
],
),
),
);
}
}