Merge remote-tracking branch 'origin/master'

This commit is contained in:
czz
2025-07-11 16:48:40 +08:00
32 changed files with 762 additions and 404 deletions

View File

@@ -17,6 +17,7 @@ import 'package:vbvs_app/pages/mh_page/component/mht_bind_dialog.dart';
import 'package:vbvs_app/pages/mh_page/device/component/DeviceComponentWidget.dart';
import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart';
import 'package:vbvs_app/pages/mh_page/device/model/BlueToothDataModel.dart';
import 'package:vbvs_app/pages/mh_page/searchWidget.dart';
class MHTBlueteethDevicePage extends StatefulWidget {
var deviceType;
@@ -146,7 +147,8 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
final filteredResults = results.where((r) {
final localName = r.advertisementData.localName;
final isTarget = r.rssi > signalThreshold &&
isTargetDevice(localName, widget.deviceType['reg'].cast<String>());
isTargetDevice(
localName, widget.deviceType['reg'].cast<String>());
if (!isTarget) return false;
final name = r.advertisementData.advName.toLowerCase();
String macAddress = r.device.remoteId.str;
@@ -336,8 +338,8 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
stringToColor("FCFCFC"),
stringToColor("CEECE3")
stringToColor("#003058").withOpacity(0.8),
stringToColor("#003058").withOpacity(0.8),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
@@ -360,7 +362,7 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
: '扫描中'.tr,
style: TextStyle(
fontFamily: 'Inter',
color: stringToColor("#003058"),
color: stringToColor("#FFFFFF"),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -375,8 +377,10 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
stringToColor("FCFCFC"),
stringToColor("CEECE3")
// stringToColor("FCFCFC"),
// stringToColor("CEECE3")
Colors.transparent,
Colors.transparent,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
@@ -393,7 +397,7 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
'最小信号强度'.tr,
style: TextStyle(
fontFamily: 'Inter',
color: stringToColor("#003058"),
color: stringToColor("#FFFFFF"),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -423,7 +427,7 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
'${mhtBlueToothController.model.singal!.toInt()}',
style: TextStyle(
fontFamily: 'Inter',
color: stringToColor("#003058"),
color: stringToColor("#FFFFFF"),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -433,164 +437,194 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
),
),
),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc3,
borderRadius: BorderRadius.circular(20.rpx),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
35.rpx, 0, 35.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0, 0),
child: Container(
width: 25.rpx,
height: 25.rpx,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/query.svg',
fit: BoxFit.cover,
color: stringToColor("#333333"),
),
),
),
Expanded(
child: Container(
width: 100.rpx,
height: 90.rpx,
decoration: BoxDecoration(
color: Colors.white,
),
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: TextFormField(
initialValue:
mhtBlueToothController
.search.value,
onChanged: (Value) {
mhtBlueToothController
.search.value = Value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '检索设备'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: false,
fillColor: themeController
.currentColor.sc22,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
cursorColor:
stringToColor("#003058"),
),
),
),
),
].divide(SizedBox(width: 6.rpx)),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
26.rpx, 0, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 50.rpx,
child: VerticalDivider(
thickness: 2.rpx,
color: stringToColor("#333333"),
),
),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor:
themeController.currentColor.sc4,
borderRadius: 6.rpx,
padding: EdgeInsets.zero,
onTap: () async {
_startScanning();
},
child: Text(
'搜索'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: stringToColor("#333333"),
),
),
),
].divide(SizedBox(width: 26.rpx)),
),
),
],
),
// Container(
// width: double.infinity,
// decoration: BoxDecoration(
// color: themeController.currentColor.sc3,
// borderRadius: BorderRadius.circular(20.rpx),
// ),
// // child: Padding(
// // padding: EdgeInsetsDirectional.fromSTEB(
// // 35.rpx, 0, 35.rpx, 0),
// // child: Row(
// // mainAxisSize: MainAxisSize.max,
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// // children: [
// // Expanded(
// // child: Row(
// // mainAxisSize: MainAxisSize.max,
// // children: [
// // Padding(
// // padding: EdgeInsetsDirectional.fromSTEB(
// // 0, 0.rpx, 0, 0),
// // child: Container(
// // width: 25.rpx,
// // height: 25.rpx,
// // decoration: BoxDecoration(),
// // child: SvgPicture.asset(
// // 'assets/img/icon/query.svg',
// // fit: BoxFit.cover,
// // color: stringToColor("#333333"),
// // ),
// // ),
// // ),
// // Expanded(
// // child: Container(
// // width: 100.rpx,
// // height: 90.rpx,
// // decoration: BoxDecoration(
// // color: Colors.white,
// // ),
// // child: Align(
// // alignment:
// // AlignmentDirectional(-1, 0),
// // child: TextFormField(
// // initialValue:
// // mhtBlueToothController
// // .search.value,
// // onChanged: (Value) {
// // mhtBlueToothController
// // .search.value = Value;
// // },
// // autofocus: false,
// // obscureText: false,
// // decoration: InputDecoration(
// // isDense: true,
// // labelStyle: TextStyle(
// // fontFamily: 'Inter',
// // fontSize: 26.rpx,
// // letterSpacing: 0.0,
// // ),
// // hintText: '检索设备'.tr,
// // hintStyle: TextStyle(
// // fontFamily: 'Inter',
// // fontSize: 26.rpx,
// // letterSpacing: 0.0,
// // ),
// // enabledBorder:
// // OutlineInputBorder(
// // borderSide: BorderSide(
// // color: Color(0x00000000),
// // width: 1.rpx,
// // ),
// // borderRadius:
// // BorderRadius.circular(
// // 8.rpx),
// // ),
// // focusedBorder:
// // OutlineInputBorder(
// // borderSide: BorderSide(
// // color: Color(0x00000000),
// // width: 1.rpx,
// // ),
// // borderRadius:
// // BorderRadius.circular(
// // 8.rpx),
// // ),
// // errorBorder: OutlineInputBorder(
// // borderSide: BorderSide(
// // color: Colors.red,
// // width: 1.rpx,
// // ),
// // borderRadius:
// // BorderRadius.circular(
// // 8.rpx),
// // ),
// // focusedErrorBorder:
// // OutlineInputBorder(
// // borderSide: BorderSide(
// // color: Colors.red,
// // width: 1.rpx,
// // ),
// // borderRadius:
// // BorderRadius.circular(
// // 8.rpx),
// // ),
// // filled: false,
// // fillColor: themeController
// // .currentColor.sc22,
// // ),
// // style: TextStyle(
// // fontFamily: 'Inter',
// // fontSize: 26.rpx,
// // letterSpacing: 0.0,
// // ),
// // cursorColor:
// // stringToColor("#003058"),
// // ),
// // ),
// // ),
// // ),
// // ].divide(SizedBox(width: 6.rpx)),
// // ),
// // ),
// // Padding(
// // padding: EdgeInsetsDirectional.fromSTEB(
// // 26.rpx, 0, 0, 0),
// // child: Row(
// // mainAxisSize: MainAxisSize.max,
// // children: [
// // SizedBox(
// // height: 50.rpx,
// // child: VerticalDivider(
// // thickness: 2.rpx,
// // color: stringToColor("#333333"),
// // ),
// // ),
// // ClickableContainer(
// // backgroundColor: Colors.transparent,
// // highlightColor:
// // themeController.currentColor.sc4,
// // borderRadius: 6.rpx,
// // padding: EdgeInsets.zero,
// // onTap: () async {
// // _startScanning();
// // },
// // child: Text(
// // '搜索'.tr,
// // style: TextStyle(
// // fontFamily: 'Inter',
// // fontSize: 30.rpx,
// // letterSpacing: 0.0,
// // color: stringToColor("#333333"),
// // ),
// // ),
// // ),
// // ].divide(SizedBox(width: 26.rpx)),
// // ),
// // ),
// // ],
// // ),
// // ),
// child: Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0, 10, 0, 23),
// child: SearchWidget(
// keyword: mhtBlueToothController.search.value,
// color: Colors.red,
// hint: "检索设备",
// onChange: (d) {
// mhtBlueToothController.search.value = d;
// },
// findCallback: () {
// // controller.getDeviceList();
// },
// ),
// ),
// ),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0),
child: SearchWidget(
padding: EdgeInsets.all(0),
keyword: mhtBlueToothController.search.value,
color: Colors.red,
hint: "检索设备",
onChange: (d) {
mhtBlueToothController.search.value = d;
},
findCallback: () {
_startScanning();
},
),
),
Padding(

View File

@@ -574,6 +574,8 @@ class _NewHomePageState extends State<NewHomePage> {
'date': DateTime
.now()
.millisecondsSinceEpoch,
'person_show':
false,
},
);
}
@@ -665,6 +667,8 @@ class _NewHomePageState extends State<NewHomePage> {
'date':
timeMillis,
// 'backgroundColor':stringToColor("#003058"),
'person_show':
false,
},
);
},

View File

@@ -11,18 +11,21 @@ class SearchWidget extends GetView {
String? hint;
Function? onChange;
Function? findCallback;
final EdgeInsetsGeometry? padding; // 新增 padding 参数
SearchWidget(
{required this.keyword,
required this.color,
this.hint = "请输入关键字",
this.findCallback,
this.onChange});
SearchWidget({
required this.keyword,
required this.color,
this.hint = "请输入关键字",
this.findCallback,
this.onChange,
this.padding, // 传入 padding 参数
});
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
padding: padding ?? EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0), // 使用传入的 padding 或默认值
child: Container(
width: double.infinity,
decoration: BoxDecoration(
@@ -42,7 +45,6 @@ class SearchWidget extends GetView {
Container(
width: 25.rpx,
height: 25.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/query.svg',
@@ -112,11 +114,6 @@ class SearchWidget extends GetView {
color: Colors.black,
letterSpacing: 0.0,
),
// cursorColor:
// FlutterFlowTheme.of(context).primaryText,
// validator: _model
// .textControllerValidator
// .asValidator(context),
onChanged: (d) {
onChange?.call(d);
},

View File

@@ -278,13 +278,18 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
class WebviewTestView extends GetComponent<WebviewTestController> {
WebviewTestView({super.key, super.oncreate});
// @override
// WebviewTestController newinstance() {
// if (ef.kvRoot.WebviewTestController == null) {
// ef.kvRoot.WebviewTestController = WebviewTestController();
// }
// return ef.kvRoot.WebviewTestController;
// }
@override
WebviewTestController newinstance() {
if (ef.kvRoot.WebviewTestController == null) {
ef.kvRoot.WebviewTestController = WebviewTestController();
if (Get.isRegistered<WebviewTestController>() == false) {
Get.put<WebviewTestController>(ef.kvRoot.WebviewTestController);
WebviewTestController webviewTestController = Get.find();
return webviewTestController;
}
}
return ef.kvRoot.WebviewTestController;
}
@override
Widget build(BuildContext context) {