解绑设备
This commit is contained in:
@@ -12,16 +12,16 @@ class LanguagePage extends GetView<MHLanguageController> {
|
||||
// }
|
||||
MHLanguageController controller = Get.find();
|
||||
BoxConstraints? bodysize;
|
||||
List<String> languageList = [
|
||||
'简体中文',
|
||||
'繁體中文',
|
||||
'English',
|
||||
];
|
||||
final Map<String, String> languageMap = {
|
||||
'简体中文': 'zh_CN',
|
||||
'繁體中文': 'zh_TW',
|
||||
'English': 'en_US',
|
||||
};
|
||||
// List<String> languageList = [
|
||||
// '简体中文',
|
||||
// '繁體中文',
|
||||
// 'English',
|
||||
// ];
|
||||
// final Map<String, String> languageMap = {
|
||||
// '简体中文': 'zh_CN',
|
||||
// '繁體中文': 'zh_TW',
|
||||
// 'English': 'en_US',
|
||||
// };
|
||||
|
||||
// class _LanguagePageState extends State<LanguagePage> {
|
||||
RxBool checkboxValue = false.obs;
|
||||
@@ -56,7 +56,7 @@ class LanguagePage extends GetView<MHLanguageController> {
|
||||
children: [
|
||||
// 中间居中的标题
|
||||
Text(
|
||||
'切换语言',
|
||||
'切换语言'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -135,7 +135,7 @@ class LanguagePage extends GetView<MHLanguageController> {
|
||||
value: controller.selectLanguage.value?.language_code ==
|
||||
model.language_code,
|
||||
onChanged: (newValue) async {
|
||||
controller.selectLanguage.value = model;
|
||||
controller.selectLanguage.value = model;
|
||||
// if (newValue!) {
|
||||
// selectLanguage!.value = languageMap[
|
||||
// text]!; // Set selectLanguage to the current text value
|
||||
|
||||
@@ -6,12 +6,16 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
class BluetoothPage extends GetView {
|
||||
Map data;
|
||||
BluetoothPage({required this.data});
|
||||
|
||||
BoxConstraints? bodysize;
|
||||
DeviceListController deviceListController = Get.find();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -156,8 +160,44 @@ class BluetoothPage extends GetView {
|
||||
_buildMenuButton(
|
||||
context, '睡眠习惯', "/sleepHabitPage"),
|
||||
_buildMenuButton(
|
||||
context, '分享设备', "/deviceSharePage"),
|
||||
_buildMenuButton(context, '解绑', ""),
|
||||
context, '分享设备', "/deviceSharePage",
|
||||
arguments: data),
|
||||
_buildMenuButton(
|
||||
context,
|
||||
data['bind_type'] == 1 ? '解绑' : '删除',
|
||||
"",
|
||||
onTap: () {
|
||||
if (data['bind_type'] == 1) {
|
||||
// 解绑弹窗
|
||||
showUnbindConfirmDialog(
|
||||
context: context,
|
||||
title: "是否进行解绑?",
|
||||
onConfirm: () {
|
||||
deviceListController
|
||||
.unbindDevice(data);
|
||||
// 执行解绑逻辑
|
||||
},
|
||||
onCancel: () {
|
||||
// 点击取消后的逻辑
|
||||
},
|
||||
);
|
||||
} else if (data['bind_type'] == 2) {
|
||||
// 删除弹窗
|
||||
showDeleteDeviceConfirmDialog(
|
||||
context: context,
|
||||
title: "是否进行删除?",
|
||||
onConfirm: () {
|
||||
deviceListController.unbindDevice(
|
||||
data,
|
||||
);
|
||||
},
|
||||
onCancel: () {
|
||||
// 点击取消后的逻辑
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -168,8 +208,13 @@ class BluetoothPage extends GetView {
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildMenuButton(BuildContext context, String title, String? path,
|
||||
{Map<dynamic, dynamic>? arguments}) {
|
||||
Widget _buildMenuButton(
|
||||
BuildContext context,
|
||||
String title,
|
||||
String? path, {
|
||||
Map<dynamic, dynamic>? arguments,
|
||||
VoidCallback? onTap,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 19.rpx),
|
||||
child: ClickableContainer(
|
||||
@@ -177,7 +222,21 @@ class BluetoothPage extends GetView {
|
||||
highlightColor: Color(0XFF055466),
|
||||
padding: EdgeInsets.only(left: 0),
|
||||
onTap: () {
|
||||
if (path?.isNotEmpty == true) {
|
||||
// if (path?.isNotEmpty == true) {
|
||||
// if (arguments != null) {
|
||||
// Get.toNamed(path!, arguments: arguments);
|
||||
// } else {
|
||||
// Get.toNamed(path!);
|
||||
// }
|
||||
// } else {
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "功能开发中...",
|
||||
// );
|
||||
// }
|
||||
if (onTap != null) {
|
||||
onTap(); // 优先执行自定义逻辑
|
||||
} else if (path?.isNotEmpty == true) {
|
||||
if (arguments != null) {
|
||||
Get.toNamed(path!, arguments: arguments);
|
||||
} else {
|
||||
|
||||
@@ -157,6 +157,8 @@ void showBindDoubleDialog(
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showUnBindDeviceDialog(BuildContext context) async {}
|
||||
|
||||
Future<void> showHaveBindDialog(BuildContext context) async {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
|
||||
@@ -163,13 +163,7 @@ class DeviceInfoWidget extends GetView {
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'设备状态:' +
|
||||
(deviceListController
|
||||
.model
|
||||
.deviceList[index]["status"]
|
||||
?["status"]
|
||||
?.toString() ??
|
||||
''),
|
||||
'设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFC8CBD2),
|
||||
@@ -239,7 +233,9 @@ class DeviceInfoWidget extends GetView {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await Get.toNamed("/deviceSharePage");
|
||||
await Get.toNamed("/deviceSharePage",
|
||||
arguments: deviceListController
|
||||
.model.deviceList[index]);
|
||||
// if (device['type'] == 1) {
|
||||
// globalController.model.deviceMain = device;
|
||||
// await Get.toNamed("/deviceSharePage");
|
||||
|
||||
@@ -146,13 +146,13 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
||||
...List.generate(controller.model.peopleList.length,
|
||||
(index) {
|
||||
final person = controller.model.peopleList[index];
|
||||
String location_ = '';
|
||||
if ("${data["bindMacB"]}".length > 6 &&
|
||||
(person["direction"] == 1 ||
|
||||
person["direction"] == 2)) {
|
||||
location_ =
|
||||
person["direction"] == 1 ? '左侧' : '右侧';
|
||||
}
|
||||
// String location_ = '';
|
||||
// if ("${data["bindMacB"]}".length > 6 &&
|
||||
// (person["direction"] == 1 ||
|
||||
// person["direction"] == 2)) {
|
||||
// location_ =
|
||||
// person["direction"] == 1 ? '左侧' : '右侧';
|
||||
// }
|
||||
|
||||
return ClickableContainer(
|
||||
backgroundColor: Color(0xFF003058),
|
||||
@@ -176,9 +176,8 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (location_.isNotEmpty)
|
||||
getInfoRow(context,
|
||||
"姓名:${person["name"] ?? "-"}"),
|
||||
getInfoRow(
|
||||
context, "姓名:${person["name"] ?? "-"}"),
|
||||
getInfoRow(context,
|
||||
"性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"),
|
||||
getInfoRow(context,
|
||||
|
||||
@@ -3,40 +3,34 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/EmptyMessageWidget.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/ShareUserWidget.dart';
|
||||
|
||||
class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
var data;
|
||||
ShareDeviceWidget({super.key, required this.data});
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
// ShareDeviceWidget() {
|
||||
// controller.initData();
|
||||
// scrollController.addListener(() {
|
||||
// if (scrollController.position.pixels ==
|
||||
// scrollController.position.maxScrollExtent &&
|
||||
// controller.model.hasMore) {
|
||||
// controller.initData();
|
||||
// controller.updateAll();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _phoneController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var deviceController = Get.find<GlobalController>();
|
||||
controller.model.msg = "";
|
||||
controller.model.show = 0;
|
||||
controller.model.code = 0;
|
||||
controller.model.type = 1;
|
||||
controller.model.account = '';
|
||||
return GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
@@ -122,7 +116,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'设备ID:${deviceController.model.deviceMain['mac']}',
|
||||
'设备ID:${data['mac']}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: const Color(0xFF6BFDAC),
|
||||
@@ -192,82 +186,12 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
color: Colors.white,
|
||||
fontSize: 36.rpx,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null ||
|
||||
value.isEmpty) {
|
||||
return '手机号不能为空';
|
||||
}
|
||||
final phoneReg =
|
||||
RegExp(r'^1[3-9]\d{9}$');
|
||||
if (!phoneReg.hasMatch(value)) {
|
||||
return '请输入正确的手机号';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: (value) {
|
||||
controller.model.phone = value;
|
||||
controller.model.account =
|
||||
value;
|
||||
},
|
||||
),
|
||||
)
|
||||
// TextFormField(
|
||||
// // controller: _model.textController,
|
||||
// // focusNode: _model.textFieldFocusNode,
|
||||
// // autofocus: true,
|
||||
// obscureText: false,
|
||||
// decoration: InputDecoration(
|
||||
// hintText: '请输入对方手机号',
|
||||
// hintStyle: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .labelMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color:
|
||||
// const Color(0xFFD2D2D2),
|
||||
// fontSize: 13,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// enabledBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Color(0xFFCCCCCC),
|
||||
// width: 1),
|
||||
// ),
|
||||
// focusedBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Color(0xFF929699),
|
||||
// width: 0),
|
||||
// ),
|
||||
// errorBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Colors.red, width: 1),
|
||||
// ),
|
||||
// focusedErrorBorder:
|
||||
// const UnderlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: Colors.redAccent,
|
||||
// width: 1.5),
|
||||
// ),
|
||||
// contentPadding:
|
||||
// const EdgeInsets.only(
|
||||
// left: 10, bottom: 5),
|
||||
// ),
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// fontSize: 13,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// onChanged: (value) {
|
||||
// controller.model.phone = value;
|
||||
// },
|
||||
// // validator: _model.textControllerValidator
|
||||
// // .asValidator(context),
|
||||
// ),
|
||||
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
@@ -292,117 +216,6 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
),
|
||||
),
|
||||
)),
|
||||
// Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
// constraints: const BoxConstraints(
|
||||
// minHeight: 46,
|
||||
// ),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(0),
|
||||
// ),
|
||||
// child: Align(
|
||||
// alignment:
|
||||
// const AlignmentDirectional(0, 0),
|
||||
// child: Obx(() {
|
||||
// if (controller.model.show == 0) {
|
||||
// return Container();
|
||||
// } else {
|
||||
// return GestureDetector(
|
||||
// onTap: controller
|
||||
// .model.msg!.isNotEmpty
|
||||
// ? () {
|
||||
// Clipboard.setData(
|
||||
// ClipboardData(
|
||||
// text: CommonVariables
|
||||
// .shareText));
|
||||
// showToast(
|
||||
// "复制成功,粘贴分享APP下载链接!",
|
||||
// color: color_success);
|
||||
// }
|
||||
// : null, // 不可点击时设置为 null
|
||||
// child: RichText(
|
||||
// textAlign: TextAlign
|
||||
// .center, // 设置整个 RichText 内容居中
|
||||
// text: TextSpan(
|
||||
// children:
|
||||
// controller.model.msg!
|
||||
// .isNotEmpty
|
||||
// ? [
|
||||
// TextSpan(
|
||||
// text: controller
|
||||
// .model
|
||||
// .msg! +
|
||||
// "!", // 第一部分文本
|
||||
// style: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color: const Color(
|
||||
// 0xFFE55E92), // 设置为粉红色
|
||||
// fontSize:
|
||||
// 26.rpx,
|
||||
// letterSpacing:
|
||||
// 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// const TextSpan(
|
||||
// text:
|
||||
// '\n', // 添加换行
|
||||
// ),
|
||||
// WidgetSpan(
|
||||
// child: SizedBox(
|
||||
// height: 20
|
||||
// .rpx), // 添加间距
|
||||
// ),
|
||||
// TextSpan(
|
||||
// text:
|
||||
// '点击复制APP下载链接', // 第二部分文本
|
||||
// style: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color: const Color(
|
||||
// 0xFF1890FF), // 设置为蓝色
|
||||
// fontSize:
|
||||
// 20.rpx,
|
||||
// letterSpacing:
|
||||
// 0.0,
|
||||
// decoration:
|
||||
// TextDecoration
|
||||
// .underline, // 添加下划线
|
||||
// ),
|
||||
// ),
|
||||
// ]
|
||||
// : [
|
||||
// TextSpan(
|
||||
// text:
|
||||
// '发送成功!', // 当 msg 为空时显示的文本
|
||||
// style: FlutterFlowTheme.of(
|
||||
// context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily:
|
||||
// 'Readex Pro',
|
||||
// color: const Color(
|
||||
// 0xFF07C160), // 设置为绿色
|
||||
// fontSize:
|
||||
// 20.rpx,
|
||||
// letterSpacing:
|
||||
// 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// })),
|
||||
// ),
|
||||
|
||||
Obx(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
@@ -534,16 +347,19 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
//todo 1:验证用户是否存在 2:发送邀请
|
||||
// controller.model.show = 1;
|
||||
// String msg =
|
||||
// await controller.sendInvite(
|
||||
// controller.model.phone,
|
||||
// deviceController
|
||||
// .model.deviceMain['mac']);
|
||||
// if (msg != null && msg.isNotEmpty) {
|
||||
// controller.model.msg = msg;
|
||||
// }
|
||||
// controller.updateAll();
|
||||
ApiResponse apiResponse =
|
||||
await controller
|
||||
.shareDevice(data['mac']);
|
||||
if (apiResponse.code ==
|
||||
HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!);
|
||||
} else {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
}
|
||||
},
|
||||
text: '发送邀请',
|
||||
options: FFButtonOptions(
|
||||
@@ -617,10 +433,11 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
// .bodyMedium, // 可根据需要自定义样式
|
||||
// ),
|
||||
// );
|
||||
return EmptyMessageWidget(
|
||||
imagePath:
|
||||
"assets/images/emptyUser.png",
|
||||
);
|
||||
return NullDataWidget();
|
||||
// EmptyMessageWidget(
|
||||
// imagePath:
|
||||
// "assets/images/emptyUser.png",
|
||||
// );
|
||||
}
|
||||
|
||||
// 否则显示正常的 ListView
|
||||
|
||||
@@ -14,123 +14,195 @@ class HelpArticle extends StatelessWidget {
|
||||
|
||||
var isLike = 0.obs;
|
||||
|
||||
@override
|
||||
// @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: ""),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
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,
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF042C46),
|
||||
appBar: AppBar(
|
||||
backgroundColor: const Color(0xFF042C46),
|
||||
title: Text("问题与帮助", style: TextStyle(color: Colors.white)),
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
article['title'],
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
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: ""),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: InAppWebView(
|
||||
initialData: InAppWebViewInitialData(
|
||||
data: wrapHtml(article['content']),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 包装成完整 HTML 页面,添加适配样式
|
||||
String wrapHtml(String htmlContent) {
|
||||
return """
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
body {
|
||||
color: #FFFFFF;
|
||||
background-color: #042C46;
|
||||
font-family: sans-serif;
|
||||
padding: 16px;
|
||||
font-size: 16px;
|
||||
}
|
||||
p, li {
|
||||
line-height: 1.6;
|
||||
}
|
||||
ol {
|
||||
padding-left: 20px;
|
||||
}
|
||||
strong {
|
||||
color: #6BFDAC;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
$htmlContent
|
||||
</body>
|
||||
</html>
|
||||
""";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ class IssuePreviewWidget extends GetView<IssuePreviewInfoController> {
|
||||
// await Future.delayed(Duration(milliseconds: 100));
|
||||
// issueListController.model.selectedIndex = -1;
|
||||
// issueListController.updateAll();
|
||||
// var article = issueListController.model.issueList![index];
|
||||
// Get.toNamed("/helpArticle", arguments: article);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "功能开发中...",
|
||||
);
|
||||
var article = issueListController.model.issueList![index];
|
||||
Get.toNamed("/helpArticle", arguments: article);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "功能开发中...",
|
||||
// );
|
||||
},
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
|
||||
@@ -250,7 +250,7 @@ class _MinePageState extends State<NewMinePage> {
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'我的智能床',
|
||||
'我的智能设备'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx, color: const Color(0xFF003058)),
|
||||
),
|
||||
|
||||
@@ -117,6 +117,9 @@ class SearchWidget extends GetView {
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
onChanged: (d) {
|
||||
onChange?.call(d);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -125,29 +128,33 @@ class SearchWidget extends GetView {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30.rpx,
|
||||
child: VerticalDivider(
|
||||
thickness: 2.rpx,
|
||||
color: stringToColor("#333333"), //固定
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
findCallback?.call();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30.rpx,
|
||||
child: VerticalDivider(
|
||||
thickness: 2.rpx,
|
||||
color: stringToColor("#333333"), //固定
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'搜索'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#333333"), //固定
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 26.rpx)),
|
||||
),
|
||||
Text(
|
||||
'搜索'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#333333"), //固定
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 26.rpx)),
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user