修改选择器样式

This commit is contained in:
czz
2025-06-06 09:18:06 +08:00
parent 682728eb1e
commit bc86cf7d78
94 changed files with 3929 additions and 2299 deletions

View File

@@ -0,0 +1,185 @@
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
class RoomPickerPage extends StatefulWidget {
@override
_RoomPickerPageState createState() => _RoomPickerPageState();
}
class _RoomPickerPageState extends State<RoomPickerPage> {
final List<String> rooms = ['主卧', '次卧', '儿童房', '客厅', '厨房', '书房', '阳台', '洗手间'];
int selectedIndex = 1;
BoxConstraints? bodysize;
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, cc) {
bodysize = cc;
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent, // 深蓝背景
appBar: AppBar(
backgroundColor: Colors.transparent,
iconTheme: const IconThemeData(color: Colors.white),
automaticallyImplyLeading: false,
titleSpacing: 0,
title: SizedBox(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'房间选择',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
),
centerTitle: false,
),
body: SafeArea(
child: Column(
children: [
// 顶部标题栏
// const Padding(
// padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 12),
// child: Row(
// children: [
// Icon(Icons.arrow_back_ios, color: Colors.white),
// Spacer(),
// Text(
// '房间选择',
// style: TextStyle(color: Colors.white, fontSize: 18),
// ),
// Spacer(flex: 2),
// ],
// ),
// ),
const Spacer(),
// 滚轮选择器
SizedBox(
height: 360.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 滚轮列表
ListWheelScrollView.useDelegate(
itemExtent: 120.rpx,
perspective: 0.003,
physics: const FixedExtentScrollPhysics(),
onSelectedItemChanged: (index) {
setState(() => selectedIndex = index);
},
childDelegate: ListWheelChildBuilderDelegate(
builder: (context, index) {
if (index >= rooms.length) return null;
final isSelected = index == selectedIndex;
return Center(
child: Text(
rooms[index],
style: TextStyle(
fontSize: isSelected ? 36.rpx : 30.rpx,
color: isSelected
? Colors.white
: const Color(0xFF929699),
),
),
);
},
childCount: rooms.length,
),
),
// 上边线
Positioned(
top: 120.rpx,
left: 60.rpx,
right: 60.rpx,
child: Container(
height: 1,
color: const Color(0xFF929699),
),
),
// 下边线
Positioned(
top: 240.rpx,
left: 60.rpx,
right: 60.rpx,
child: Container(
height: 1,
color: const Color(0xFF929699),
),
),
],
),
),
const Spacer(),
// 完成按钮
Padding(
padding: EdgeInsets.only(
left: 30.rpx,
right: 30.rpx,
bottom: 83.rpx,
),
child: SizedBox(
width: double.infinity,
height: 50,
child: CustomCard(
borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical,
onTap: () {
// Get.toNamed("/applyRepairPage");
},
colors: const [
Color(0xFFFCFCFC),
Color(0xFFF8FAF9),
Color(0XFFECF6F3),
Color(0XFFD9F0E9),
Color(0xFFCEECE3)
],
child: Container(
width: double.infinity,
height: 90.rpx,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
),
child: Text("完成",
style: TextStyle(
color: const Color(0xFF003058),
fontSize: 30.rpx,
)),
),
)),
),
],
),
),
)));
});
}
}