116 lines
3.5 KiB
Dart
116 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
class VisitorPage extends StatelessWidget {
|
||
final ScrollController scrollController;
|
||
|
||
const VisitorPage({super.key, required this.scrollController});
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Column(
|
||
children: [
|
||
Container(
|
||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||
decoration: const BoxDecoration(
|
||
color: Color(0xFF9EAF9F),
|
||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||
),
|
||
child: Row(
|
||
children: [
|
||
IconButton(
|
||
icon: const Icon(Icons.close, color: Colors.white),
|
||
onPressed: () => Navigator.pop(context),
|
||
),
|
||
const SizedBox(width: 8),
|
||
const Text(
|
||
'訪客來訪紀錄',
|
||
style: TextStyle(
|
||
fontWeight: FontWeight.bold,
|
||
fontSize: 20,
|
||
color: Colors.white,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
Expanded(
|
||
child: Container(
|
||
color: const Color(0xFFF7F8FA),
|
||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||
child: ListView(
|
||
controller: scrollController,
|
||
children: [
|
||
const Text(
|
||
'📝 訪客紀錄',
|
||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||
),
|
||
const SizedBox(height: 12),
|
||
_buildVisitorItem('2025/04/22 14:35', '王小明', '身分:朋友|目的:拜訪林小安'),
|
||
_buildVisitorItem('2025/04/21 10:20', '陳美麗', '身分:水電師傅|目的:維修浴室'),
|
||
_buildVisitorItem(
|
||
'2025/04/20 17:45',
|
||
'李建國',
|
||
'身分:外送員|目的:送晚餐(Uber Eats)',
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
Widget _buildVisitorItem(String date, String name, String detail) {
|
||
return Container(
|
||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||
decoration: const BoxDecoration(
|
||
border: Border(bottom: BorderSide(color: Color(0xFFEEEEEE))),
|
||
),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
children: [
|
||
Text(
|
||
date,
|
||
style: const TextStyle(fontSize: 14, color: Color(0xFF555555)),
|
||
),
|
||
Text(
|
||
name,
|
||
style: const TextStyle(fontSize: 14, color: Color(0xFF555555)),
|
||
),
|
||
],
|
||
),
|
||
const SizedBox(height: 4),
|
||
Text(
|
||
detail,
|
||
style: const TextStyle(fontSize: 13, color: Color(0xFF777777)),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|
||
|
||
// 👇 包裝元件一樣寫在這
|
||
class VisitorPageWrapper extends StatelessWidget {
|
||
const VisitorPageWrapper({super.key});
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return DraggableScrollableSheet(
|
||
initialChildSize: 0.95,
|
||
minChildSize: 0.5,
|
||
maxChildSize: 1.0,
|
||
expand: false,
|
||
builder: (_, scrollController) {
|
||
return Container(
|
||
decoration: const BoxDecoration(color: Colors.transparent),
|
||
child: VisitorPage(scrollController: scrollController),
|
||
);
|
||
},
|
||
);
|
||
}
|
||
}
|