今日预约搜索

This commit is contained in:
2025-12-03 16:00:18 +08:00
parent ba3467810c
commit 88b16ca69e
2 changed files with 76 additions and 5 deletions

View File

@@ -161,6 +161,7 @@ class SitePage extends GetView<SiteController> {
],
),
),
_buildSearchView(),
controller.hasReservationData
? _buildReservationListView()
: _buildEmptyReservationView(),
@@ -190,6 +191,66 @@ class SitePage extends GetView<SiteController> {
);
}
//搜索输入框,提示可以输入车牌或者手机
Widget _buildSearchView() {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Row(
children: [
Expanded(
child: SizedBox(
height: 44,
child: TextField(
controller: controller.searchController, // 绑定控制器
decoration: InputDecoration(
hintText: '输入车牌号或完整手机号查询',
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: BorderSide(color: Colors.grey.shade300),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: BorderSide(color: Get.theme.primaryColor, width: 1.5),
),
// 清除按钮
suffixIcon: IconButton(
icon: const Icon(Icons.clear, size: 20),
onPressed: () {
controller.searchController.clear();
controller.fetchReservationData(); // 清除后也刷新一次
},
),
),
onSubmitted: (value) {
// 用户在键盘上点击“完成”或“搜索”时触发
controller.fetchReservationData();
},
),
),
),
const SizedBox(width: 10),
ElevatedButton(
onPressed: () {
// 点击“搜索”按钮时触发
FocusScope.of(Get.context!).unfocus(); // 收起键盘
controller.fetchReservationData();
},
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
padding: const EdgeInsets.all(8),
),
child: const Icon(Icons.search_rounded),
),
],
),
);
}
/// 构建单个统计项
Widget _buildStatItem(String value, String label, {Color valueColor = Colors.blue}) {
return Expanded(