设备 预约接口
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
|
||||
class RoomPickerPage extends StatefulWidget {
|
||||
@@ -11,7 +13,28 @@ class RoomPickerPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RoomPickerPageState extends State<RoomPickerPage> {
|
||||
final List<String> rooms = ['主卧', '次卧', '儿童房', '客厅', '厨房', '书房', '阳台', '洗手间'];
|
||||
RxList rooms = [].obs;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
getRoomList();
|
||||
}
|
||||
|
||||
getRoomList() async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.room_list;
|
||||
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
||||
requestWithLog(
|
||||
logTitle: '查询房间列表',
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
rooms.assignAll(res.data);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
int selectedIndex = 1;
|
||||
BoxConstraints? bodysize;
|
||||
@@ -63,21 +86,6 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
|
||||
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(
|
||||
@@ -86,30 +94,33 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
|
||||
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),
|
||||
),
|
||||
),
|
||||
);
|
||||
Obx(
|
||||
() => ListWheelScrollView.useDelegate(
|
||||
itemExtent: 120.rpx,
|
||||
perspective: 0.003,
|
||||
physics: const FixedExtentScrollPhysics(),
|
||||
onSelectedItemChanged: (index) {
|
||||
setState(() => selectedIndex = index);
|
||||
},
|
||||
childCount: rooms.length,
|
||||
childDelegate: ListWheelChildBuilderDelegate(
|
||||
builder: (context, index) {
|
||||
if (index >= rooms.length) return null;
|
||||
final isSelected = index == selectedIndex;
|
||||
return Center(
|
||||
child: Text(
|
||||
rooms[index]['name'],
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
isSelected ? 36.rpx : 30.rpx,
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: const Color(0xFF929699),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
childCount: rooms.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user