搜索框
This commit is contained in:
@@ -18,7 +18,7 @@ class SitePage extends GetView<SiteController> {
|
||||
id: 'site',
|
||||
builder: (_) {
|
||||
return Scaffold(
|
||||
backgroundColor: Color(0xFFF5F7F9),
|
||||
backgroundColor: Color.fromRGBO(247, 249, 251, 1),
|
||||
body: SingleChildScrollView(child: _buildView(context)),
|
||||
);
|
||||
},
|
||||
@@ -60,7 +60,7 @@ class SitePage extends GetView<SiteController> {
|
||||
'历史记录',
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color.fromRGBO(156, 163, 175, 1),
|
||||
),
|
||||
),
|
||||
@@ -267,37 +267,79 @@ class SitePage extends GetView<SiteController> {
|
||||
//搜索输入框,提示可以输入车牌或者手机
|
||||
Widget _buildSearchView() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||
padding: EdgeInsets.fromLTRB(0, 0, 0, 8.h),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 44,
|
||||
height: 42.h,
|
||||
child: TextField(
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
controller: controller.searchController, // 绑定控制器
|
||||
decoration: InputDecoration(
|
||||
hintText: '输入车牌号或完整手机号查询',
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
filled: true,
|
||||
isDense: true,
|
||||
fillColor: Colors.white,
|
||||
hintText: '输入车牌号或手机号搜索...',
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
horizontal: 16,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: Color.fromRGBO(229, 231, 235, 1)),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
borderSide: BorderSide(color: Colors.grey.shade300),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: Color.fromRGBO(229, 231, 235, 1)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
borderSide: BorderSide(color: Get.theme.primaryColor, width: 1.5),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(
|
||||
color: Color.fromRGBO(229, 231, 235, 1),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
// 清除按钮
|
||||
suffixIcon: IconButton(
|
||||
suffix: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.clear, size: 20),
|
||||
onPressed: () {
|
||||
controller.searchController.clear();
|
||||
controller.fetchReservationData(); // 清除后也刷新一次
|
||||
},
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// 点击“搜索”按钮时触发
|
||||
FocusScope.of(Get.context!).unfocus(); // 收起键盘
|
||||
controller.fetchReservationData();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 16.w,
|
||||
right: 16.h,
|
||||
top: 4.5.h,
|
||||
bottom: 4.5.h,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(1, 113, 55, 1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
"搜索",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onSubmitted: (value) {
|
||||
// 用户在键盘上点击“完成”或“搜索”时触发
|
||||
@@ -306,40 +348,6 @@ class SitePage extends GetView<SiteController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
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(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: valueColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(label, style: const TextStyle(fontSize: 14, color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user