更新页面
This commit is contained in:
320
lib/pages/device_bind/bind_device_success.dart
Normal file
320
lib/pages/device_bind/bind_device_success.dart
Normal file
@@ -0,0 +1,320 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.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/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class BindDeviceSuccess extends StatefulWidget {
|
||||
const BindDeviceSuccess({super.key});
|
||||
|
||||
@override
|
||||
State<BindDeviceSuccess> createState() => _EPageState();
|
||||
}
|
||||
|
||||
class _EPageState extends State<BindDeviceSuccess> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 加上这一行
|
||||
appBar: AppBar(
|
||||
backgroundColor: stringToColor("#242835"),
|
||||
// backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtom,
|
||||
title: Container(
|
||||
// color: Colors.grey,
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'绑定成功.标题'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(113.rpx, 0, 113.rpx, 0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 74.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: 124.rpx,
|
||||
height: 124.rpx,
|
||||
// width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/tick.svg',
|
||||
fit: BoxFit.cover,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 42.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Text(
|
||||
'绑定成功.绑定成功'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 48.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 265.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Text(
|
||||
'绑定成功.分享标题'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 48.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'绑定成功.分享内容'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 110.rpx, 0, 0),
|
||||
child: CustomCard(
|
||||
borderRadius:
|
||||
AppConstants().button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
print('Button pressed ...');
|
||||
Get.toNamed("/deviceType");
|
||||
},
|
||||
colors: [
|
||||
// 渐变色
|
||||
stringToColor("45D989"), // 左侧渐变色
|
||||
stringToColor("00C1AA"), // 右侧渐变色
|
||||
],
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.66,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/share.svg',
|
||||
width: 25.rpx,
|
||||
height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
color: Colors.white, // 设置图标颜色为白色
|
||||
),
|
||||
Text(
|
||||
'绑定成功.立即分享'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
color: Colors.white, // 文字颜色
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize, // 自定义字体大小
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 18.rpx, 0, 0),
|
||||
child: CustomCard(
|
||||
borderRadius:
|
||||
AppConstants().button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
Get.offAllNamed("/mianPageBottomChange");
|
||||
},
|
||||
colors: [
|
||||
// 渐变色
|
||||
stringToColor("45D989"), // 左侧渐变色
|
||||
stringToColor("00C1AA"), // 右侧渐变色
|
||||
],
|
||||
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.66,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'绑定成功.返回'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
color: Colors.white, // 文字颜色
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize, // 自定义字体大小
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceCard(BuildContext context,
|
||||
{required String title, required String imageUrl, required String type}) {
|
||||
return CustomCard(
|
||||
borderRadius: 20.rpx, // 圆角大小
|
||||
onTap: () {
|
||||
if (type != null) {
|
||||
if (type == '1') {
|
||||
Get.toNamed("/blueteethDevice");
|
||||
}
|
||||
}
|
||||
},
|
||||
// colors: [Colors.white.withOpacity(0.06)], // 背景色
|
||||
colors: [stringToColor("#242835")], // 背景色
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height * 0.135,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 220.rpx,
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFC2CED7),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
child: Image.asset(
|
||||
imageUrl,
|
||||
width: 212.rpx,
|
||||
height: 168.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1059
lib/pages/device_bind/blueteeth_device_page.dart
Normal file
1059
lib/pages/device_bind/blueteeth_device_page.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,294 @@
|
||||
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
|
||||
class DoubleBlueteethDeviceCompoentWidget extends StatefulWidget {
|
||||
const DoubleBlueteethDeviceCompoentWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DoubleBlueteethDeviceCompoentWidget> createState() =>
|
||||
_DoubleBlueteethDeviceCompoentWidgetState();
|
||||
}
|
||||
|
||||
class _DoubleBlueteethDeviceCompoentWidgetState
|
||||
extends State<DoubleBlueteethDeviceCompoentWidget> {
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF242835),
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0, 52.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'AITH-V3',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'信号强度:-36dBm',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'SN:12',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF5F9FD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 40.rpx)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'蓝牙地址:48:CA:43:B1:B3:B2',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'mac:48CA43B1B3B0',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'网络:在线',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'传感器:',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'可绑定',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFF1AD2B5),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
].divide(SizedBox(width: 145.rpx)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'版本:02409.0301',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
thickness: 2.rpx,
|
||||
color: FlutterFlowTheme.of(context).alternate,
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'AITH-V3',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'信号强度:-36dBm',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'SN:12',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF5F9FD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 40.rpx)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'蓝牙地址:48:CA:43:B1:B3:B2',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'mac:48CA43B1B3B0',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'网络:在线',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'传感器:',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'可绑定',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFF1AD2B5),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
].divide(SizedBox(width: 145.rpx)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
'版本:02409.0301',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 37.rpx)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
86
lib/pages/device_bind/componnet/FancyCircleCheckbox.dart
Normal file
86
lib/pages/device_bind/componnet/FancyCircleCheckbox.dart
Normal file
@@ -0,0 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FancyCircleCheckbox extends StatefulWidget {
|
||||
final bool value;
|
||||
final ValueChanged<bool> onChanged;
|
||||
final Color borderColor;
|
||||
final Color fillColor;
|
||||
|
||||
const FancyCircleCheckbox({
|
||||
Key? key,
|
||||
required this.value,
|
||||
required this.onChanged,
|
||||
this.borderColor = Colors.white,
|
||||
this.fillColor = Colors.blue,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<FancyCircleCheckbox> createState() => _FancyCircleCheckboxState();
|
||||
}
|
||||
|
||||
class _FancyCircleCheckboxState extends State<FancyCircleCheckbox>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _scaleAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
duration: Duration(milliseconds: 200),
|
||||
vsync: this,
|
||||
);
|
||||
_scaleAnimation = CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
|
||||
if (widget.value) {
|
||||
_controller.forward();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant FancyCircleCheckbox oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.value != oldWidget.value) {
|
||||
widget.value ? _controller.forward() : _controller.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => widget.onChanged(!widget.value),
|
||||
child: Container(
|
||||
width: 24,
|
||||
height: 24,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: widget.value
|
||||
? widget.borderColor
|
||||
: widget.borderColor.withOpacity(0.5),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: ScaleTransition(
|
||||
scale: _scaleAnimation,
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: widget.fillColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/model/BleDeviceData.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/blueteeth_device_page.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
class SingleBlueteethDeviceCompoentWidget extends StatefulWidget {
|
||||
// final BleDeviceData device;
|
||||
final bleDevice;
|
||||
|
||||
const SingleBlueteethDeviceCompoentWidget({
|
||||
super.key,
|
||||
// required this.device,
|
||||
required this.bleDevice,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SingleBlueteethDeviceCompoentWidget> createState() =>
|
||||
_SingleBlueteethDeviceCompoentWidgetState();
|
||||
}
|
||||
|
||||
class _SingleBlueteethDeviceCompoentWidgetState
|
||||
extends State<SingleBlueteethDeviceCompoentWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var bleDevice = widget.bleDevice;
|
||||
List<int> rawData =
|
||||
widget.bleDevice.advertisementData.manufacturerData[0xFFED]!;
|
||||
BleDeviceData deviceData = parseBleData(rawData);
|
||||
deviceData.name = widget.bleDevice.advertisementData.advName;
|
||||
deviceData.rssi = widget.bleDevice.rssi;
|
||||
deviceData.mac = deviceData.deviceId.replaceAll(':', '');
|
||||
BleDeviceData device = deviceData;
|
||||
|
||||
ThemeController themeController = Get.find();
|
||||
return ClickableContainer(
|
||||
backgroundColor: themeController.currentColor.sc5,
|
||||
highlightColor: Colors.white,
|
||||
borderRadius: 20.rpx,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 36.rpx, 0, 52.rpx),
|
||||
onTap: () async {
|
||||
//todo 请求绑定
|
||||
print(device.mac);
|
||||
// try {
|
||||
// await bleDevice.device.connect(autoConnect: false);
|
||||
// List<BluetoothService> services =
|
||||
// await bleDevice.device.discoverServices();
|
||||
// BluetoothCharacteristic? wifiListChar;
|
||||
// BluetoothCharacteristic? wifiSsidChar;
|
||||
// BluetoothCharacteristic? wifiPasswordChar;
|
||||
// BluetoothCharacteristic? startProvisionChar;
|
||||
|
||||
// for (BluetoothService service in services) {
|
||||
// for (BluetoothCharacteristic c in service.characteristics) {
|
||||
// if (c.uuid.toString() == 'YOUR_WIFI_LIST_UUID') {
|
||||
// wifiListChar = c;
|
||||
// } else if (c.uuid.toString() == 'YOUR_WIFI_SSID_UUID') {
|
||||
// wifiSsidChar = c;
|
||||
// } else if (c.uuid.toString() == 'YOUR_WIFI_PWD_UUID') {
|
||||
// wifiPasswordChar = c;
|
||||
// } else if (c.uuid.toString() == 'YOUR_WIFI_START_UUID') {
|
||||
// startProvisionChar = c;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (e) {
|
||||
// print("蓝牙连接失败");
|
||||
// }
|
||||
//
|
||||
// Get.toNamed('/wifiPage', arguments: bleDevice.device);
|
||||
showBindDoubleDialog(context,[]);
|
||||
// showHaveBindDialog(context);
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
device.name ?? '蓝牙绑定.默认设备名称'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFF6FAFD),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"蓝牙绑定.信号强度".tr + ':${device.rssi ?? '-'}dBm',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 40.rpx),
|
||||
Text(
|
||||
"蓝牙绑定.SN".tr + ':${device.sn ?? '-'}',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFF5F9FD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
"蓝牙绑定.蓝牙地址".tr + ':${device.deviceId ?? '-'}',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"蓝牙绑定.mac".tr + ':${device.mac ?? '-'}',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"蓝牙绑定.网络".tr +
|
||||
':${device.isOnline == true ? '蓝牙绑定.在线'.tr : '蓝牙绑定.离线'.tr}',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 145.rpx),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"蓝牙绑定.传感器".tr + ":",
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFEBF2F8),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
device.status == 1 ? '蓝牙绑定.可绑定'.tr : '蓝牙绑定.已被绑定'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFF1AD2B5),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'版本:${device.version ?? '-'}',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFF6FAFD),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 37.rpx)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
324
lib/pages/device_bind/componnet/bind_dialog.dart
Normal file
324
lib/pages/device_bind/componnet/bind_dialog.dart
Normal file
@@ -0,0 +1,324 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/FrostedDialog.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/model/BleDeviceData.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.dart';
|
||||
|
||||
void showBindDoubleDialog(BuildContext context, List<BleDeviceData> devices) {
|
||||
ThemeController themeController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
|
||||
blueteethBindController.model.deviceIndex0 = true;
|
||||
blueteethBindController.model.deviceIndex1 = false;
|
||||
blueteethBindController.model.deviceIndex2 = false;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierColor: Colors.black.withOpacity(0.5), // 建议加个背景模糊色
|
||||
builder: (BuildContext context) {
|
||||
return FrostedDialog(
|
||||
blurSigma: 3.0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc17,
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 0, 60.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 标题
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 0),
|
||||
child: Text(
|
||||
'蓝牙绑定.双人版绑定标题'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 全选
|
||||
_buildCheckboxRow(
|
||||
context,
|
||||
title: '蓝牙绑定.绑定全部'.tr,
|
||||
value: () => blueteethBindController.model.deviceIndex0!,
|
||||
onChanged: (v) {
|
||||
if (!blueteethBindController.model.deviceIndex0!) {
|
||||
blueteethBindController.model.deviceIndex0 = v;
|
||||
blueteethBindController.model.deviceIndex1 = !v;
|
||||
blueteethBindController.model.deviceIndex2 = !v;
|
||||
blueteethBindController.updateAll();
|
||||
}
|
||||
},
|
||||
),
|
||||
// 主设备
|
||||
_buildCheckboxRow(
|
||||
context,
|
||||
title: '蓝牙绑定.主设备'.tr,
|
||||
value: () => blueteethBindController.model.deviceIndex1!,
|
||||
onChanged: (v) {
|
||||
if (!blueteethBindController.model.deviceIndex1!) {
|
||||
blueteethBindController.model.deviceIndex1 = v;
|
||||
blueteethBindController.model.deviceIndex0 = !v;
|
||||
blueteethBindController.model.deviceIndex2 = !v;
|
||||
blueteethBindController.updateAll();
|
||||
}
|
||||
},
|
||||
),
|
||||
// 从设备
|
||||
_buildCheckboxRow(
|
||||
context,
|
||||
title: '蓝牙绑定.从设备'.tr,
|
||||
value: () => blueteethBindController.model.deviceIndex2!,
|
||||
onChanged: (v) {
|
||||
if (!blueteethBindController.model.deviceIndex2!) {
|
||||
blueteethBindController.model.deviceIndex2 = v;
|
||||
blueteethBindController.model.deviceIndex0 = !v;
|
||||
blueteethBindController.model.deviceIndex1 = !v;
|
||||
blueteethBindController.updateAll();
|
||||
}
|
||||
},
|
||||
),
|
||||
// 确定按钮
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 100.rpx, 0, 0),
|
||||
child: _buildActionButton(
|
||||
context,
|
||||
text: '蓝牙绑定.确定'.tr,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
),
|
||||
// 取消按钮
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||||
child: _buildActionButton(
|
||||
context,
|
||||
text: '蓝牙绑定.取消'.tr,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void showHaveBindDialog(BuildContext context) {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierColor: Colors.black.withOpacity(0.5),
|
||||
builder: (BuildContext context) {
|
||||
return FrostedDialog(
|
||||
blurSigma: 3.0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc17,
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 0, 60.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 93.rpx, 0.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'蓝牙绑定.无法绑定'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 70.rpx, 0.rpx, 56.rpx),
|
||||
child: RichText(
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: "蓝牙绑定.无法绑定1".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "蓝牙绑定.无法绑定2".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc10,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "蓝牙绑定.无法绑定3".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'蓝牙绑定.知道了'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
color: Colors.white,
|
||||
fontFamily: 'Inter',
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 17.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _buildCheckboxRow(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
required bool Function() value,
|
||||
required void Function(bool) onChanged,
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
return Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(60.rpx, 64.rpx, 0.rpx, 0.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Obx(() => FancyCircleCheckbox(
|
||||
borderColor: themeController.currentColor.sc3,
|
||||
fillColor: themeController.currentColor.sc2,
|
||||
value: value(),
|
||||
onChanged: onChanged,
|
||||
)),
|
||||
Text(
|
||||
title,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 21.rpx)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButton(
|
||||
BuildContext context, {
|
||||
required String text,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
return CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: onTap,
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
text,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
color: Colors.white,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.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/component/tool/FrostedDialog.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
class DeviceTypePage extends StatefulWidget {
|
||||
@@ -20,6 +23,7 @@ class _EPageState extends State<DeviceTypePage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -31,79 +35,84 @@ class _EPageState extends State<DeviceTypePage> {
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
return FrostedDialog(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 26.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFBF5D5),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants()
|
||||
.normal_container_radius), // 圆角半径
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 26.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFBF5D5),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants()
|
||||
.normal_container_radius), // 圆角半径
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
25.rpx, 25.rpx, 25.rpx, 25.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.volume_mute,
|
||||
color:
|
||||
FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
size: 30.rpx,
|
||||
25.rpx, 25.rpx, 25.rpx, 25.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(
|
||||
0, 8.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: 25.rpx,
|
||||
height: 25.rpx,
|
||||
// width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/sound.svg',
|
||||
fit: BoxFit.fill,
|
||||
color: themeController
|
||||
.currentColor.sc8,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'绑定引导.说明标题'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight:
|
||||
FontWeight.w500,
|
||||
color:
|
||||
Colors.orange),
|
||||
),
|
||||
Text(
|
||||
'绑定引导.说明正文'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'绑定引导.说明标题'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight:
|
||||
FontWeight.w500,
|
||||
color: Colors.orange),
|
||||
),
|
||||
Text(
|
||||
'绑定引导.说明正文'.tr,
|
||||
style:
|
||||
FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
@@ -111,162 +120,161 @@ class _EPageState extends State<DeviceTypePage> {
|
||||
.normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
height: AppConstants()
|
||||
.text_padding_up_dowm_p)),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 20.rpx)),
|
||||
].divide(SizedBox(
|
||||
height: AppConstants()
|
||||
.text_padding_up_dowm_p)),
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 20.rpx)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: (MediaQuery.sizeOf(context).width) *
|
||||
0.13,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 200.rpx,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(20.rpx),
|
||||
// child: Image.network(
|
||||
// 'https://picsum.photos/seed/861/600',
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
child: Image.asset(
|
||||
"assets/img/help_op.png",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 25.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height:
|
||||
(MediaQuery.sizeOf(context).width) * 0.13,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 200.rpx,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
// child: Image.network(
|
||||
// 'https://picsum.photos/seed/861/600',
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
child: Image.asset(
|
||||
"assets/img/help_op.png",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 25.rpx)),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 210.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Theme(
|
||||
data: ThemeData(
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
visualDensity:
|
||||
VisualDensity.compact,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize
|
||||
.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(64),
|
||||
),
|
||||
),
|
||||
unselectedWidgetColor:
|
||||
Color(0xFFD3D3D3),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 210.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Theme(
|
||||
data: ThemeData(
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
visualDensity:
|
||||
VisualDensity.compact,
|
||||
materialTapTargetSize:
|
||||
MaterialTapTargetSize
|
||||
.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(64),
|
||||
),
|
||||
child: Obx(
|
||||
() => Checkbox(
|
||||
value: userInfoController
|
||||
.model.register_agree ??
|
||||
false,
|
||||
onChanged: (newValue) async {
|
||||
userInfoController.model
|
||||
.register_agree =
|
||||
newValue;
|
||||
userInfoController
|
||||
.updateAll();
|
||||
// 获取设备信息,需要用户点击确认隐私协议与用户协议选择框时才能获取
|
||||
// if (newValue == true) {
|
||||
// Deviceconfig
|
||||
// .initPlatformState();
|
||||
// }
|
||||
},
|
||||
side: BorderSide(
|
||||
width: 1.5,
|
||||
color: FlutterFlowTheme.of(
|
||||
context)
|
||||
.secondaryText,
|
||||
),
|
||||
activeColor:
|
||||
stringToColor("#16C89F"),
|
||||
checkColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.info,
|
||||
),
|
||||
)),
|
||||
Text(
|
||||
'绑定引导.不再提示'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: Colors.white),
|
||||
),
|
||||
unselectedWidgetColor:
|
||||
Color(0xFFD3D3D3),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
),
|
||||
CustomCard(
|
||||
borderRadius: 50.rpx,
|
||||
onTap: () async {
|
||||
await Future.delayed(
|
||||
Duration(milliseconds: 500));
|
||||
Get.back(); // 关闭当前弹窗或页面
|
||||
},
|
||||
colors: [
|
||||
//todo 颜色
|
||||
stringToColor("45D989"),
|
||||
stringToColor("00C1AA")
|
||||
], // 单色背景也用渐变写法
|
||||
title: '',
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width *
|
||||
0.66,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height *
|
||||
0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
alignment: Alignment.center, // 居中对齐
|
||||
child: Text(
|
||||
'绑定引导.跳过'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
child: Obx(
|
||||
() => Checkbox(
|
||||
value: blueteethBindController
|
||||
.model.read ==
|
||||
1
|
||||
? false
|
||||
: true,
|
||||
onChanged: (newValue) async {
|
||||
blueteethBindController
|
||||
.model.read =
|
||||
newValue == true ? 0 : 1;
|
||||
blueteethBindController
|
||||
.updateAll();
|
||||
// 获取设备信息,需要用户点击确认隐私协议与用户协议选择框时才能获取
|
||||
// if (newValue == true) {
|
||||
// Deviceconfig
|
||||
// .initPlatformState();
|
||||
// }
|
||||
},
|
||||
side: BorderSide(
|
||||
width: 1.5,
|
||||
color:
|
||||
FlutterFlowTheme.of(context)
|
||||
.secondaryText,
|
||||
),
|
||||
activeColor:
|
||||
stringToColor("#16C89F"),
|
||||
checkColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.info,
|
||||
),
|
||||
)),
|
||||
Text(
|
||||
'绑定引导.不再提示'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
color: Colors.white),
|
||||
),
|
||||
)
|
||||
].divide(SizedBox(height: 42.rpx)),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
CustomCard(
|
||||
borderRadius: 50.rpx,
|
||||
onTap: () async {
|
||||
await Future.delayed(
|
||||
Duration(milliseconds: 500));
|
||||
Get.back(); // 关闭当前弹窗或页面
|
||||
},
|
||||
colors: [
|
||||
//todo 颜色
|
||||
stringToColor("45D989"),
|
||||
stringToColor("00C1AA")
|
||||
], // 单色背景也用渐变写法
|
||||
|
||||
child: Container(
|
||||
width:
|
||||
MediaQuery.sizeOf(context).width * 0.66,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height * 0.055,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
alignment: Alignment.center, // 居中对齐
|
||||
child: Text(
|
||||
'绑定引导.跳过'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
].divide(SizedBox(height: 42.rpx)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -275,7 +283,7 @@ class _EPageState extends State<DeviceTypePage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int read = blueteethBindController.model.read;
|
||||
int read = blueteethBindController.model.read!;
|
||||
if (blueteethBindController.model.read == 1) {
|
||||
//需要弹窗显示教程
|
||||
}
|
||||
@@ -378,11 +386,12 @@ class _EPageState extends State<DeviceTypePage> {
|
||||
if (type == '1') {
|
||||
Get.toNamed("/blueteethDevice");
|
||||
}
|
||||
if (type == '2') {
|
||||
Get.toNamed("/wifiPage");
|
||||
}
|
||||
}
|
||||
},
|
||||
// colors: [Colors.white.withOpacity(0.06)], // 背景色
|
||||
colors: [stringToColor("#242835")], // 背景色
|
||||
title: title,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height * 0.135,
|
||||
|
||||
502
lib/pages/device_bind/wifi_page.dart
Normal file
502
lib/pages/device_bind/wifi_page.dart
Normal file
@@ -0,0 +1,502 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/Ble.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/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/person/person_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/common/util/Ble.dart' as ble;
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
|
||||
class WifiPage extends StatefulWidget {
|
||||
// ble.ConnectedDeviceProp connectedDeviceProp;
|
||||
BluetoothDevice bluetoothDevice;
|
||||
// WifiPage({super.key, required this.connectedDeviceProp});
|
||||
WifiPage({super.key, required this.bluetoothDevice});
|
||||
|
||||
@override
|
||||
State<WifiPage> createState() => _WifiPageState();
|
||||
}
|
||||
|
||||
class _WifiPageState extends State<WifiPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
PersonController personController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
late ble.ConnectedDeviceProp connectedDeviceProp;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
connectToDevice(widget.bluetoothDevice);
|
||||
// connectedDeviceProp = widget.connectedDeviceProp;
|
||||
Timer(const Duration(microseconds: 100), () {
|
||||
getWifiList();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 加上这一行
|
||||
appBar: AppBar(
|
||||
backgroundColor: stringToColor("#242835"),
|
||||
// backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtom,
|
||||
title: Container(
|
||||
// color: Colors.grey,
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'wifi页.标题'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
Get.offAllNamed("/bindDeviceSuccess");
|
||||
},
|
||||
colors: [
|
||||
stringToColor("#45D989"),
|
||||
stringToColor("#00C1AA"),
|
||||
],
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0, 16.rpx, 0),
|
||||
child: Text(
|
||||
'wifi页.跳过'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.titleSmall
|
||||
.override(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF242835),
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 30.rpx, 30.rpx, 30.rpx),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"wifi页.WLAN".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
AppConstants().title_text_fontSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"wifi页.未连接".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 25.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5,
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 30.rpx, 30.rpx, 30.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'可用WLAN',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'6503',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.wifi_outlined,
|
||||
size: 30.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'6503',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.wifi_outlined,
|
||||
size: 30.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'6503',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.wifi_outlined,
|
||||
size: 30.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'6503',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.wifi_outlined,
|
||||
size: 30.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'6503',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.wifi_outlined,
|
||||
size: 30.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
],
|
||||
),
|
||||
].divide(SizedBox(height: 67.rpx)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_back,
|
||||
color: themeController.currentColor.sc3,
|
||||
size: 30.rpx,
|
||||
),
|
||||
Text(
|
||||
'刷新',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3),
|
||||
),
|
||||
].divide(SizedBox(width: 26.rpx)),
|
||||
),
|
||||
].divide(SizedBox(height: 65.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceCard(BuildContext context,
|
||||
{required String title, required String imageUrl, required String type}) {
|
||||
return CustomCard(
|
||||
borderRadius: 20.rpx, // 圆角大小
|
||||
onTap: () {
|
||||
if (type != null) {
|
||||
if (type == '1') {
|
||||
Get.toNamed("/blueteethDevice");
|
||||
}
|
||||
}
|
||||
},
|
||||
// colors: [Colors.white.withOpacity(0.06)], // 背景色
|
||||
colors: [stringToColor("#242835")], // 背景色
|
||||
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height * 0.135,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 220.rpx,
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFC2CED7),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
child: Image.asset(
|
||||
imageUrl,
|
||||
width: 212.rpx,
|
||||
height: 168.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getWifiList({int time = 3}) {
|
||||
// LoadingDialog.show("扫描WIFI列表中...", icon: LoadingDialogIcon.wifi);
|
||||
try {
|
||||
var device = widget.bluetoothDevice;
|
||||
String log = "";
|
||||
Function logAdd = (l) {
|
||||
log += l;
|
||||
};
|
||||
connectedDeviceProp.receiveLogArr.add(logAdd);
|
||||
connectedDeviceProp.write3OfString("wscan scan", success: () {
|
||||
Timer.periodic(const Duration(milliseconds: 1000), (timer) async {
|
||||
if (timer.tick > 8) {
|
||||
timer.cancel();
|
||||
connectedDeviceProp.receiveLogArr.remove(logAdd);
|
||||
LoadingDialog.hide();
|
||||
if (time > 0) {
|
||||
getWifiList(time: time - 1);
|
||||
}
|
||||
}
|
||||
Iterable<RegExpMatch> a = RegExp(
|
||||
r'ITEM:SSID=([^\t]*)\s*RSSI=(\S*)\s*(,\s*auth\s*=\s*(\S*))?')
|
||||
.allMatches(log);
|
||||
if (a.isEmpty == false) {
|
||||
await Future.delayed(const Duration(milliseconds: 500));
|
||||
a = RegExp(
|
||||
r'ITEM:SSID=([^\t]*)\s*RSSI=(\S*)\s*(,\s*auth\s*=\s*(\S*))?')
|
||||
.allMatches(log);
|
||||
List arr = [];
|
||||
for (RegExpMatch one in a) {
|
||||
arr.add({"name": one[1], "num": one[2], "auth": one[4]});
|
||||
}
|
||||
LoadingDialog.hide();
|
||||
blueteethBindController.model.wifiList = arr;
|
||||
blueteethBindController.updateAll();
|
||||
connectedDeviceProp.receiveLogArr.remove(logAdd);
|
||||
timer.cancel();
|
||||
checkIsCalibration();
|
||||
}
|
||||
});
|
||||
}, fail: () {
|
||||
connectedDeviceProp.receiveLogArr.remove(logAdd);
|
||||
LoadingDialog.hide();
|
||||
});
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
checkIsCalibration() {
|
||||
// if (controller.model.bindArr[0] == "" ||
|
||||
// controller.model.bindArr[0] == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (controller.model.bindArr[2] == "" ||
|
||||
// controller.model.bindArr[2] == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (controller.model.connectedWifiName == "" ||
|
||||
// controller.model.connectedWifiName == null) {
|
||||
// return;
|
||||
// }
|
||||
showCustomConfirmAndCancelDialog(context, "是否进行设备校准?", confirmName: "去校准")
|
||||
.then((d) async {
|
||||
// if (d == "confirm") {
|
||||
// await Get.offAndToNamed("/calibration", arguments: [
|
||||
// controller.model.bindArr[1],
|
||||
// controller.model.bindArr[2]
|
||||
// ]);
|
||||
// Get.find<GlobalController>().getDeviceList();
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user