设备 预约接口
This commit is contained in:
@@ -16,36 +16,32 @@ class MattressControlPage extends StatefulWidget {
|
||||
class _MattressControlPageState extends State<MattressControlPage> {
|
||||
final controller = Get.put(ControlCardController());
|
||||
|
||||
final data ={
|
||||
"_id": "6840ee86693db58798000000",
|
||||
"uid": "68465947a0cff49592000000",
|
||||
"bind_type": 1,
|
||||
"device_type": 1,
|
||||
"mac": "B43A45C3E9A8",
|
||||
"bind_mac": null,
|
||||
"position": 0,
|
||||
"share_uid": null,
|
||||
"person": {
|
||||
"name": "bb",
|
||||
"gender": 0,
|
||||
"birthday": "2025/05/27",
|
||||
"weight": "10",
|
||||
"height": "100",
|
||||
"disease": []
|
||||
},
|
||||
"show": true,
|
||||
"create_time": 1749085830536,
|
||||
"shareNum": 0,
|
||||
"status": {
|
||||
"signal": -1,
|
||||
"status": 0,
|
||||
"inBed": 0,
|
||||
"upgrade": 0,
|
||||
"failure": 0,
|
||||
"updateTime": 1749110182000
|
||||
},
|
||||
"code": "B43A45C3E9A8"
|
||||
};
|
||||
final data = {
|
||||
"_id": "684bf0845a81f423c0000000",
|
||||
"uid": "68465947a0cff49592000000",
|
||||
"bind_type": 1,
|
||||
"device_type": 3,
|
||||
"mac": "545024122617",
|
||||
"bind_mac": null,
|
||||
"bind_mac_a": "48CA43B2E8C8",
|
||||
"bind_mac_b": "48CA43B2E8B0",
|
||||
"position": 0,
|
||||
"share_uid": null,
|
||||
"person": null,
|
||||
"op_type": null,
|
||||
"show": true,
|
||||
"create_time": 1749807236514,
|
||||
"shareNum": 0,
|
||||
"status": {
|
||||
"signal": -1,
|
||||
"status": 0,
|
||||
"inBed": 0,
|
||||
"upgrade": 0,
|
||||
"failure": 0,
|
||||
"updateTime": -1
|
||||
},
|
||||
"code": "545024122617"
|
||||
};
|
||||
int selectedIndex = 1; // 当前选中的tab索引
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -150,9 +150,6 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.title_size,
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.bold,
|
||||
color: Colors
|
||||
.white // 加粗文字
|
||||
),
|
||||
@@ -200,9 +197,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
fontSize: 26
|
||||
.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
@@ -353,9 +349,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
fontSize: 26
|
||||
.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
@@ -524,9 +519,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
fontSize: 26
|
||||
.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
@@ -695,9 +689,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
fontSize: 26
|
||||
.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
@@ -1314,6 +1307,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
10, 5, 10, 5),
|
||||
),
|
||||
maxLines: 4,
|
||||
maxLength:
|
||||
100, // ✅ 限制最多输入 100 字符
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
@@ -1443,9 +1438,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.small_text_size,
|
||||
fontSize: 26
|
||||
.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
@@ -1486,6 +1480,9 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
.apply_name,
|
||||
obscureText:
|
||||
false,
|
||||
textAlignVertical:
|
||||
TextAlignVertical
|
||||
.center,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
contentPadding:
|
||||
@@ -1624,9 +1621,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.small_text_size,
|
||||
fontSize: 26
|
||||
.rpx,
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
@@ -1664,6 +1660,9 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
.tel,
|
||||
obscureText:
|
||||
false,
|
||||
textAlignVertical:
|
||||
TextAlignVertical
|
||||
.center,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
contentPadding:
|
||||
|
||||
@@ -96,7 +96,7 @@ class BluetoothPage extends GetView {
|
||||
),
|
||||
|
||||
const SizedBox(height: 4),
|
||||
Text('MAC:4645146546',
|
||||
Text(data['mac']?.toString() ?? '未命名',
|
||||
style: TextStyle(
|
||||
color: Colors.white70, fontSize: 26.rpx)),
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class BookInfoPage extends GetView<BookInfoController> {
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false, // 自
|
||||
// resizeToAvoidBottomInset: false, // 自
|
||||
// key: scaffoldKey,
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
@@ -323,6 +323,8 @@ class BookInfoPage extends GetView<BookInfoController> {
|
||||
onChanged: (d) {
|
||||
controller.model.userName = d;
|
||||
},
|
||||
enableInteractiveSelection:
|
||||
false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
labelStyle:
|
||||
@@ -393,9 +395,8 @@ class BookInfoPage extends GetView<BookInfoController> {
|
||||
8),
|
||||
),
|
||||
contentPadding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
0, 0, 0, 12),
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 0),
|
||||
),
|
||||
style:
|
||||
FlutterFlowTheme.of(context)
|
||||
@@ -417,6 +418,7 @@ class BookInfoPage extends GetView<BookInfoController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
getLine(),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
@@ -545,9 +547,8 @@ class BookInfoPage extends GetView<BookInfoController> {
|
||||
8),
|
||||
),
|
||||
contentPadding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
0, 0, 0, 12),
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 0),
|
||||
),
|
||||
style:
|
||||
FlutterFlowTheme.of(context)
|
||||
|
||||
@@ -33,57 +33,56 @@ class _DeviceListPageState extends State<DeviceListPage> {
|
||||
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
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtomAddCallback(() {
|
||||
// controller.saveDataApi();
|
||||
// updateParm(isShowToast: false);
|
||||
// }),
|
||||
// leading: returnIconButtomNew,
|
||||
title: Container(
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtomAddCallback(() {
|
||||
// controller.saveDataApi();
|
||||
// updateParm(isShowToast: false);
|
||||
// }),
|
||||
// leading: returnIconButtomNew,
|
||||
title: Container(
|
||||
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,
|
||||
),
|
||||
],
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: Image.asset(
|
||||
'assets/images/new_background.png',
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
height: bodysize!.maxHeight,
|
||||
child: Column(
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
@@ -126,9 +125,16 @@ class _DeviceListPageState extends State<DeviceListPage> {
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
// Container(
|
||||
// width: bodysize!.maxWidth,
|
||||
// height: bodysize!.maxHeight,
|
||||
|
||||
// ),
|
||||
),
|
||||
));
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,34 +8,13 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/people_info_controller.dart';
|
||||
|
||||
class DevicePeopleInfo extends GetView {
|
||||
class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
||||
Map data;
|
||||
DevicePeopleInfo({required this.data});
|
||||
|
||||
// get glController => Get.find<GlobalController>();
|
||||
// get bodyData => glController.model.mainDevicePeople;
|
||||
RxList<dynamic> peopleList = <dynamic>[].obs;
|
||||
Future<void> devicePeopleInfo() async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.person_info;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi?mac=${data["mac"]}";
|
||||
|
||||
requestWithLog(
|
||||
logTitle: "获取设备的人员信息列表",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
if (res.data != null && res.data is List) {
|
||||
peopleList.assignAll(res.data);
|
||||
print("peopleList: $peopleList");
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PeopleInfoController controller = Get.put(PeopleInfoController());
|
||||
getInfoRow(context, String str) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -56,11 +35,6 @@ class DevicePeopleInfo extends GetView {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (data["device_type"] == 1 && peopleList.isEmpty) {
|
||||
devicePeopleInfo();
|
||||
}
|
||||
});
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
@@ -170,9 +144,10 @@ class DevicePeopleInfo extends GetView {
|
||||
],
|
||||
),
|
||||
)),
|
||||
if (data["device_type"] == 1 && peopleList.isNotEmpty)
|
||||
...List.generate(peopleList.length, (index) {
|
||||
final person = peopleList[index];
|
||||
if (controller.model.peopleList.isNotEmpty)
|
||||
...List.generate(controller.model.peopleList.length,
|
||||
(index) {
|
||||
final person = controller.model.peopleList[index];
|
||||
String location_ = '';
|
||||
if ("${data["bindMacB"]}".length > 6 &&
|
||||
(person["direction"] == 1 ||
|
||||
@@ -206,9 +181,8 @@ class DevicePeopleInfo extends GetView {
|
||||
),
|
||||
),
|
||||
if (location_.isNotEmpty)
|
||||
getInfoRow(context, "校准位置:$location_"),
|
||||
getInfoRow(
|
||||
context, "姓名:${person["name"] ?? "-"}"),
|
||||
getInfoRow(context,
|
||||
"姓名:${person["name"] ?? "-"}"),
|
||||
getInfoRow(context,
|
||||
"性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"),
|
||||
getInfoRow(context,
|
||||
|
||||
@@ -147,7 +147,11 @@ class _ExperienceStorePageState extends State<ExperienceStorePage> {
|
||||
if (controller
|
||||
.model.experienceStoreModelList.length ==
|
||||
0) {
|
||||
return Empty();
|
||||
return CircularProgressIndicator(
|
||||
strokeWidth: 1,
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
|
||||
136
lib/pages/mh_page/help/article.dart
Normal file
136
lib/pages/mh_page/help/article.dart
Normal file
@@ -0,0 +1,136 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:vbvs_app/common/color/appColors.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class HelpArticle extends StatelessWidget {
|
||||
Map article;
|
||||
HelpArticle({super.key, required this.article});
|
||||
|
||||
// get articleController => Get.find<ArticleController>();
|
||||
get userInfoController => Get.find<UserInfoController>();
|
||||
|
||||
var isLike = 0.obs;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String top_imgOrVideo = "";
|
||||
if (article['imgOrVideo'] == 0) {
|
||||
top_imgOrVideo =
|
||||
'''<img class="video" src="${getStorageResourceUrl(article['coverUrl'])}" />''';
|
||||
} else {
|
||||
top_imgOrVideo =
|
||||
'''<video controls class="video" src="${getStorageResourceUrl(article['videoUrl'])}" ></video>''';
|
||||
}
|
||||
String newText = article['text'];
|
||||
|
||||
RegExp("<img\\s*src=\"([^\"]*)\"")
|
||||
.allMatches(newText)
|
||||
.toList()
|
||||
.map((d) => d.group(1))
|
||||
.toList()
|
||||
.forEach((d) {
|
||||
newText = newText.replaceAll("$d", getStorageResourceUrl("$d"));
|
||||
});
|
||||
|
||||
String html = '''
|
||||
<html>
|
||||
<meta name="viewport" charset="UTF-8"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
||||
|
||||
<head>
|
||||
<title>Test Page</title>
|
||||
</head>
|
||||
<style>
|
||||
|
||||
body {
|
||||
width: 98%;
|
||||
margin: 0 auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
height: 270px;
|
||||
background-color: #9EA4B7;
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div style="padding: 15px;width: calc(100% - 36px);">
|
||||
${top_imgOrVideo}
|
||||
<div style="height: 2px;width: 100%;background-color: #D6D6D6;margin: 15px 0 15px 0;"></div>
|
||||
<div style="line-height: 22px;font-size: 15px;">${article['title']}</div>
|
||||
<div style="display: flex;align-items: center;font-size: 13;margin-bottom: 24px;margin-top: 10px;">
|
||||
<div style="color: #182B7C;">${article['author']}</div>
|
||||
<div style="margin-left: 13px; color: #D3D3D3;">${time_08_Formatter(article['created_at'])}</div>
|
||||
</div>
|
||||
${newText}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
''';
|
||||
|
||||
print("$html");
|
||||
// articleController.readAdd(article['id']);
|
||||
String? uid = userInfoController.model.user?.uid;
|
||||
print("${userInfoController.model.user}");
|
||||
// uid = "sss";
|
||||
// if (uid != null) {
|
||||
// articleController.findIsLike(uid, article['id']).then((d) {
|
||||
// isLike.value = d;
|
||||
// });
|
||||
// }
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColors.bg_color,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
leading: returnIconButtom,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
// color: AppColors.bg_color,
|
||||
// image: DecorationImage(
|
||||
// image: AssetImage("assets/images/background.png$test"),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
// child: WebViewWidget(
|
||||
// controller: WebViewController()
|
||||
// ..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
// ..loadHtmlString(html),
|
||||
// ),
|
||||
child: InAppWebView(
|
||||
initialData:
|
||||
InAppWebViewInitialData(data: html, encoding: ""),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,9 @@ class IssueListPage extends GetView<IssueListController> {
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
BoxConstraints? bodysize;
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
IssueListController controller = Get.put(IssueListController());
|
||||
// ScrollController scrollController = ScrollController();
|
||||
// IssueListPage() {
|
||||
// controller.model.limit = AppConstants.limit;
|
||||
// controller.model.offset = 0;
|
||||
// controller.model.isLoading = false;
|
||||
// controller.model.hasMore = true;
|
||||
// controller.model.issueList!.clear();
|
||||
// controller.initData();
|
||||
|
||||
@@ -31,20 +27,10 @@ class IssueListPage extends GetView<IssueListController> {
|
||||
// });
|
||||
// }
|
||||
|
||||
// void initData() async {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(builder: (context, cc) {
|
||||
bodysize = cc;
|
||||
controller.model.issueList = [
|
||||
{'title': 'APP如何连接我的智能床?'},
|
||||
{'title': '智能床如何连接网络?'},
|
||||
{'title': '跟换WIFI名称或密码,或者刚换了路由器后,我的智能床无法使用怎么办?'},
|
||||
{'title': '在APP中,如何查看我的睡眠报告?'},
|
||||
{'title': '在APP中,如何查看我的睡眠报告?'},
|
||||
{'title': '在APP中,如何查看我的睡眠报告?'}
|
||||
];
|
||||
return GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
@@ -96,89 +82,120 @@ class IssueListPage extends GetView<IssueListController> {
|
||||
// color: Color(0xFFF6F6F6),
|
||||
),
|
||||
child: Obx(() {
|
||||
return Visibility(
|
||||
visible: controller.model.issueList != null &&
|
||||
controller.model.issueList!.isNotEmpty,
|
||||
replacement: Container(
|
||||
if (controller.model.isLoading) {
|
||||
return Center(child: CircularProgressIndicator()); // ✅ 加载中
|
||||
}
|
||||
|
||||
if (controller.model.issueList.isEmpty) {
|
||||
return Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).secondaryBackground,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(31, 27, 0, 0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'暂无内容!',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: AppFontsize.title_size,
|
||||
letterSpacing: 0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
// TitleComponentWidget(
|
||||
// titleName: '问题与帮助',
|
||||
// ),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(15, 13, 15, 15),
|
||||
child: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Obx(() => ListView(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
0,
|
||||
5,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.vertical,
|
||||
children: (controller.model.issueList!
|
||||
.asMap()
|
||||
.entries
|
||||
.map((e) => IssuePreviewWidget(
|
||||
index: e.key,
|
||||
issueListController: controller))
|
||||
.toList() as List<Widget>)
|
||||
// .divide(const SizedBox(
|
||||
// height: 30,
|
||||
// ))
|
||||
// .addToEnd(const SizedBox(
|
||||
// height: 26,
|
||||
// ))
|
||||
// .addToStart(SizedBox(
|
||||
// height: 16,
|
||||
// ))
|
||||
)),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'暂无内容!',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: AppFontsize.title_size,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 有数据时渲染列表
|
||||
return ListView(
|
||||
children: controller.model.issueList!
|
||||
.asMap()
|
||||
.entries
|
||||
.map((e) => IssuePreviewWidget(
|
||||
index: e.key,
|
||||
issueListController: controller,
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
}),
|
||||
|
||||
// Obx(() {
|
||||
// return Visibility(
|
||||
// visible: controller.model.issueList != null &&
|
||||
// controller.model.issueList.isNotEmpty,
|
||||
// replacement: Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
// height: 100,
|
||||
// decoration: BoxDecoration(
|
||||
// color: FlutterFlowTheme.of(context).secondaryBackground,
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(31, 27, 0, 0),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Align(
|
||||
// alignment: AlignmentDirectional(-1, 0),
|
||||
// child: Text(
|
||||
// '暂无内容!',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Color(0xFF9EA4B7),
|
||||
// fontSize: AppFontsize.title_size,
|
||||
// letterSpacing: 0,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// // TitleComponentWidget(
|
||||
// // titleName: '问题与帮助',
|
||||
// // ),
|
||||
// Flexible(
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// EdgeInsetsDirectional.fromSTEB(15, 13, 15, 15),
|
||||
// child: Container(
|
||||
// width: bodysize!.maxWidth,
|
||||
// decoration: BoxDecoration(
|
||||
// // color: Colors.white,
|
||||
// // borderRadius: BorderRadius.circular(16),
|
||||
// ),
|
||||
// child: Obx(() => ListView(
|
||||
// padding: const EdgeInsets.fromLTRB(
|
||||
// 0,
|
||||
// 5,
|
||||
// 0,
|
||||
// 0,
|
||||
// ),
|
||||
// shrinkWrap: true,
|
||||
// scrollDirection: Axis.vertical,
|
||||
// children: (controller.model.issueList!
|
||||
// .asMap()
|
||||
// .entries
|
||||
// .map((e) => IssuePreviewWidget(
|
||||
// index: e.key,
|
||||
// issueListController: controller))
|
||||
// .toList() as List<Widget>))),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
@@ -21,16 +21,17 @@ class IssuePreviewWidget extends GetView<IssuePreviewInfoController> {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
// issueListController.model.selectedIndex = index;
|
||||
// issueListController.updateAll();
|
||||
// await Future.delayed(Duration(milliseconds: 100));
|
||||
// issueListController.model.selectedIndex = -1;
|
||||
// issueListController.updateAll();
|
||||
// var article = issueListController.model.issueList![index];
|
||||
// Get.toNamed("/helpArticle", arguments: article);
|
||||
issueListController.model.selectedIndex = index;
|
||||
issueListController.updateAll();
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
issueListController.model.selectedIndex = -1;
|
||||
issueListController.updateAll();
|
||||
var article = issueListController.model.issueList![index];
|
||||
Get.toNamed("/helpArticle", arguments: article);
|
||||
},
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
|
||||
@@ -82,6 +82,8 @@ class _MinePageState extends State<NewMinePage> {
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
backgroundColor: Colors.transparent,
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
automaticallyImplyLeading: false,
|
||||
@@ -116,20 +118,6 @@ class _MinePageState extends State<NewMinePage> {
|
||||
color: Colors.white,
|
||||
// color: Colors.white,
|
||||
))),
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.transparent,
|
||||
// padding: EdgeInsets.only(right: 11.rpx),
|
||||
// onTap: () {
|
||||
|
||||
// },
|
||||
// child: Container(
|
||||
// height: 42.rpx,
|
||||
// width: 42.rpx,
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/img/icon/people_info.svg',
|
||||
// color: Colors.white,
|
||||
// ))),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
@@ -239,7 +227,7 @@ class _MinePageState extends State<NewMinePage> {
|
||||
margin: EdgeInsets.only(
|
||||
left: 30.rpx, right: 30.rpx, top: 94.rpx),
|
||||
child: Text(
|
||||
'对已绑定的智能设备进行个性化配置,以获得更好的体验,',
|
||||
'对已绑定的智能设备进行个性化配置,以获得更好的体验',
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: const Color(0XFF929699),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
@@ -69,7 +69,9 @@ class _SleepHabitPageState extends State<SleepHabitPage> {
|
||||
highlightColor: Color(0XFF055466),
|
||||
borderRadius: 16.rpx,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
Get.toNamed('/rxhxMht');
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: bodysize!.maxWidth * 1,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_switch/flutter_switch.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
@@ -130,7 +131,7 @@ class Smys extends GetView<SleepingHabitController> {
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: 30.rpx,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
@@ -152,35 +153,7 @@ class Smys extends GetView<SleepingHabitController> {
|
||||
getmodel.model.smysIsStart = val;
|
||||
});
|
||||
},
|
||||
)
|
||||
// Switch.adaptive(
|
||||
// value: controller.model.smysIsStart,
|
||||
// onChanged: (newValue) async {
|
||||
// controller.attr.update((getmodel) {
|
||||
// getmodel.model.smysIsStart =
|
||||
// newValue;
|
||||
// });
|
||||
// // updateParm(errorccCallback: () {
|
||||
// // controller.attr.update((getmodel) {
|
||||
// // getmodel.model.smysIsStart = !newValue;
|
||||
// // });
|
||||
// // });
|
||||
// },
|
||||
// activeTrackColor: Color(0xFF6BFDAC),
|
||||
// inactiveTrackColor: Color(0xFF003058),
|
||||
// inactiveThumbColor: Color(0xFF011D33),
|
||||
// trackOutlineWidth: MaterialStateProperty
|
||||
// .resolveWith<double?>(
|
||||
// (Set<MaterialState> states) {
|
||||
// if (states.contains(
|
||||
// MaterialState.disabled)) {
|
||||
// return null;
|
||||
// }
|
||||
// return null; // Use the default width.
|
||||
// }),
|
||||
// ),
|
||||
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
@@ -213,7 +186,7 @@ class Smys extends GetView<SleepingHabitController> {
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: 30.rpx,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
@@ -242,18 +215,20 @@ class Smys extends GetView<SleepingHabitController> {
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 36.rpx,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.rpx,
|
||||
),
|
||||
Icon(
|
||||
Icons.expand_more,
|
||||
color: Colors.white,
|
||||
size: 40.rpx,
|
||||
),
|
||||
Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand_more.svg',
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -289,7 +264,7 @@ class Smys extends GetView<SleepingHabitController> {
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFF9EA4B7),
|
||||
fontSize: 30.rpx,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
@@ -318,18 +293,20 @@ class Smys extends GetView<SleepingHabitController> {
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 36.rpx,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.rpx,
|
||||
),
|
||||
Icon(
|
||||
Icons.expand_more,
|
||||
color: Colors.white,
|
||||
size: 40.rpx,
|
||||
),
|
||||
Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand_more.svg',
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
682
lib/pages/mh_page/user/page/rxhx_mht.dart
Normal file
682
lib/pages/mh_page/user/page/rxhx_mht.dart
Normal file
@@ -0,0 +1,682 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_switch/flutter_switch.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';
|
||||
import 'package:vbvs_app/controller/mh_controller/bedController.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/sleeping_habit_controller.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
|
||||
class RxhxMht extends StatefulWidget {
|
||||
const RxhxMht({super.key});
|
||||
|
||||
@override
|
||||
State<RxhxMht> createState() => _RxhxMhtState();
|
||||
}
|
||||
|
||||
class _RxhxMhtState extends State<RxhxMht> {
|
||||
get controller => Get.find<SleepingHabitController>();
|
||||
get bedController => Get.find<BedController>();
|
||||
List location = ["床垫全局", "床垫左侧", "床垫右侧"];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer(Duration.zero, () {
|
||||
resetRxhx();
|
||||
currentTimeSend();
|
||||
});
|
||||
}
|
||||
|
||||
resetRxhx() {
|
||||
controller.model.rxhxIsStart = false;
|
||||
controller.model.rxhxWakeTime = [7, 0];
|
||||
controller.model.rxhxIsAnMo = true;
|
||||
controller.model.rxhxWeeks = [0, 0, 0, 0, 0, 0, 0];
|
||||
controller.model.rxhxLocation = 0;
|
||||
controller.updateAll();
|
||||
}
|
||||
|
||||
@override
|
||||
dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
alarmChange() async {
|
||||
// List<int> arr = [0x30, 0x01];
|
||||
// arr.add(controller.model.rxhxIsStart ? 0x01 : 0x00);
|
||||
// arr.add(int.parse("${controller.model.rxhxWakeTime[0]}", radix: 16));
|
||||
// arr.add(int.parse("${controller.model.rxhxWakeTime[1]}", radix: 16));
|
||||
// arr.add(0);
|
||||
// int value = int.parse("${controller.model.rxhxWeeks[0]}") * 2 +
|
||||
// int.parse("${controller.model.rxhxWeeks[1]}") * 4 +
|
||||
// int.parse("${controller.model.rxhxWeeks[2]}") * 8 +
|
||||
// int.parse("${controller.model.rxhxWeeks[3]}") * 16 +
|
||||
// int.parse("${controller.model.rxhxWeeks[4]}") * 32 +
|
||||
// int.parse("${controller.model.rxhxWeeks[5]}") * 64 +
|
||||
// int.parse("${controller.model.rxhxWeeks[6]}") * 128;
|
||||
// arr.add(value);
|
||||
// arr.add(value > 1 ? 1 : 0);
|
||||
// arr.add((controller.model.rxhxIsAnMo ? 1 : 0) +
|
||||
// int.parse("${controller.model.rxhxLocation * 16}"));
|
||||
// var sendArr = getCode(arr);
|
||||
// List receive = [];
|
||||
// Function fun = (d) {
|
||||
// receive.add(d);
|
||||
// };
|
||||
// bedController.deviceProp?.receiveLogArr.add(fun);
|
||||
// for (var i = 0; i < 3; i++) {
|
||||
// bedController.bleSendCode(sendArr);
|
||||
// await Future.delayed(const Duration(milliseconds: 500));
|
||||
// print("$receive");
|
||||
// if (receive.length > 0) {
|
||||
// for (var i = 0; i < receive.length; i++) {
|
||||
// List<int> r = receive[i];
|
||||
// if (handleTimeResult(r, 0x30)) {
|
||||
// bedController.deviceProp?.receiveLogArr.remove(fun);
|
||||
// showToast("保存成功", color: color_success);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// showToast("保存失败");
|
||||
// bedController.deviceProp?.receiveLogArr.remove(fun);
|
||||
}
|
||||
|
||||
handleTimeResult(List<int> r, int type) {
|
||||
if (r.length == 18 &&
|
||||
r[0] == 255 &&
|
||||
r[1] == 255 &&
|
||||
r[2] == 255 &&
|
||||
r[3] == 255 &&
|
||||
r[4] == 0 &&
|
||||
r[5] == 9 &&
|
||||
r[6] == type &&
|
||||
r[7] == 0x01) {
|
||||
if (r[8] == 0x01) {
|
||||
controller.model.rxhxIsStart = true;
|
||||
} else if (r[8] == 0x02 || r[8] == 0x00) {
|
||||
controller.model.rxhxIsStart = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
controller.model.rxhxWakeTime[0] = int.parse(r[9].toRadixString(16));
|
||||
controller.model.rxhxWakeTime[1] = int.parse(r[10].toRadixString(16));
|
||||
for (var i = 0; i < 7; i++) {
|
||||
int v = pow(2, i + 1).toInt();
|
||||
controller.model.rxhxWeeks[i] = (v & r[12]) == v ? 1 : 0;
|
||||
}
|
||||
controller.model.rxhxIsAnMo = (r[14] & 0x0f) == 1 ? true : false;
|
||||
controller.model.rxhxLocation = (r[14] & 0xf0) >> 4;
|
||||
controller.updateAll();
|
||||
return true;
|
||||
}
|
||||
if (r[0] == 255 &&
|
||||
r[1] == 255 &&
|
||||
r[2] == 255 &&
|
||||
r[3] == 255 &&
|
||||
r[4] == 0 &&
|
||||
r[5] == 3 &&
|
||||
r[6] == type &&
|
||||
r[7] == 0x01 &&
|
||||
r[8] == 0x00 &&
|
||||
r.length == 12) {
|
||||
resetRxhx();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
currentTimeSend() async {
|
||||
// DateTime date = DateTime.now();
|
||||
// List<int> arr = [0x20, 0x01];
|
||||
// arr.add(int.parse("${date.hour}", radix: 16));
|
||||
// arr.add(int.parse("${date.minute}", radix: 16));
|
||||
// arr.add(int.parse("${date.second}", radix: 16));
|
||||
// arr.add(int.parse("${date.weekday}", radix: 16));
|
||||
// arr.add(int.parse("${date.year}".substring(2), radix: 16));
|
||||
// arr.add(int.parse("${date.month}", radix: 16));
|
||||
// arr.add(int.parse("${date.day}", radix: 16));
|
||||
// var sendArr = getCode(arr);
|
||||
// List receive = [];
|
||||
// Function fun = (d) {
|
||||
// receive.add(d);
|
||||
// };
|
||||
// bedController.deviceProp?.receiveLogArr.add(fun);
|
||||
// bedController.bleSendCode(sendArr);
|
||||
// for (var i = 0; i < 3; i++) {
|
||||
// await Future.delayed(const Duration(milliseconds: 500));
|
||||
// print("$receive");
|
||||
// if (receive.length > 0) {
|
||||
// for (var i = 0; i < receive.length; i++) {
|
||||
// List<int> r = receive[i];
|
||||
// if (handleTimeResult(r, 0x20)) {
|
||||
// bedController.deviceProp?.receiveLogArr.remove(fun);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// bedController.deviceProp?.receiveLogArr.remove(fun);
|
||||
}
|
||||
|
||||
getLine() {
|
||||
return Divider(
|
||||
color: const Color(0XFF929699),
|
||||
thickness: 0.5.rpx,
|
||||
height: 0,
|
||||
);
|
||||
}
|
||||
|
||||
List weeks = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, boxConstraints) => 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,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// leading: returnIconButtomAddCallback(() {
|
||||
// controller.saveDataApi();
|
||||
// }),
|
||||
|
||||
// Container(
|
||||
// width: double.infinity,
|
||||
// height: 70.rpx,
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '柔性唤醒',
|
||||
// style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Colors.white,
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx),
|
||||
// ),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// alarmChange();
|
||||
// },
|
||||
// child: Container(
|
||||
// margin: EdgeInsets.only(right: 30.rpx),
|
||||
// width: 140.rpx,
|
||||
// height: 66.rpx,
|
||||
// alignment: Alignment.center,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// color: stringToColor("#182B7C")),
|
||||
// child: Text(
|
||||
// "保存",
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: stringToColor("#9EA4B7"),
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 30.rpx),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Obx(
|
||||
() => Container(
|
||||
padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 1.123,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 40.rpx, right: 16.rpx),
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'柔性唤醒功能',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
||||
// height:
|
||||
// MediaQuery.sizeOf(context).height *
|
||||
// 0.04,
|
||||
child: FlutterSwitch(
|
||||
width: 70.rpx,
|
||||
height: 36.rpx,
|
||||
toggleSize: 30.rpx,
|
||||
activeColor: Color(0XFF6BFDAC),
|
||||
inactiveColor: Color(0XFF003058),
|
||||
toggleColor: Color(0xFF011D33),
|
||||
value: controller.model.smysIsStart,
|
||||
onToggle: (val) {
|
||||
controller.attr.update((getmodel) {
|
||||
getmodel.model.smysIsStart = val;
|
||||
});
|
||||
},
|
||||
)),
|
||||
// Container(
|
||||
// height:
|
||||
// MediaQuery.sizeOf(context).height * 0.04,
|
||||
// child: Switch.adaptive(
|
||||
// value: controller.model.rxhxIsStart,
|
||||
// onChanged: (newValue) async {
|
||||
// controller.attr.update((getmodel) {
|
||||
// getmodel.model.rxhxIsStart = newValue;
|
||||
// });
|
||||
// },
|
||||
// activeTrackColor: const Color(0xFFD3B684),
|
||||
// inactiveTrackColor: const Color(0xFF0A1562),
|
||||
// inactiveThumbColor: const Color(0xFF182B7C),
|
||||
// trackOutlineWidth: MaterialStateProperty
|
||||
// .resolveWith<double?>(
|
||||
// (Set<MaterialState> states) {
|
||||
// if (states
|
||||
// .contains(MaterialState.disabled)) {
|
||||
// return null;
|
||||
// }
|
||||
// return null; // Use the default width.
|
||||
// }),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 40.rpx, right: 30.rpx),
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'唤醒时间',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
showDayTimeSelectionDialog(context,
|
||||
dayTimeArr: controller.model.rxhxWakeTime,
|
||||
title: "唤醒时间", checkChange: (d) {
|
||||
controller.attr.update((getmodel) {
|
||||
getmodel.model.rxhxWakeTime = [
|
||||
int.parse("${d[0]}"),
|
||||
int.parse("${d[1]}")
|
||||
];
|
||||
});
|
||||
print("$d");
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
"${controller.model.rxhxWakeTimeToString}",
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.rpx,
|
||||
),
|
||||
Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand_more.svg',
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 40.rpx, right: 30.rpx),
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'按摩',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showOneSelectionDialog(
|
||||
context,
|
||||
arr: ['开', "关"],
|
||||
checkIndex:
|
||||
controller.model.rxhxIsAnMo ? 0 : 1,
|
||||
title: "按摩",
|
||||
checkChange: (index) {
|
||||
controller.attr.update((getmodel) {
|
||||
getmodel.model.rxhxIsAnMo =
|
||||
index == 0 ? true : false;
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
controller.model.rxhxIsAnMo ? '开' : '关',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.rpx,
|
||||
),
|
||||
Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand_more.svg',
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 40.rpx, right: 30.rpx),
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'唤醒部位',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showOneSelectionDialog(
|
||||
context,
|
||||
arr: location,
|
||||
checkIndex: controller.model.rxhxLocation,
|
||||
title: "唤醒部位",
|
||||
checkChange: (index) {
|
||||
controller.attr.update((getmodel) {
|
||||
getmodel.model.rxhxLocation = index;
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
location[controller.model.rxhxLocation],
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 16.rpx,
|
||||
),
|
||||
Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand_more.svg',
|
||||
color: Colors.white,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 30.rpx,
|
||||
bottom: 30.rpx,
|
||||
left: 40.rpx,
|
||||
right: 30.rpx),
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'自定义',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 20.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height * 0.046,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
...List.generate(7, (index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.attr.update((getmodel) {
|
||||
getmodel.model
|
||||
.rxhxWeeks[index] = getmodel
|
||||
.model
|
||||
.rxhxWeeks[index] ==
|
||||
0
|
||||
? 1
|
||||
: 0;
|
||||
});
|
||||
},
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: ClipOval(
|
||||
child: Container(
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: controller.model
|
||||
.rxhxWeeks[
|
||||
index] ==
|
||||
1
|
||||
? Color(0xFF84F5FF)
|
||||
: Color(0XFF003058)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
weeks[index],
|
||||
style: const TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
getLine(),
|
||||
SizedBox(
|
||||
height: 30.rpx,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 26.rpx, right: 26.rpx),
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(),
|
||||
child: Text(
|
||||
'*注:开启该功能后,在设置的时间点,设备将启动一段固定时长的柔性唤醒功能。',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 20.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 85.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () {},
|
||||
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: 26.rpx)),
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user