更新消息设置
This commit is contained in:
@@ -56,6 +56,66 @@ getOnePicker(BuildContext context, List arr, int checkIndex,
|
||||
);
|
||||
}
|
||||
|
||||
// Widget getOnePickers(
|
||||
// BuildContext context,
|
||||
// List arr,
|
||||
// RxInt selectedIndex, {
|
||||
// String unit = '',
|
||||
// bool looping = false,
|
||||
// void Function(int)? onChanged,
|
||||
// bool isMonthName = false,
|
||||
// Key? pickerKey,
|
||||
// }) {
|
||||
// ThemeController themeController = Get.find();
|
||||
// final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
|
||||
|
||||
// return Obx(() {
|
||||
// final dynamicKey = ValueKey('picker_${arr.length}_${selectedIndex.value}');
|
||||
// return CupertinoPicker.builder(
|
||||
// key: pickerKey ?? dynamicKey,
|
||||
// itemExtent: 90.rpx,
|
||||
// useMagnifier: false,
|
||||
// magnification: 1,
|
||||
// diameterRatio: 1.3,
|
||||
// squeeze: 1,
|
||||
// scrollController:
|
||||
// FixedExtentScrollController(initialItem: selectedIndex.value),
|
||||
// selectionOverlay: Container(),
|
||||
// onSelectedItemChanged: (int index) {
|
||||
// selectedIndex.value = index;
|
||||
// if (onChanged != null) onChanged(index);
|
||||
// },
|
||||
// childCount: arr.length,
|
||||
// itemBuilder: (context, index) {
|
||||
// bool isSelected = index == selectedIndex.value;
|
||||
|
||||
// // 处理显示文本
|
||||
// String displayText;
|
||||
// if (isMonthName && isEn && arr[index] is int) {
|
||||
// displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
|
||||
// } else {
|
||||
// // displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位
|
||||
// displayText = "${arr[index]}$unit"; // 中文附带单位
|
||||
// }
|
||||
|
||||
// return Center(
|
||||
// child: Text(
|
||||
// displayText,
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: isSelected
|
||||
// ? themeController.currentColor.sc3
|
||||
// : const Color(0xFF9AA0B3),
|
||||
// fontSize: 30.rpx,
|
||||
// fontWeight: FontWeight.normal,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
|
||||
Widget getOnePickers(
|
||||
BuildContext context,
|
||||
List arr,
|
||||
@@ -65,6 +125,9 @@ Widget getOnePickers(
|
||||
void Function(int)? onChanged,
|
||||
bool isMonthName = false,
|
||||
Key? pickerKey,
|
||||
|
||||
/// ⭐ 新增:可选的自定义显示,但不影响旧用法
|
||||
String Function(dynamic value)? customDisplay,
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
|
||||
@@ -89,13 +152,26 @@ Widget getOnePickers(
|
||||
itemBuilder: (context, index) {
|
||||
bool isSelected = index == selectedIndex.value;
|
||||
|
||||
// 处理显示文本
|
||||
String displayText;
|
||||
if (isMonthName && isEn && arr[index] is int) {
|
||||
displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
|
||||
} else {
|
||||
// displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位
|
||||
displayText = "${arr[index]}$unit"; // 中文附带单位
|
||||
String value = arr[index].toString();
|
||||
String displayText = "";
|
||||
|
||||
// ⭐ 1. 优先使用自定义展示
|
||||
if (customDisplay != null) {
|
||||
String? custom = customDisplay(arr[index]);
|
||||
if (custom != null && custom.isNotEmpty) {
|
||||
displayText = custom;
|
||||
}
|
||||
}
|
||||
|
||||
// ⭐ 2. 若自定义没给或返回空,则使用你原本的逻辑
|
||||
if (displayText.isEmpty) {
|
||||
if (isMonthName && isEn && arr[index] is int) {
|
||||
// 英文月份
|
||||
displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
|
||||
} else {
|
||||
// 中文 + 单位(你原来的逻辑)
|
||||
displayText = "$value$unit";
|
||||
}
|
||||
}
|
||||
|
||||
return Center(
|
||||
@@ -1839,3 +1915,165 @@ DialogColorScheme _getDialogColors(int entType) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future showTHDayTimeSelectionDialog(
|
||||
BuildContext context, {
|
||||
required List<int> dayTimeArr,
|
||||
Function(List<int>)? checkChange,
|
||||
String title = "选择时间",
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
final List<int> hours = List.generate(24, (i) => i);
|
||||
final List<int> minutes = List.generate(60, (i) => i);
|
||||
|
||||
final RxInt hoursIndex = hours.indexOf(dayTimeArr[0]).obs;
|
||||
final RxInt minutesIndex = minutes.indexOf(dayTimeArr[1]).obs;
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: themeController.currentColor.sc17, // 修改:使用主题颜色
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
// 顶部栏:取消 - 标题 - 确定
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
color: themeController.currentColor.sc5, // 修改:使用主题颜色
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"取消".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white, // 保持不变
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor.sc3, // 修改:使用主题颜色
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () {
|
||||
checkChange?.call([
|
||||
hours[hoursIndex.value],
|
||||
minutes[minutesIndex.value],
|
||||
]);
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"确定".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc2, // 修改:使用主题颜色
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.rpx),
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 90.rpx,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController
|
||||
.currentColor.sc2, // 修改:使用主题颜色
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: getOnePickers(
|
||||
context,
|
||||
hours,
|
||||
hoursIndex,
|
||||
unit: "时".tr,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: getOnePickers(
|
||||
context,
|
||||
minutes,
|
||||
minutesIndex,
|
||||
unit: "分".tr,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -188,10 +188,9 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
final targetPosition = index * (itemHeight + spacing);
|
||||
|
||||
// 根据当前类型选择对应的ScrollController
|
||||
final currentScrollController =
|
||||
bodyDeviceController.model.type == 1
|
||||
? _myDeviceScrollController
|
||||
: _cloudDeviceScrollController;
|
||||
final currentScrollController = bodyDeviceController.model.type == 1
|
||||
? _myDeviceScrollController
|
||||
: _cloudDeviceScrollController;
|
||||
|
||||
if (currentScrollController.hasClients) {
|
||||
currentScrollController.animateTo(
|
||||
@@ -619,8 +618,11 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
children: [
|
||||
// 我的e护页面
|
||||
Obx(() {
|
||||
final myDeviceList = bodyDeviceController.deviceList.value
|
||||
.where((device) => device['type'] == 1 || device['bind_type'] == 1)
|
||||
final myDeviceList = bodyDeviceController
|
||||
.deviceList.value
|
||||
.where((device) =>
|
||||
device['type'] == 1 ||
|
||||
device['bind_type'] == 1)
|
||||
.toList();
|
||||
return myDeviceList.isEmpty
|
||||
? NullDataWidget()
|
||||
@@ -643,8 +645,11 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
}),
|
||||
// 云关爱页面
|
||||
Obx(() {
|
||||
final cloudDeviceList = bodyDeviceController.deviceList.value
|
||||
.where((device) => device['type'] == 2 || device['bind_type'] == 2)
|
||||
final cloudDeviceList = bodyDeviceController
|
||||
.deviceList.value
|
||||
.where((device) =>
|
||||
device['type'] == 2 ||
|
||||
device['bind_type'] == 2)
|
||||
.toList();
|
||||
return cloudDeviceList.isEmpty
|
||||
? NullDataWidget()
|
||||
@@ -652,7 +657,8 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 26.rpx, 30.rpx, 0),
|
||||
child: SingleChildScrollView(
|
||||
controller: _cloudDeviceScrollController,
|
||||
controller:
|
||||
_cloudDeviceScrollController,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: cloudDeviceList
|
||||
@@ -724,4 +730,4 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
256
lib/pages/device/component/MessageTypeComponent.dart
Normal file
256
lib/pages/device/component/MessageTypeComponent.dart
Normal file
@@ -0,0 +1,256 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class MessageTypeComponent extends StatelessWidget {
|
||||
final Map<String, dynamic> config;
|
||||
|
||||
const MessageTypeComponent({Key? key, required this.config}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String name = config['name'] ?? '未命名';
|
||||
final String type = config['type'] ?? 'unknown';
|
||||
final List<dynamic> dataList = config['data'] ?? [];
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(12.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
blurRadius: 8.0,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 标题栏
|
||||
_buildHeader(name, type),
|
||||
|
||||
// 分隔线
|
||||
const Divider(height: 1, color: Color(0xFFEEEEEE)),
|
||||
|
||||
// 数据列表
|
||||
_buildDataList(dataList),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 构建标题栏
|
||||
Widget _buildHeader(String name, String type) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0),
|
||||
decoration: BoxDecoration(
|
||||
color: _getTypeColor(type),
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
child: Text(
|
||||
_getTypeText(type),
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 构建数据列表
|
||||
Widget _buildDataList(List<dynamic> dataList) {
|
||||
if (dataList.isEmpty) {
|
||||
return const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'暂无数据',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
itemCount: dataList.length,
|
||||
separatorBuilder: (context, index) => const Divider(
|
||||
height: 1,
|
||||
indent: 16.0,
|
||||
endIndent: 16.0,
|
||||
color: Color(0xFFF5F5F5),
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final Map<String, dynamic> item = dataList[index];
|
||||
return _buildDataItem(item);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 构建单个数据项
|
||||
Widget _buildDataItem(Map<String, dynamic> item) {
|
||||
final String itemName = item['name']?.toString() ?? '未知';
|
||||
final int? id = item['id'];
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// ID 标签
|
||||
if (id != null)
|
||||
Container(
|
||||
width: 24.0,
|
||||
height: 24.0,
|
||||
alignment: Alignment.center,
|
||||
margin: const EdgeInsets.only(right: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFE8F4FF),
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
child: Text(
|
||||
id.toString().substring(id.toString().length - 2),
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Color(0xFF1890FF),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 数据内容
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
itemName,
|
||||
style: const TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 4.0),
|
||||
|
||||
// 动态显示其他字段
|
||||
..._buildExtraFields(item),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 构建额外字段显示
|
||||
List<Widget> _buildExtraFields(Map<String, dynamic> item) {
|
||||
final List<Widget> fields = [];
|
||||
|
||||
// 遍历所有字段,排除已经显示的 id 和 name
|
||||
item.forEach((key, value) {
|
||||
if (key != 'id' && key != 'name' && value != null) {
|
||||
final String displayKey = _getDisplayKey(key);
|
||||
final String displayValue = _formatValue(value);
|
||||
|
||||
fields.add(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2.0),
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '$displayKey:',
|
||||
style: const TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Color(0xFF666666),
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: displayValue,
|
||||
style: const TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Color(0xFF1890FF),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
// 获取显示用的键名
|
||||
String _getDisplayKey(String key) {
|
||||
final Map<String, String> keyMap = {
|
||||
'min': '最小值',
|
||||
'max': '最大值',
|
||||
'interval': '间隔(秒)',
|
||||
'duration': '持续时间(秒)',
|
||||
'time': '时间',
|
||||
};
|
||||
|
||||
return keyMap[key] ?? key;
|
||||
}
|
||||
|
||||
// 格式化值显示
|
||||
String _formatValue(dynamic value) {
|
||||
if (value is int) {
|
||||
// 如果是时间相关的秒数,转换为分钟显示
|
||||
if (value >= 60) {
|
||||
return '${value ~/ 60}分钟${value % 60 != 0 ? '${value % 60}秒' : ''}';
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
// 根据类型获取颜色
|
||||
Color _getTypeColor(String type) {
|
||||
switch (type) {
|
||||
case 'instant':
|
||||
return const Color(0xFF52C41A);
|
||||
case 'sleep':
|
||||
return const Color(0xFF1890FF);
|
||||
default:
|
||||
return Colors.grey;
|
||||
}
|
||||
}
|
||||
|
||||
// 根据类型获取显示文本
|
||||
String _getTypeText(String type) {
|
||||
switch (type) {
|
||||
case 'instant':
|
||||
return '实时';
|
||||
case 'sleep':
|
||||
return '睡眠';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
}
|
||||
1251
lib/pages/device/component/SingleMessageSetting.dart
Normal file
1251
lib/pages/device/component/SingleMessageSetting.dart
Normal file
File diff suppressed because it is too large
Load Diff
1413
lib/pages/device/component/messageTool.dart
Normal file
1413
lib/pages/device/component/messageTool.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1145,4 +1145,5 @@ class _AfterWifiPagePersonState extends State<AfterWifiPagePerson> {
|
||||
onFailure: (res) {},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1001,132 +1001,400 @@ Future<void> showTipDialog(
|
||||
);
|
||||
}
|
||||
|
||||
// Future<void> showUnBindTipDialog(
|
||||
// BuildContext context,
|
||||
// Widget widget, {
|
||||
// Color? backgroundColor,
|
||||
// VoidCallback? onConfirm, // “继续”按钮回调
|
||||
// VoidCallback? onCancel, // “下次再说”按钮回调
|
||||
// VoidCallback? onNoTip, // “下次再说”按钮回调
|
||||
// }) {
|
||||
// ThemeController themeController = Get.find();
|
||||
// BlueteethBindController blueteethBindController = Get.find();
|
||||
|
||||
// return showDialog(
|
||||
// context: context,
|
||||
// barrierDismissible: true,
|
||||
// barrierColor: Colors.black.withOpacity(0.5),
|
||||
// builder: (BuildContext context) {
|
||||
// return FrostedDialog(
|
||||
// blurSigma: 3.0,
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: backgroundColor ?? themeController.currentColor.sc17,
|
||||
// borderRadius: BorderRadius.circular(20.0),
|
||||
// ),
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.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, 30.rpx),
|
||||
// child: widget,
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
||||
// child: CustomCard(
|
||||
// borderRadius: AppConstants().button_container_radius,
|
||||
// onTap: () {
|
||||
// Get.back(); // 关闭对话框
|
||||
// if (onConfirm != null) {
|
||||
// onConfirm(); // 调用确认回调
|
||||
// }
|
||||
// },
|
||||
// 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: TextStyle(
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: AppConstants().normal_text_fontSize,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(width: 17.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||||
// child: CustomCard(
|
||||
// borderRadius: AppConstants().button_container_radius,
|
||||
// onTap: () {
|
||||
// Get.back(); // 关闭对话框
|
||||
// if (onCancel != null) {
|
||||
// onCancel(); // 调用取消回调
|
||||
// }
|
||||
// },
|
||||
// colors: [Colors.transparent],
|
||||
// child: Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
// height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(
|
||||
// color: Colors.white,
|
||||
// width: 0.5.rpx,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(
|
||||
// AppConstants().button_container_radius),
|
||||
// ),
|
||||
// constraints: BoxConstraints(
|
||||
// minWidth: 500.rpx,
|
||||
// minHeight: 90.rpx,
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// '下次再说'.tr,
|
||||
// style: TextStyle(
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: AppConstants().normal_text_fontSize,
|
||||
// letterSpacing: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(width: 17.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.fromLTRB(0, 0, 0, 30.rpx),
|
||||
// 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),
|
||||
// ),
|
||||
// child: Obx(
|
||||
// () => Checkbox(
|
||||
// value:
|
||||
// blueteethBindController.model.read ==
|
||||
// 1
|
||||
// ? false
|
||||
// : true,
|
||||
// onChanged: (newValue) async {
|
||||
// blueteethBindController.model.read =
|
||||
// newValue == true ? 0 : 1;
|
||||
// blueteethBindController.updateAll();
|
||||
// },
|
||||
// side: BorderSide(
|
||||
// width: 1.5,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// activeColor: stringToColor("#16C89F"),
|
||||
// ),
|
||||
// )),
|
||||
// Text(
|
||||
// '绑定引导.不再提示'.tr,
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 26.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(width: 22.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(height: 42.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Future<void> showUnBindTipDialog(
|
||||
BuildContext context,
|
||||
Widget widget, {
|
||||
Color? backgroundColor,
|
||||
VoidCallback? onConfirm, // “继续”按钮回调
|
||||
VoidCallback? onCancel, // “下次再说”按钮回调
|
||||
bool initialNoTipValue = false, // 初始的"不再提示"值,从外部传入
|
||||
ValueChanged<bool>? onNoTipChanged, // "不再提示"值变化时的回调
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
// 移除原来的控制器依赖,使用传入的初始值
|
||||
// BlueteethBindController blueteethBindController = Get.find();
|
||||
|
||||
// 使用局部状态管理不再提示的值
|
||||
bool noTipValue = initialNoTipValue;
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
barrierColor: Colors.black.withOpacity(0.5),
|
||||
builder: (BuildContext context) {
|
||||
return FrostedDialog(
|
||||
blurSigma: 3.0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? themeController.currentColor.sc17,
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.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, 30.rpx),
|
||||
child: widget,
|
||||
),
|
||||
// 使用StatefulBuilder来管理局部状态
|
||||
return StatefulBuilder(
|
||||
builder: (context, setState) {
|
||||
return FrostedDialog(
|
||||
blurSigma: 3.0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? themeController.currentColor.sc17,
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () {
|
||||
Get.back(); // 关闭对话框
|
||||
if (onConfirm != null) {
|
||||
onConfirm(); // 调用确认回调
|
||||
}
|
||||
},
|
||||
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: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 93.rpx, 0, 30.rpx),
|
||||
child: widget,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () {
|
||||
Get.back(); // 关闭对话框
|
||||
if (onCancel != null) {
|
||||
onCancel(); // 调用取消回调
|
||||
}
|
||||
},
|
||||
colors: [Colors.transparent],
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 0.5.rpx,
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () {
|
||||
Get.back(); // 关闭对话框
|
||||
if (onConfirm != null) {
|
||||
onConfirm(); // 调用确认回调
|
||||
}
|
||||
},
|
||||
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: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().button_container_radius),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'下次再说'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () {
|
||||
Get.back(); // 关闭对话框
|
||||
if (onCancel != null) {
|
||||
onCancel(); // 调用取消回调
|
||||
}
|
||||
},
|
||||
colors: [Colors.transparent],
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 0.5.rpx,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().button_container_radius),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 500.rpx,
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'下次再说'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 17.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 0, 0, 30.rpx),
|
||||
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),
|
||||
),
|
||||
child: Checkbox(
|
||||
value: noTipValue,
|
||||
onChanged: (newValue) {
|
||||
if (newValue != null) {
|
||||
setState(() {
|
||||
noTipValue = newValue;
|
||||
});
|
||||
|
||||
// 回调新的值给外部
|
||||
if (onNoTipChanged != null) {
|
||||
onNoTipChanged(noTipValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
side: BorderSide(
|
||||
width: 1.5,
|
||||
color: Colors.white,
|
||||
),
|
||||
activeColor: stringToColor("#16C89F"),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'绑定引导.不再提示'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 42.rpx)),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -43,6 +43,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
void dispose() {
|
||||
_tapRecognizer2.dispose();
|
||||
_tapRecognizer4.dispose();
|
||||
loginController.fluwxCancelable?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -104,7 +105,9 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
loginController.fluwxCancelable?.cancel();
|
||||
// 登录成功移出网络检查监听
|
||||
Checknetwork.subscription?.cancel();
|
||||
Get.offAndToNamed("/mianPageBottomChange");
|
||||
if (Get.currentRoute != '/mianPageBottomChange') {
|
||||
Get.offAndToNamed("/mianPageBottomChange");
|
||||
}
|
||||
}
|
||||
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
||||
// fluwxCancelable?.cancel();
|
||||
@@ -119,6 +122,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -625,6 +629,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0),
|
||||
|
||||
@@ -64,6 +64,20 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
|
||||
),
|
||||
Positioned(
|
||||
left: 0.rpx,
|
||||
// child: returnIconButtomNew(onBack: () {
|
||||
// UserInfoController userInfoController = Get.find();
|
||||
// ApiResponse apiResponse = userInfoController.logOut();
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: apiResponse.msg!,
|
||||
// textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
// ? themeController.currentColor.sc2
|
||||
// : themeController.currentColor.sc9,
|
||||
// );
|
||||
// if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
// Get.offAllNamed("/mianPageBottomChange");
|
||||
// }
|
||||
// }),
|
||||
child: returnIconButtomNew(),
|
||||
),
|
||||
],
|
||||
@@ -163,6 +177,43 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0, 0, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
// constraints: BoxConstraints(
|
||||
// minWidth: 150.rpx,
|
||||
// ),
|
||||
child: Text(
|
||||
"+86",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
fontSize: AppConstants()
|
||||
.middler_text_fontSize,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.rpx,
|
||||
child: VerticalDivider(
|
||||
thickness: 2.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 10.rpx)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment:
|
||||
|
||||
@@ -135,12 +135,14 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
||||
Widget _buildLoggedInContent() {
|
||||
return Obx(() {
|
||||
if (finalUri.isEmpty) {
|
||||
return Center(child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
),);
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 如果设备列表为空
|
||||
@@ -166,7 +168,9 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
||||
return Stack(
|
||||
children: [
|
||||
InAppWebView(
|
||||
initialUrlRequest: URLRequest(url: WebUri(finalUri.value+"?t=${DateTime.now().millisecondsSinceEpoch}")),
|
||||
initialUrlRequest: URLRequest(
|
||||
url: WebUri(finalUri.value +
|
||||
"?t=${DateTime.now().millisecondsSinceEpoch}")),
|
||||
onLoadStart: (controller, url) {
|
||||
isPageLoading.value = true;
|
||||
},
|
||||
@@ -178,12 +182,14 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
||||
valueListenable: isPageLoading,
|
||||
builder: (context, isLoading, child) {
|
||||
return isLoading
|
||||
? Center(child:CircularProgressIndicator(
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
),)
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
@@ -212,55 +218,127 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
||||
}
|
||||
|
||||
Future<void> getDeviceList() async {
|
||||
BodyDeviceController bodyDeviceController = Get.find();
|
||||
ApiResponse apiResponse = await bodyDeviceController.getDeviceList();
|
||||
try {
|
||||
BodyDeviceController bodyDeviceController = Get.find();
|
||||
ApiResponse apiResponse =
|
||||
await bodyDeviceController.getDeviceList(isAllDevice: true);
|
||||
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
List<dynamic> rawList = apiResponse.data;
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
List<dynamic> rawList = apiResponse.data;
|
||||
|
||||
// 提取 mac 和 person.name
|
||||
List<Map<String, dynamic>> newList = rawList.map((item) {
|
||||
String mac = item['mac'] ?? '';
|
||||
String name = (item['person'] != null &&
|
||||
item['person']['name'] != null &&
|
||||
item['person']['name'].toString().trim().isNotEmpty)
|
||||
? item['person']['name'] + "_${mac}"
|
||||
: '未命名'.tr + "_${mac}";
|
||||
return {
|
||||
'mac': mac,
|
||||
'name': name,
|
||||
};
|
||||
}).toList();
|
||||
// 提取 mac 和 person.name
|
||||
List<Map<String, dynamic>> newList = rawList.map((item) {
|
||||
String mac = item['mac'] ?? '';
|
||||
String name = (item['person'] != null &&
|
||||
item['person']['name'] != null &&
|
||||
item['person']['name'].toString().trim().isNotEmpty)
|
||||
? item['person']['name'] + "_${mac}"
|
||||
: '未命名'.tr + "_${mac}";
|
||||
return {
|
||||
'mac': mac,
|
||||
'name': name,
|
||||
};
|
||||
}).toList();
|
||||
|
||||
deviceList.value = newList;
|
||||
deviceList.value = newList;
|
||||
|
||||
// 拼接参数 person
|
||||
if (deviceList.isNotEmpty) {
|
||||
// JSON 编码整个 deviceList 对象数组
|
||||
String personParam = Uri.encodeComponent(jsonEncode(deviceList));
|
||||
finalUri.value = "${widget.sleepUri}?person=$personParam";
|
||||
// 拼接参数 person
|
||||
if (deviceList.isNotEmpty) {
|
||||
// JSON 编码整个 deviceList 对象数组
|
||||
String personParam = Uri.encodeComponent(jsonEncode(deviceList));
|
||||
finalUri.value = "${widget.sleepUri}?person=$personParam";
|
||||
} else {
|
||||
finalUri.value = widget.sleepUri;
|
||||
}
|
||||
}
|
||||
String? language = "";
|
||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
} else {
|
||||
finalUri.value = widget.sleepUri;
|
||||
if (languageController.selectLanguage != null) {
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
String? language = "";
|
||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
} else {
|
||||
if (languageController.selectLanguage != null) {
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
}
|
||||
|
||||
if (language != null && language.isNotEmpty) {
|
||||
if (finalUri.value.contains("?")) {
|
||||
finalUri.value += "&lang=$language";
|
||||
} else {
|
||||
finalUri.value += "?lang=$language";
|
||||
if (language != null && language.isNotEmpty) {
|
||||
if (finalUri.value.contains("?")) {
|
||||
finalUri.value += "&lang=$language";
|
||||
} else {
|
||||
finalUri.value += "?lang=$language";
|
||||
}
|
||||
}
|
||||
ef.log("msg");
|
||||
} catch (e) {
|
||||
ef.log(e.toString());
|
||||
}
|
||||
ef.log("msg");
|
||||
}
|
||||
|
||||
// Future<void> getDeviceList() async {
|
||||
// try {
|
||||
// BodyDeviceController bodyDeviceController = Get.find();
|
||||
// ApiResponse apiResponse =
|
||||
// await bodyDeviceController.getDeviceList(isAllDevice: true);
|
||||
|
||||
// // 调试:打印返回的数据结构
|
||||
// print('API响应数据: $apiResponse');
|
||||
// print('API响应数据类型: ${apiResponse.data.runtimeType}');
|
||||
// print('API响应数据内容: ${apiResponse.data}');
|
||||
|
||||
// if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
// List<dynamic> rawList = apiResponse.data;
|
||||
|
||||
// // 调试:检查 rawList 的类型和内容
|
||||
// print('rawList 类型: ${rawList.runtimeType}');
|
||||
// print('rawList 长度: ${rawList.length}');
|
||||
// if (rawList.isNotEmpty) {
|
||||
// print('rawList[0] 类型: ${rawList[0].runtimeType}');
|
||||
// print('rawList[0] 内容: ${rawList[0]}');
|
||||
// }
|
||||
|
||||
// // 安全处理:确保每个元素都是 Map
|
||||
// List<Map<String, dynamic>> newList =
|
||||
// rawList.whereType<Map>().map((item) {
|
||||
// // 调试每个 item
|
||||
// print('处理 item: $item');
|
||||
// print('item 类型: ${item.runtimeType}');
|
||||
|
||||
// String mac = (item['mac'] ?? '').toString();
|
||||
// String name = '未命名'.tr + "_${mac}";
|
||||
|
||||
// if (item['person'] != null && item['person'] is Map) {
|
||||
// var person = item['person'] as Map;
|
||||
// if (person['name'] != null &&
|
||||
// person['name'].toString().trim().isNotEmpty) {
|
||||
// name = '${person['name']}_${mac}';
|
||||
// }
|
||||
// }
|
||||
|
||||
// return {
|
||||
// 'mac': mac,
|
||||
// 'name': name,
|
||||
// };
|
||||
// }).toList();
|
||||
|
||||
// deviceList.value = newList;
|
||||
|
||||
// // 拼接参数 person
|
||||
// if (deviceList.isNotEmpty) {
|
||||
// // JSON 编码整个 deviceList 对象数组
|
||||
// String personParam = Uri.encodeComponent(jsonEncode(deviceList));
|
||||
// finalUri.value = "${widget.sleepUri}?person=$personParam";
|
||||
// } else {
|
||||
// finalUri.value = widget.sleepUri;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // ... 后续语言处理代码不变
|
||||
// } catch (e) {
|
||||
// print('getDeviceList 错误详情: $e');
|
||||
// print('错误堆栈: ${e}');
|
||||
// ef.log(e.toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -1106,7 +1106,6 @@ class _HomePageState extends State<HomePage> {
|
||||
if (currentIndex >= device_bind_process.length) return;
|
||||
|
||||
String code = device_bind_process[currentIndex]['mac'];
|
||||
|
||||
showUnBindTipDialog(
|
||||
context,
|
||||
Column(
|
||||
@@ -1145,6 +1144,7 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
textAlign: TextAlign.center, // 添加这一行
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1208,6 +1208,12 @@ class _HomePageState extends State<HomePage> {
|
||||
device_bind_process.removeAt(currentIndex);
|
||||
showNextDialog();
|
||||
},
|
||||
onNoTipChanged: (value) {
|
||||
updateDeviceTipStatus(
|
||||
code, device_bind_process[currentIndex], value);
|
||||
// device_bind_process.removeAt(currentIndex);
|
||||
// showNextDialog();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1252,9 +1258,11 @@ class _HomePageState extends State<HomePage> {
|
||||
bool celibration = res.data['celibration'];
|
||||
bool person_info = res.data['person_info'];
|
||||
bool wifi = res.data['wifi'];
|
||||
if (!celibration || !person_info || !wifi) {
|
||||
res.data['device_info'] = element;
|
||||
userInfoController.device_bind_status.add(res.data);
|
||||
if (res.data['noTip'] == null || res.data['noTip'] == false) {
|
||||
if (!celibration || !person_info || !wifi) {
|
||||
res.data['device_info'] = element;
|
||||
userInfoController.device_bind_status.add(res.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -1267,4 +1275,43 @@ class _HomePageState extends State<HomePage> {
|
||||
print("查询设备绑定列表失败: $e");
|
||||
}
|
||||
}
|
||||
|
||||
void updateDeviceTipStatus(String mac, Map config, bool noTip) {
|
||||
try {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_setting;
|
||||
String type = "device_bind_status_$mac";
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
|
||||
requestWithLog(
|
||||
logTitle: "查询绑定流程",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
Map<String, dynamic> data = {
|
||||
"type": type,
|
||||
"mac": mac,
|
||||
"wifi": res.data['wifi'],
|
||||
"celibration": res.data['celibration'],
|
||||
"person_info": res.data['person_info'],
|
||||
"noTip": noTip,
|
||||
"time": DateTime.now().millisecondsSinceEpoch,
|
||||
};
|
||||
requestWithLog(
|
||||
logTitle: "更新绑定流程",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {},
|
||||
onFailure: (res) {},
|
||||
);
|
||||
},
|
||||
onFailure: (res) {},
|
||||
);
|
||||
} catch (e) {
|
||||
ef.log("$e");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class _MessagePageState extends State<MessagePage> {
|
||||
|
||||
// 监听切换语言
|
||||
subscription = EventBus().on<SwitchLanguageEvent>().listen((event) {
|
||||
ef.log("切换语言事件通知:${event.language}");
|
||||
ef.log("切换语言事件通知:${event.language}");
|
||||
_fetchMessageData();
|
||||
});
|
||||
_fetchMessageData();
|
||||
@@ -255,7 +255,7 @@ class _MessagePageState extends State<MessagePage> {
|
||||
10.rpx, // 动态设置左侧位置
|
||||
child: Container(
|
||||
width: lineWidth,
|
||||
height: 4.rpx,
|
||||
height: 5.rpx,
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc2,
|
||||
borderRadius:
|
||||
|
||||
@@ -208,17 +208,17 @@ class _MinePageState extends State<MinePage> {
|
||||
final user =
|
||||
userInfoController
|
||||
.model.user!;
|
||||
if (user.email != null &&
|
||||
user.email!
|
||||
.isNotEmpty) {
|
||||
return user.email!;
|
||||
} else if (user.phone !=
|
||||
null &&
|
||||
if (user.phone != null &&
|
||||
user.phone!
|
||||
.isNotEmpty) {
|
||||
return MyUtils
|
||||
.hidePhoneNumber(
|
||||
user.phone!);
|
||||
} else if (user.email !=
|
||||
null &&
|
||||
user.email!
|
||||
.isNotEmpty) {
|
||||
return user.email!;
|
||||
} else {
|
||||
return "微信用户".tr;
|
||||
}
|
||||
@@ -690,7 +690,7 @@ class _MinePageState extends State<MinePage> {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'V1.0.2511.21',
|
||||
'V1.0.2512.03',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
// color: Color(0xFFD9E3EB),
|
||||
|
||||
@@ -41,7 +41,7 @@ class _CommonMessageSettingPageState
|
||||
String type = "user_message_setting";
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||
requestWithLog(
|
||||
logTitle: "查询用户消息配置",
|
||||
logTitle: "查询用户消息配置11",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -62,7 +62,7 @@ class _CommonMessageSettingPageState
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
requestWithLog(
|
||||
logTitle: "查询用户消息配置",
|
||||
logTitle: "查询用户消息配置12",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
|
||||
@@ -400,7 +400,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
() {
|
||||
showHeightPickerDialog(
|
||||
context,
|
||||
title: "选择身高".tr,
|
||||
title: "选择分数".tr,
|
||||
initialHeight: int.tryParse(
|
||||
peopleList[index]['height'] ??
|
||||
'170') ??
|
||||
|
||||
@@ -164,6 +164,7 @@ class AuthBindTelController extends GetControllerEx<AuthBindTelModel> {
|
||||
final data = {
|
||||
'phone': model.phone,
|
||||
'verify': model.code,
|
||||
'merge': true,
|
||||
};
|
||||
|
||||
var response =
|
||||
|
||||
@@ -442,6 +442,8 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.model.user!.tmpNickName = userInfoController.model.user!.nick_name;
|
||||
userInfoController.model.user!.tmpHead = userInfoController.model.user!.avatar;
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
|
||||
@@ -447,7 +447,6 @@ class _EPageState extends State<PersonPage> {
|
||||
currentHeight.toString()) ??
|
||||
170
|
||||
: 170;
|
||||
|
||||
FocusScope.of(context)
|
||||
.requestFocus(FocusNode());
|
||||
Future.delayed(
|
||||
|
||||
@@ -821,3 +821,338 @@ Future<void> showWeightPickerDialog(
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showScorePickerDialog(
|
||||
BuildContext context, {
|
||||
required int initialHeight,
|
||||
required Function(int selectedHeight) onConfirm,
|
||||
String title = "选择分数",
|
||||
String unit = "", // 单位(可选)
|
||||
int min = 0, // ✅ 新增:最小值
|
||||
int max = 100, // ✅ 新增:最大值
|
||||
}) async {
|
||||
/// 生成范围:min ~ max
|
||||
List<int> heights = List.generate(max - min + 1, (index) => min + index);
|
||||
|
||||
/// 确保初始值在范围内
|
||||
if (initialHeight < min) initialHeight = min;
|
||||
if (initialHeight > max) initialHeight = max;
|
||||
|
||||
int selectedIndex = heights.indexOf(initialHeight);
|
||||
final RxInt tempIndex = RxInt(selectedIndex);
|
||||
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// ------- 顶部标题区域 -------
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
color: themeController.currentColor.sc5,
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"取消".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
onConfirm(heights[tempIndex.value]);
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"确定".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: themeController.currentColor.sc2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 20.rpx),
|
||||
|
||||
// -------- 中间选择器 --------
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 90.rpx,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc2,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: getOnePickers(
|
||||
context,
|
||||
heights,
|
||||
tempIndex,
|
||||
unit: unit, // 使用传入的单位
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showIntervalPickerDialog(
|
||||
BuildContext context, {
|
||||
required int initialValue,
|
||||
required Function(int selectedValue) onConfirm,
|
||||
List<int> options = const [], // ✅ 可选值数组(优先级最高)
|
||||
int min = 0, // 若没有 options,则使用 min/max
|
||||
int max = 100,
|
||||
int type = 2, // 1=秒,2=分钟(默认),3=小时
|
||||
String unit = "分钟/次",
|
||||
String title = "选择间隔",
|
||||
}) async {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
/// ------------------------------------------
|
||||
/// 计算实际数据源:优先使用 options
|
||||
/// ------------------------------------------
|
||||
List<int> values;
|
||||
if (options.isNotEmpty) {
|
||||
values = [...options];
|
||||
} else {
|
||||
values = List.generate(max - min + 1, (index) => min + index);
|
||||
}
|
||||
|
||||
/// ------------------------------------------
|
||||
/// 显示转换函数
|
||||
/// ------------------------------------------
|
||||
String formatValue(int raw) {
|
||||
double result;
|
||||
|
||||
switch (type) {
|
||||
case 1: // 秒
|
||||
result = raw.toDouble();
|
||||
return "${result.toInt()}秒/次";
|
||||
|
||||
case 2: // 分钟
|
||||
result = raw / 60.0;
|
||||
break;
|
||||
|
||||
case 3: // 小时
|
||||
result = raw / 3600.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = raw.toDouble();
|
||||
}
|
||||
|
||||
/// 去掉多余的小数,例如 1.0 → 1
|
||||
String text =
|
||||
result % 1 == 0 ? result.toInt().toString() : result.toStringAsFixed(1);
|
||||
|
||||
return "$text$unit";
|
||||
}
|
||||
|
||||
/// ------------------------------------------
|
||||
/// 初始 index
|
||||
/// ------------------------------------------
|
||||
int initialIndex = values.indexOf(initialValue);
|
||||
if (initialIndex < 0) initialIndex = 0;
|
||||
final RxInt tempIndex = RxInt(initialIndex);
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(0),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
/// ---------------- 顶部标题 ----------------
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
color: themeController.currentColor.sc5,
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () => Get.back(),
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"取消".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () {
|
||||
onConfirm(values[tempIndex.value]); // 返回原始秒数
|
||||
Get.back();
|
||||
},
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Text(
|
||||
"确定".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: themeController.currentColor.sc2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 20.rpx),
|
||||
|
||||
/// ---------------- 中间选择器 ----------------
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 90.rpx,
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc2,
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: getOnePickers(
|
||||
context,
|
||||
values,
|
||||
tempIndex,
|
||||
|
||||
/// → 替换显示文本(核心)
|
||||
customDisplay: (val) => formatValue(val),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
|
||||
String type = "user_message_setting";
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||
requestWithLog(
|
||||
logTitle: "查询用户消息配置",
|
||||
logTitle: "查询用户消息配置13",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -59,7 +59,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
requestWithLog(
|
||||
logTitle: "查询用户消息配置",
|
||||
logTitle: "查询用户消息配置14",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
@@ -188,7 +188,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"全部消息".tr,
|
||||
"全部通知".tr,
|
||||
style: TextStyle(
|
||||
color:
|
||||
themeController.currentColor.sc3,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.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/WebViewWidget.dart';
|
||||
|
||||
657
lib/pages/user/update_user_email.dart
Normal file
657
lib/pages/user/update_user_email.dart
Normal file
@@ -0,0 +1,657 @@
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
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/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/DailyLogUtils.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/NewTopSlideNotification.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/login/login_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/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/model/user_data.dart';
|
||||
|
||||
class UpdateUserEmailPage extends StatefulWidget {
|
||||
const UpdateUserEmailPage({super.key});
|
||||
|
||||
@override
|
||||
State<UpdateUserEmailPage> createState() => _UpdateUserEmailPageState();
|
||||
}
|
||||
|
||||
class _UpdateUserEmailPageState extends State<UpdateUserEmailPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
PersonController personController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
LoginController loginController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
userInfoController.model.user!.tmpHead =
|
||||
userInfoController.model.user!.avatar;
|
||||
userInfoController.model.user!.tmpNickName =
|
||||
userInfoController.model.user!.nick_name;
|
||||
loginController.model.updatePhone = null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int login = userInfoController.model.login!;
|
||||
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,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'更换邮箱'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
if (loginController.model.updatePhone == null ||
|
||||
loginController.model.updatePhone == '') {
|
||||
NewTopSlideNotification.show(
|
||||
text: "请输入邮箱号",
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
return;
|
||||
}
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData(
|
||||
email: loginController.model.updatePhone);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
loginController.model.updatePhone = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.model.user!.tmpNickName = userInfoController.model.user!.nick_name;
|
||||
userInfoController.model.user!.tmpHead = userInfoController.model.user!.avatar;
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0.rpx, 16.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'修改资料页.保存'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 20.rpx, 0, 0),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: double.infinity,
|
||||
height: bodySize.maxHeight * 0.056,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 120.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
60.rpx, 0, 35.rpx, 0),
|
||||
child: Text(
|
||||
"原邮箱号" + ":" + "${getHideEmail()}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
color: themeController.currentColor.sc17,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 0.rpx, 0, 20.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: bodySize.maxHeight * 0.056,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(
|
||||
0,
|
||||
),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
35.rpx, 0, 35.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(
|
||||
// 26.rpx, 0, 0, 0),
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// InkWell(
|
||||
// onTap: () async {},
|
||||
// child: Container(
|
||||
// alignment: Alignment.center,
|
||||
// // constraints: BoxConstraints(
|
||||
// // minWidth: 150.rpx,
|
||||
// // ),
|
||||
// child: Text(
|
||||
// "+86",
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController
|
||||
// .currentColor.sc4,
|
||||
// fontSize: AppConstants()
|
||||
// .middler_text_fontSize,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 30.rpx,
|
||||
// child: VerticalDivider(
|
||||
// thickness: 2.rpx,
|
||||
// color: themeController
|
||||
// .currentColor.sc4,
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(width: 10.rpx)),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(-1, 0),
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginController.model
|
||||
.updatePhone = 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,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
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: Colors.white,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 0.rpx, 0, 0),
|
||||
child: Container(
|
||||
height: bodySize.maxHeight * 0.056,
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
35.rpx, 0, 35.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(-1, 0),
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginController
|
||||
.model.updateCode = 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,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
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: true,
|
||||
fillColor: Colors.transparent,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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: themeController
|
||||
.currentColor.sc7,
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
final CountdownController
|
||||
countdownController =
|
||||
Get.find<
|
||||
CountdownController>();
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
try {
|
||||
DailyLogUtils.writeLog(
|
||||
"点击获取验证码");
|
||||
if (countdownController
|
||||
.countdown
|
||||
.value !=
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
ApiResponse apiResponse =
|
||||
await loginController
|
||||
.getUpdateTelCode(
|
||||
context);
|
||||
if (apiResponse.code !=
|
||||
HttpStatusCodes.ok) {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text:
|
||||
apiResponse.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9,
|
||||
);
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码成功,${apiResponse}");
|
||||
return;
|
||||
} else {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text:
|
||||
apiResponse.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc2,
|
||||
);
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码失败,${apiResponse}");
|
||||
}
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? countdownController
|
||||
.startCountdown(
|
||||
AppConstants
|
||||
.code_time)
|
||||
: null;
|
||||
} catch (e) {
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码异常,${e}");
|
||||
edm.EasyDartModule.logger
|
||||
.info("获取验证码异常:${e}");
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 150.rpx,
|
||||
),
|
||||
child: Text(
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? '其他手机登录页.获取验证码'.tr
|
||||
: '${countdownController.countdown.value}' +
|
||||
"其他手机登录页.秒".tr,
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
fontSize: AppConstants()
|
||||
.middler_text_fontSize,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
].divide(SizedBox(width: 26.rpx)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getImageWidget(BuildContext context) {
|
||||
try {
|
||||
UserInfoController controller = Get.find();
|
||||
var head = controller.model.user!.tmpHead;
|
||||
return Container(
|
||||
width: 200.rpx,
|
||||
height: 200.rpx,
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: head == null || head.isEmpty
|
||||
? Image.asset(
|
||||
'assets/img/avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.network(
|
||||
head,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
|
||||
String getTextByUserInfo(String type) {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
UserModel userInfo = userInfoController.model.user!;
|
||||
if (userInfo == null) {
|
||||
return "";
|
||||
}
|
||||
if (type == "phone") {
|
||||
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
|
||||
return "更换".tr;
|
||||
} else {
|
||||
return "换绑".tr;
|
||||
}
|
||||
}
|
||||
if (type == "email") {
|
||||
if (userInfo.email == null || userInfo.email!.isEmpty) {
|
||||
return "绑定".tr;
|
||||
} else {
|
||||
return "换绑".tr;
|
||||
}
|
||||
}
|
||||
if (type == "wechat") {
|
||||
if (userInfo.bindWx == null || userInfo.bindWx == false) {
|
||||
return "绑定".tr;
|
||||
} else {
|
||||
return "解绑".tr;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
getHideEmail() {
|
||||
UserModel userModel = userInfoController.model.user!;
|
||||
if (userModel.email == null || userModel.email == "") {
|
||||
return "暂无".tr;
|
||||
}
|
||||
return userModel.email!
|
||||
.replaceRange(3, userModel.email!.length - 3, "****");
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,12 @@ import 'dart:io';
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
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:fluwx/fluwx.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/DailyLogUtils.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
@@ -13,11 +16,14 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/login/login_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/model/api_response.dart';
|
||||
import 'package:vbvs_app/model/user_data.dart';
|
||||
import 'package:vbvs_app/pages/user/wx_unbind_dialog.dart';
|
||||
|
||||
class UpdateUserPage extends StatefulWidget {
|
||||
const UpdateUserPage({super.key});
|
||||
@@ -42,6 +48,53 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
userInfoController.model.user!.avatar;
|
||||
userInfoController.model.user!.tmpNickName =
|
||||
userInfoController.model.user!.nick_name;
|
||||
|
||||
Fluwx fluwx = userInfoController.fluwx;
|
||||
userInfoController.fluwxCancelable = fluwx.addSubscriber((response) async {
|
||||
if (response is WeChatAuthResponse) {
|
||||
debugPrint('state :${response.state} \n code:${response.code}');
|
||||
int errCode = response.errCode ?? -9999;
|
||||
if (errCode == 0) {
|
||||
// TODO 微信登录成功 传递code给后台 再操作逻辑
|
||||
String code = response.code ?? "";
|
||||
//把微信登录返回的code传给后台,剩下的事就交给后台处理
|
||||
//首次未注册的用户引导去手机号填写页面
|
||||
//已注册的用户直接跳转首页
|
||||
if (CommonVariables.isNetWorkOn == false) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "网络未连接,请开启设备网络后重试".tr,
|
||||
textColor: themeController.currentColor.sc9);
|
||||
// showToast("网络未连接,请开启设备网络后重试");
|
||||
return;
|
||||
}
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData(code: code);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
||||
// fluwxCancelable?.cancel();
|
||||
} else if (errCode == -4) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "用户拒绝授权".tr, textColor: themeController.currentColor.sc9);
|
||||
// showToast("用户拒绝授权");
|
||||
} else if (errCode == -2) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "用户取消授权".tr, textColor: themeController.currentColor.sc9);
|
||||
// showToast("用户取消授权");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
userInfoController.fluwxCancelable?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -103,6 +156,10 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.model.user!.tmpNickName =
|
||||
userInfoController.model.user!.nick_name;
|
||||
userInfoController.model.user!.tmpHead =
|
||||
userInfoController.model.user!.avatar;
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
@@ -142,13 +199,13 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
60.rpx, 0.rpx, 60.rpx, 0.rpx),
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
||||
60.rpx, 76.rpx, 60.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.213,
|
||||
height: MediaQuery.sizeOf(context).height * 0.098,
|
||||
@@ -158,6 +215,9 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() {
|
||||
var aa =
|
||||
userInfoController.model.user!.tmpNickName;
|
||||
print(aa);
|
||||
return getImageWidget(context);
|
||||
})),
|
||||
),
|
||||
@@ -165,7 +225,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc16,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 44.rpx, 0.rpx, 44.rpx),
|
||||
60.rpx, 44.rpx, 60.rpx, 44.rpx),
|
||||
borderRadius: 0,
|
||||
onTap: () async {
|
||||
edm.EasyDartModule.logger
|
||||
@@ -196,7 +256,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 79.rpx, 0.rpx, 0.rpx),
|
||||
60.rpx, 79.rpx, 60.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -310,6 +370,258 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 100.rpx,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(40.rpx, 0, 40.rpx, 0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
color: themeController.currentColor.sc17,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
20.rpx, 20.rpx, 20.rpx, 0.rpx),
|
||||
child: ClickableContainer(
|
||||
backgroundColor: Colors.transparent, // 容器背景色
|
||||
highlightColor: themeController
|
||||
.currentColor.sc21, // 点击时的背景色
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
onTap: () async {
|
||||
Get.toNamed('/updateUserTelPage');
|
||||
},
|
||||
child: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
20.rpx, 30.rpx, 20.rpx, 30.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'手机号码'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
getTextByUserInfo('phone'),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
// color: Color(0xFFD9E3EB),
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15
|
||||
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
].divide(SizedBox(width: 28.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx, 20.rpx, 40.rpx, 0.rpx),
|
||||
child: ClickableContainer(
|
||||
backgroundColor: Colors.transparent, // 容器背景色
|
||||
highlightColor: themeController
|
||||
.currentColor.sc21, // 点击时的背景色
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
onTap: () async {
|
||||
Get.toNamed('/updateUserEmailPage');
|
||||
},
|
||||
child: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 30.rpx, 0.rpx, 30.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'邮箱'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
getTextByUserInfo('email'),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
// color: Color(0xFFD9E3EB),
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15
|
||||
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
].divide(SizedBox(width: 28.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx, 20.rpx, 40.rpx, 20.rpx),
|
||||
child: ClickableContainer(
|
||||
backgroundColor: Colors.transparent, // 容器背景色
|
||||
highlightColor: themeController
|
||||
.currentColor.sc21, // 点击时的背景色
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
onTap: () async {
|
||||
if (userInfoController.model.user!.bindWx ==
|
||||
null ||
|
||||
userInfoController.model.user!.bindWx ==
|
||||
false) {
|
||||
//微信绑定
|
||||
LoginController loginController =
|
||||
Get.find();
|
||||
await loginController.wxLoginSendAuth(
|
||||
context,
|
||||
login: false);
|
||||
} else {
|
||||
//取消微信绑定
|
||||
// LoginController loginController =
|
||||
// Get.find();
|
||||
// await loginController.wxLoginSendAuth(
|
||||
// context,
|
||||
// login: false);
|
||||
// TopSlideNotification.show(context,
|
||||
// text: "暂不支持微信解绑授权".tr,
|
||||
// textColor:
|
||||
// themeController.currentColor.sc9);
|
||||
// return;
|
||||
showUnbindWxConfirmDialog(context);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 30.rpx, 0.rpx, 30.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Text(
|
||||
'微信'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 22.rpx)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Obx(() {
|
||||
var aa = userInfoController
|
||||
.model.user!.tmpNickName;
|
||||
print(aa);
|
||||
return Text(
|
||||
getTextByUserInfo('wechat'),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
// color: Color(0xFFD9E3EB),
|
||||
color: getTextByUserInfo(
|
||||
'wechat') ==
|
||||
"解绑".tr
|
||||
? themeController
|
||||
.currentColor.sc4
|
||||
: themeController
|
||||
.currentColor.sc2,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
);
|
||||
}),
|
||||
SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
width: 8.rpx,
|
||||
height: 15
|
||||
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
].divide(SizedBox(width: 28.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -334,9 +646,8 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: head == null || head.isEmpty
|
||||
? Image.asset(
|
||||
'assets/img/avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
? SvgPicture.asset(
|
||||
"assets/img/avatar.svg",
|
||||
)
|
||||
: Image.network(
|
||||
head,
|
||||
@@ -349,4 +660,34 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
|
||||
String getTextByUserInfo(String type) {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
UserModel userInfo = userInfoController.model.user!;
|
||||
if (userInfo == null) {
|
||||
return "";
|
||||
}
|
||||
if (type == "phone") {
|
||||
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
|
||||
return "更换".tr;
|
||||
} else {
|
||||
return "换绑".tr;
|
||||
}
|
||||
}
|
||||
if (type == "email") {
|
||||
if (userInfo.email == null || userInfo.email!.isEmpty) {
|
||||
return "绑定".tr;
|
||||
} else {
|
||||
return "换绑".tr;
|
||||
}
|
||||
}
|
||||
if (type == "wechat") {
|
||||
if (userInfo.bindWx == null || userInfo.bindWx == false) {
|
||||
return "绑定".tr;
|
||||
} else {
|
||||
return "解绑".tr;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
659
lib/pages/user/update_user_tel.dart
Normal file
659
lib/pages/user/update_user_tel.dart
Normal file
@@ -0,0 +1,659 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
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/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||
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/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/NewTopSlideNotification.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/login/login_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/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/model/user_data.dart';
|
||||
|
||||
class UpdateUserTelPage extends StatefulWidget {
|
||||
const UpdateUserTelPage({super.key});
|
||||
|
||||
@override
|
||||
State<UpdateUserTelPage> createState() => _UpdateUserTelPageState();
|
||||
}
|
||||
|
||||
class _UpdateUserTelPageState extends State<UpdateUserTelPage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
PersonController personController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
LoginController loginController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
userInfoController.model.user!.tmpHead =
|
||||
userInfoController.model.user!.avatar;
|
||||
userInfoController.model.user!.tmpNickName =
|
||||
userInfoController.model.user!.nick_name;
|
||||
loginController.model.updatePhone = null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int login = userInfoController.model.login!;
|
||||
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,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'更换手机号码'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
if (loginController.model.updatePhone == null ||
|
||||
loginController.model.updatePhone == '') {
|
||||
NewTopSlideNotification.show(
|
||||
text: "请输入手机号",
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
return;
|
||||
}
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData(
|
||||
phone: loginController.model.updatePhone);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
loginController.model.updatePhone = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.model.user!.tmpNickName =
|
||||
userInfoController.model.user!.nick_name;
|
||||
userInfoController.model.user!.tmpHead =
|
||||
userInfoController.model.user!.avatar;
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0.rpx, 16.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'修改资料页.保存'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: double.infinity,
|
||||
height: bodySize.maxHeight * 0.056,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 120.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
60.rpx, 0, 35.rpx, 0),
|
||||
child: Text(
|
||||
"原手机号码" + ":" + "${getHidePhone()}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
color: themeController.currentColor.sc17,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 20.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: bodySize.maxHeight * 0.056,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
35.rpx, 0, 35.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(
|
||||
26.rpx, 0, 0, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
// constraints: BoxConstraints(
|
||||
// minWidth: 150.rpx,
|
||||
// ),
|
||||
child: Text(
|
||||
"+86",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
fontSize: AppConstants()
|
||||
.middler_text_fontSize,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.rpx,
|
||||
child: VerticalDivider(
|
||||
thickness: 2.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 10.rpx)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(-1, 0),
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginController.model
|
||||
.updatePhone = 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,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
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: Colors.white,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 26.rpx, 0, 20.rpx),
|
||||
child: Container(
|
||||
height: bodySize.maxHeight * 0.056,
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
35.rpx, 0, 35.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(-1, 0),
|
||||
child: TextFormField(
|
||||
onChanged: (value) {
|
||||
loginController
|
||||
.model.updateCode = 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,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
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: true,
|
||||
fillColor: Colors.transparent,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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: themeController
|
||||
.currentColor.sc7,
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
final CountdownController
|
||||
countdownController =
|
||||
Get.find<
|
||||
CountdownController>();
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
try {
|
||||
DailyLogUtils.writeLog(
|
||||
"点击获取验证码");
|
||||
if (countdownController
|
||||
.countdown
|
||||
.value !=
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
ApiResponse apiResponse =
|
||||
await loginController
|
||||
.getUpdateTelCode(
|
||||
context);
|
||||
if (apiResponse.code !=
|
||||
HttpStatusCodes.ok) {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text:
|
||||
apiResponse.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9,
|
||||
);
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码成功,${apiResponse}");
|
||||
return;
|
||||
} else {
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text:
|
||||
apiResponse.msg!,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc2,
|
||||
);
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码失败,${apiResponse}");
|
||||
}
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? countdownController
|
||||
.startCountdown(
|
||||
AppConstants
|
||||
.code_time)
|
||||
: null;
|
||||
} catch (e) {
|
||||
await DailyLogUtils
|
||||
.writeLog(
|
||||
"获取验证码异常,${e}");
|
||||
edm.EasyDartModule.logger
|
||||
.info("获取验证码异常:${e}");
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 150.rpx,
|
||||
),
|
||||
child: Text(
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? '其他手机登录页.获取验证码'.tr
|
||||
: '${countdownController.countdown.value}' +
|
||||
"其他手机登录页.秒".tr,
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
fontSize: AppConstants()
|
||||
.middler_text_fontSize,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
].divide(SizedBox(width: 26.rpx)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getImageWidget(BuildContext context) {
|
||||
try {
|
||||
UserInfoController controller = Get.find();
|
||||
var head = controller.model.user!.tmpHead;
|
||||
return Container(
|
||||
width: 200.rpx,
|
||||
height: 200.rpx,
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: head == null || head.isEmpty
|
||||
? Image.asset(
|
||||
'assets/img/avatar.png',
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: Image.network(
|
||||
head,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
|
||||
String getTextByUserInfo(String type) {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
UserModel userInfo = userInfoController.model.user!;
|
||||
if (userInfo == null) {
|
||||
return "";
|
||||
}
|
||||
if (type == "phone") {
|
||||
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
|
||||
return "更换".tr;
|
||||
} else {
|
||||
return "换绑".tr;
|
||||
}
|
||||
}
|
||||
if (type == "email") {
|
||||
if (userInfo.email == null || userInfo.email!.isEmpty) {
|
||||
return "绑定".tr;
|
||||
} else {
|
||||
return "换绑".tr;
|
||||
}
|
||||
}
|
||||
if (type == "wechat") {
|
||||
if (userInfo.bindWx == null || userInfo.bindWx == false) {
|
||||
return "绑定".tr;
|
||||
} else {
|
||||
return "解绑".tr;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
getHidePhone() {
|
||||
UserModel userModel = userInfoController.model.user!;
|
||||
if (userModel.phone == null || userModel.phone == "") {
|
||||
return "暂无".tr;
|
||||
}
|
||||
return "${userModel.phone!.substring(0, 3)}****${userModel.phone!.substring(7, 11)}";
|
||||
}
|
||||
}
|
||||
29
lib/pages/user/wx_unbind_dialog.dart
Normal file
29
lib/pages/user/wx_unbind_dialog.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
void showUnbindWxConfirmDialog(BuildContext context) {
|
||||
showConfirmDialog(
|
||||
context,
|
||||
Container(),
|
||||
"是否确认解绑".tr,
|
||||
onConfirm: () async {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData(code: "unBind");
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
onCancel: () {},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user