多语言后端数据
This commit is contained in:
@@ -8,6 +8,7 @@ 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/controller/mh_controller/mh_language_controller.dart';
|
||||
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
|
||||
@@ -127,7 +128,8 @@ class _LanguagePageState extends State<LanguagePage> {
|
||||
await AppLanguage()
|
||||
.loadLanguage(
|
||||
language.language_code,
|
||||
project: "mht"); // 加载语言
|
||||
project: AppConstants()
|
||||
.ent_type); // 加载语言
|
||||
languageController
|
||||
.updateAll(); // 更新操作
|
||||
languageController
|
||||
@@ -179,41 +181,43 @@ class _LanguagePageState extends State<LanguagePage> {
|
||||
false, // 根据 selected 状态显示选中或未选中
|
||||
onChanged: (value) async {
|
||||
// // 保持原有的状态更改逻辑
|
||||
// for (var lang
|
||||
// in languageController
|
||||
// .languageList) {
|
||||
// lang.selected = (lang ==
|
||||
// language); // 更新选中状态
|
||||
// }
|
||||
// 点击事件逻辑
|
||||
for (var lang
|
||||
in languageController
|
||||
.languageList) {
|
||||
lang.selected = (lang ==
|
||||
language); // 根据选择更新状态
|
||||
}
|
||||
|
||||
// await AppLanguage()
|
||||
// .loadLanguage(
|
||||
// language
|
||||
// .language_code,
|
||||
// project:
|
||||
// "mht"); // 加载语言
|
||||
// languageController
|
||||
// .updateAll(); // 更新操作
|
||||
// languageController
|
||||
// .selectLanguage
|
||||
// .value = language;
|
||||
// final list =
|
||||
// deviceController
|
||||
// .personnelList
|
||||
// .value;
|
||||
// deviceController
|
||||
// .getHomeSleeps(
|
||||
// list[0]["mac"],
|
||||
// context);
|
||||
// final box = GetStorage();
|
||||
// try {
|
||||
// box.write(
|
||||
// 'language',
|
||||
// language
|
||||
// .language_code);
|
||||
// } catch (e) {
|
||||
// print(e);
|
||||
// }
|
||||
await AppLanguage().loadLanguage(
|
||||
language
|
||||
.language_code,
|
||||
project: AppConstants()
|
||||
.ent_type); // 加载语言
|
||||
languageController
|
||||
.updateAll(); // 更新操作
|
||||
languageController
|
||||
.selectLanguage
|
||||
.value = language;
|
||||
final list =
|
||||
deviceController
|
||||
.personnelList
|
||||
.value;
|
||||
deviceController
|
||||
.getHomeSleeps(
|
||||
list[0]["mac"],
|
||||
context);
|
||||
|
||||
try {
|
||||
// ef.kv.set("language",
|
||||
// language.language_code);
|
||||
ef.kvdb.write(
|
||||
"mht/language",
|
||||
language
|
||||
.language_code);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
},
|
||||
),
|
||||
].divide(SizedBox(
|
||||
|
||||
@@ -143,6 +143,8 @@ class ShareDeviceDetailWidget extends GetView {
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新错误:$e");
|
||||
}
|
||||
isProgrammaticPop = true; // 设置为程序触发,避免再次触发 PopScope
|
||||
Get.back(); // 或 Navigator.pop(context);
|
||||
},
|
||||
onFailure: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
@@ -152,12 +154,12 @@ class ShareDeviceDetailWidget extends GetView {
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
if (flag) {
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
// if (Platform.isAndroid) {
|
||||
// var flag = await _handleBackPressed(context); // 自定义返回逻辑
|
||||
// if (flag) {
|
||||
// SystemNavigator.pop();
|
||||
// }
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
@@ -423,7 +425,9 @@ class ShareDeviceDetailWidget extends GetView {
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
deviceListController.unbindShareDevice(
|
||||
data['info'][5]['uid'], data['mac'.tr], context);
|
||||
data['info'][5]['uid'],
|
||||
data['mac'.tr],
|
||||
context);
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
@@ -456,20 +460,4 @@ class ShareDeviceDetailWidget extends GetView {
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Future<bool> _handleBackPressed(BuildContext context) async {
|
||||
final currentTime = DateTime.now();
|
||||
// 如果上次点击返回键时间为空,或者间隔超过 1 秒
|
||||
if (_lastBackPressedTime == null ||
|
||||
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
|
||||
_lastBackPressedTime = currentTime;
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "再按一次退出程序".tr,
|
||||
);
|
||||
return false; // 阻止退出程序
|
||||
} else {
|
||||
return true; // 允许退出程序
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,45 +21,47 @@ class AddressModuleWidget extends GetView {
|
||||
child: SlidableAutoCloseBehavior(
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 220.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF003058),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Slidable(
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.26,
|
||||
motion: ScrollMotion(),
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
await addressListController.deleteAddress(
|
||||
addressListController.model.addressList[index]
|
||||
['_id']);
|
||||
addressListController.model.addressList.removeAt(index);
|
||||
child: Slidable(
|
||||
key:
|
||||
ValueKey(addressListController.model.addressList[index]['_id']),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.26,
|
||||
motion: ScrollMotion(),
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
await addressListController.deleteAddress(
|
||||
addressListController.model.addressList[index]
|
||||
['_id']);
|
||||
addressListController.model.addressList.removeAt(index);
|
||||
|
||||
addressListController.updateAll();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 30),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.red,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
color: Colors.white,
|
||||
),
|
||||
addressListController.updateAll();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 30),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.red,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 220.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF003058),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
|
||||
@@ -299,7 +299,6 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
.firstWhere((device) =>
|
||||
device['mac'.tr].toString() ==
|
||||
val);
|
||||
|
||||
final mac =
|
||||
selectedDevice['mac'.tr]?.toString() ??
|
||||
'未知MAC'.tr;
|
||||
@@ -374,12 +373,11 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
0,
|
||||
borderRadius:
|
||||
8,
|
||||
margin: const EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
10,
|
||||
4,
|
||||
10,
|
||||
4),
|
||||
margin: EdgeInsetsDirectional.fromSTEB(
|
||||
20.rpx,
|
||||
8.rpx,
|
||||
20.rpx,
|
||||
4.rpx),
|
||||
hidesUnderline:
|
||||
true,
|
||||
isOverButton:
|
||||
@@ -418,7 +416,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
0.038,
|
||||
constraints:
|
||||
BoxConstraints(
|
||||
minWidth: 62,
|
||||
minWidth: 60,
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
@@ -457,7 +455,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
padding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
35.rpx,
|
||||
20.rpx,
|
||||
0,
|
||||
35.rpx,
|
||||
0),
|
||||
@@ -493,7 +491,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
contentPadding:
|
||||
EdgeInsets.all(0),
|
||||
isDense:
|
||||
true,
|
||||
false,
|
||||
labelStyle:
|
||||
TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
@@ -595,7 +593,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
.height *
|
||||
0.038,
|
||||
constraints:
|
||||
const BoxConstraints(
|
||||
BoxConstraints(
|
||||
minWidth: 60,
|
||||
),
|
||||
child: Align(
|
||||
@@ -634,7 +632,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
padding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
35.rpx,
|
||||
20.rpx,
|
||||
0,
|
||||
35.rpx,
|
||||
0),
|
||||
@@ -670,7 +668,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
contentPadding:
|
||||
EdgeInsets.all(0),
|
||||
isDense:
|
||||
true,
|
||||
false,
|
||||
labelStyle:
|
||||
TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
@@ -812,7 +810,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
padding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
35.rpx,
|
||||
20.rpx,
|
||||
0,
|
||||
35.rpx,
|
||||
0),
|
||||
@@ -848,7 +846,7 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
contentPadding:
|
||||
EdgeInsets.all(0),
|
||||
isDense:
|
||||
true,
|
||||
false,
|
||||
labelStyle:
|
||||
TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
@@ -1042,8 +1040,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
width: 138,
|
||||
height: 31,
|
||||
width: 300.rpx,
|
||||
height: 62.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
|
||||
@@ -141,9 +141,9 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
}
|
||||
|
||||
String? language = "";
|
||||
if (languageController.selectLanguage != null) {
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (language != null && language.isNotEmpty) {
|
||||
if (queryUrl.contains("?")) {
|
||||
queryUrl += "&lang=$language";
|
||||
|
||||
@@ -37,6 +37,11 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
super.initState();
|
||||
editedData = Map.from(widget.data); // 创建副本
|
||||
_nameController = TextEditingController(text: editedData['name']);
|
||||
|
||||
// 添加监听器
|
||||
_nameController.addListener(() {
|
||||
setState(() {}); // 每次文字变化刷新UI
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -181,84 +186,178 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
height: 193.rpx,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 60.rpx),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: bodysize!.maxHeight * 0.076,
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Color(0xFF929699),
|
||||
width: 0))),
|
||||
child: TextFormField(
|
||||
// autofocus: true,
|
||||
controller: _nameController,
|
||||
obscureText: false,
|
||||
onChanged: (val) {
|
||||
editedData['name'] = val;
|
||||
},
|
||||
textAlign: TextAlign.center,
|
||||
maxLength: AppConstants().text_length,
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入设备的名称".tr,
|
||||
contentPadding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(10, 0, 10, 0),
|
||||
labelStyle: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
letterSpacing: 0,
|
||||
fontSize: 36.rpx, // 设置输入文字大小
|
||||
color: Colors.white, // 设置输入文字颜色
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
letterSpacing: 0,
|
||||
color: Color(0xFF929699),
|
||||
fontSize: 36.rpx,
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
errorBorder: UnderlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
letterSpacing: 0,
|
||||
color: Colors.white,
|
||||
fontSize: 36.rpx,
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 60.rpx),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: bodysize!.maxHeight * 0.076,
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: Color(0xFF929699), // 灰色底部线
|
||||
width: 0.5, // 根据需要设置宽度
|
||||
),
|
||||
),
|
||||
))
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
obscureText: false,
|
||||
onChanged: (val) {
|
||||
editedData['name'] = val;
|
||||
},
|
||||
textAlign: TextAlign.center,
|
||||
textAlignVertical:
|
||||
TextAlignVertical.center,
|
||||
maxLength: AppConstants().text_length,
|
||||
buildCounter: (_,
|
||||
{int? currentLength,
|
||||
bool? isFocused,
|
||||
int? maxLength}) =>
|
||||
null,
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入设备的名称".tr,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 0, horizontal: 10),
|
||||
labelStyle: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
letterSpacing: 0,
|
||||
fontSize: 36.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
letterSpacing: 0,
|
||||
fontSize: 36.rpx,
|
||||
color: const Color(0xFF929699),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide.none,
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide.none,
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
errorBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide.none,
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide: BorderSide.none,
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 36.rpx,
|
||||
color: Colors.white,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
cursorColor: Colors.white,
|
||||
),
|
||||
|
||||
// 自定义右下角计数器
|
||||
Positioned(
|
||||
bottom: 2.rpx,
|
||||
right: 10.rpx,
|
||||
child: Text(
|
||||
'${_nameController.text.characters.length} / ${AppConstants().text_length}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.rpx,
|
||||
color: const Color(0xFF929699),
|
||||
fontFamily: 'Readex Pro',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Container(
|
||||
// alignment: Alignment.center,
|
||||
// height: bodysize!.maxHeight * 0.076,
|
||||
// decoration: const BoxDecoration(
|
||||
// border: Border(
|
||||
// bottom: BorderSide(
|
||||
// color: Color(0xFF929699),
|
||||
// width: 0))),
|
||||
// child: TextFormField(
|
||||
// // autofocus: true,
|
||||
// controller: _nameController,
|
||||
// obscureText: false,
|
||||
// onChanged: (val) {
|
||||
// editedData['name'] = val;
|
||||
// },
|
||||
// textAlign: TextAlign.center,
|
||||
// maxLength: AppConstants().text_length,
|
||||
// decoration: InputDecoration(
|
||||
// hintText: "请输入设备的名称".tr,
|
||||
// contentPadding:
|
||||
// const EdgeInsetsDirectional
|
||||
// .fromSTEB(10, 0, 10, 0),
|
||||
// labelStyle: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// letterSpacing: 0,
|
||||
// fontSize: 36.rpx, // 设置输入文字大小
|
||||
// color: Colors.white, // 设置输入文字颜色
|
||||
// ),
|
||||
// hintStyle: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// letterSpacing: 0,
|
||||
// color: Color(0xFF929699),
|
||||
// fontSize: 36.rpx,
|
||||
// ),
|
||||
// enabledBorder: UnderlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: Color(0x00000000),
|
||||
// width: 2,
|
||||
// ),
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(8),
|
||||
// ),
|
||||
// focusedBorder: UnderlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: Color(0x00000000),
|
||||
// width: 2,
|
||||
// ),
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(8),
|
||||
// ),
|
||||
// errorBorder: UnderlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: Color(0x00000000),
|
||||
// width: 2,
|
||||
// ),
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(8),
|
||||
// ),
|
||||
// focusedErrorBorder:
|
||||
// UnderlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: Color(0x00000000),
|
||||
// width: 2,
|
||||
// ),
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(8),
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// letterSpacing: 0,
|
||||
// color: Colors.white,
|
||||
// fontSize: 36.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -37,6 +37,7 @@ class ExperienceStoreWidget extends GetView {
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 4),
|
||||
|
||||
@@ -61,14 +61,16 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
|
||||
Future<ApiResponse> getDeviceNum() async {
|
||||
try {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_list;
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?bindNum=1";
|
||||
String? language = "";
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (language != null && language.isNotEmpty) {
|
||||
if (queryUrl.contains("?")) {
|
||||
queryUrl += "&lang=$language";
|
||||
@@ -80,7 +82,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
var responseData =
|
||||
response.data is String ? jsonDecode(response.data) : response.data;
|
||||
ApiResponse res = ApiResponse.fromJson(responseData, (object) => object);
|
||||
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr);
|
||||
MyUtils.formatResponse(res, "设备列表请求成功".tr, "设备列表请求失败".tr);
|
||||
if (res.code == HttpStatusCodes.ok) {
|
||||
bindDeviceNum.value = res.total!;
|
||||
updateAll();
|
||||
@@ -97,7 +99,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
Future<ApiResponse> getDeviceList(
|
||||
{String? key, String? group, int? bindType}) async {
|
||||
try {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_list;
|
||||
@@ -121,7 +123,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
}
|
||||
|
||||
String? language = "";
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (language != null && language.isNotEmpty) {
|
||||
queryParams['lang'] = language;
|
||||
}
|
||||
@@ -135,7 +139,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
var responseData =
|
||||
response.data is String ? jsonDecode(response.data) : response.data;
|
||||
ApiResponse res = ApiResponse.fromJson(responseData, (object) => object);
|
||||
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr);
|
||||
MyUtils.formatResponse(res, "设备列表请求成功".tr, "设备列表请求失败".tr);
|
||||
if (res.code == HttpStatusCodes.ok) {
|
||||
deviceList.value = res.data!;
|
||||
updateAll();
|
||||
@@ -152,7 +156,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
Future<ApiResponse> getDeviceListForWeb(
|
||||
{String? key, String? group, int? bindType}) async {
|
||||
try {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_list;
|
||||
@@ -176,8 +180,8 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
}
|
||||
|
||||
String? language = "";
|
||||
if (languageController.selectLanguage != null) {
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (language != null && language.isNotEmpty) {
|
||||
queryParams['lang'] = language;
|
||||
@@ -194,14 +198,14 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
response.data is String ? jsonDecode(response.data) : response.data;
|
||||
ApiResponse res =
|
||||
ApiResponse.fromJson(responseData, (object) => object);
|
||||
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr);
|
||||
MyUtils.formatResponse(res, "设备列表请求成功".tr, "设备列表请求失败".tr);
|
||||
if (res.code == HttpStatusCodes.ok) {
|
||||
deviceListForWeb.value = res.data!;
|
||||
updateAll();
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
return ApiResponse(code: -1, msg: "服务器.失败".tr);
|
||||
return ApiResponse(code: -1, msg: "失败".tr);
|
||||
}
|
||||
return apiResponse;
|
||||
} catch (e) {
|
||||
@@ -219,8 +223,8 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
String serviceApi = ServiceConstant.device_bind;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
String? language = "";
|
||||
if (languageController.selectLanguage != null) {
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (language != null && language.isNotEmpty) {
|
||||
if (queryUrl.contains("?")) {
|
||||
@@ -355,8 +359,8 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
String serviceApi = ServiceConstant.device_show;
|
||||
String queryUrl = "$serviceAddress$serviceName$serviceApi";
|
||||
String? language = "";
|
||||
if (languageController.selectLanguage != null) {
|
||||
language = languageController.selectLanguage.value!.language_code;
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
if (language != null && language.isNotEmpty) {
|
||||
if (queryUrl.contains("?")) {
|
||||
@@ -393,7 +397,7 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
|
||||
|
||||
//查询人员信息列表
|
||||
Future<void> getPersonList() async {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备列表请求失败".tr);
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.personnel_info;
|
||||
|
||||
@@ -204,21 +204,21 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
child: userInfo(userInfoController.model.login),
|
||||
);
|
||||
}),
|
||||
const Spacer(), // 左右分隔
|
||||
FloatingSvgIcon(
|
||||
assetPath: 'assets/img/icon/xiaoyi.svg',
|
||||
width: 60.rpx,
|
||||
height: 60.rpx,
|
||||
onTap: () {
|
||||
// print("点击了小鹅图标");
|
||||
if (userInfoController.model.login == 0) {
|
||||
Get.toNamed("/loginPage");
|
||||
}
|
||||
Get.toNamed("/xiaoEPage",
|
||||
arguments:
|
||||
"https://xiaoe.he-info.cn/?mac=b43a45c3ddf4");
|
||||
},
|
||||
),
|
||||
// const Spacer(), // 左右分隔
|
||||
// FloatingSvgIcon(
|
||||
// assetPath: 'assets/img/icon/xiaoyi.svg',
|
||||
// width: 60.rpx,
|
||||
// height: 60.rpx,
|
||||
// onTap: () {
|
||||
// // print("点击了小鹅图标");
|
||||
// if (userInfoController.model.login == 0) {
|
||||
// Get.toNamed("/loginPage");
|
||||
// }
|
||||
// Get.toNamed("/xiaoEPage",
|
||||
// arguments:
|
||||
// "https://xiaoe.he-info.cn/?mac=b43a45c3ddf4");
|
||||
// },
|
||||
// ),
|
||||
SizedBox(width: 40.rpx),
|
||||
],
|
||||
),
|
||||
@@ -441,8 +441,8 @@ class _NewHomePageState extends State<NewHomePage> {
|
||||
deviceController
|
||||
.personnelList.value
|
||||
.map<String>((d) {
|
||||
var s = d["name"] ??
|
||||
d["mac"];
|
||||
var s =
|
||||
d["name"] ?? d["mac"];
|
||||
if (s == null) {
|
||||
return "";
|
||||
} else {
|
||||
|
||||
@@ -12,23 +12,13 @@ class IssueListPage extends GetView<IssueListController> {
|
||||
BoxConstraints? bodysize;
|
||||
|
||||
IssueListController controller = Get.put(IssueListController());
|
||||
// ScrollController scrollController = ScrollController();
|
||||
// IssueListPage() {
|
||||
// controller.model.issueList!.clear();
|
||||
// controller.initData();
|
||||
|
||||
// scrollController.addListener(() {
|
||||
// if (scrollController.position.pixels ==
|
||||
// scrollController.position.maxScrollExtent &&
|
||||
// controller.model.hasMore) {
|
||||
// controller.initData();
|
||||
// controller.updateAll();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
fetchData() async {
|
||||
await controller.getIssueList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
fetchData();
|
||||
return LayoutBuilder(builder: (context, cc) {
|
||||
bodysize = cc;
|
||||
return GestureDetector(
|
||||
|
||||
@@ -18,94 +18,80 @@ class IssuePreviewWidget extends GetView<IssuePreviewInfoController> {
|
||||
required this.issueListController,
|
||||
});
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
// issueListController.model.selectedIndex = index;
|
||||
// issueListController.updateAll();
|
||||
// await Future.delayed(Duration(milliseconds: 100));
|
||||
// issueListController.model.selectedIndex = -1;
|
||||
// issueListController.updateAll();
|
||||
var article = issueListController.model.issueList![index];
|
||||
Get.toNamed("/helpArticle", arguments: article);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "功能开发中...",
|
||||
// );
|
||||
},
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
// minWidth: 100,
|
||||
minHeight: 119.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(0),
|
||||
// 整行的背景颜色
|
||||
color: index == issueListController.model.selectedIndex
|
||||
? Colors.grey[300]
|
||||
: Colors.transparent,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: const Color(0xFF929699), width: 0.rpx),
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
var article = issueListController.model.issueList![index];
|
||||
Get.toNamed("/helpArticle", arguments: article);
|
||||
},
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(minHeight: 119.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: index == issueListController.model.selectedIndex
|
||||
? Colors.grey[300]
|
||||
: Colors.transparent,
|
||||
border: Border(
|
||||
bottom:
|
||||
BorderSide(color: const Color(0xFF929699), width: 0.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(16.rpx, 0, 41.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 9,
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, -1),
|
||||
child: Text(
|
||||
issueListController.model.issueList![index]['title'] ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFFFFFFF),
|
||||
fontSize: AppFontsize.title_size,
|
||||
letterSpacing: 0,
|
||||
// height: 1,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(16.rpx, 0, 41.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 9,
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, -1),
|
||||
child: Text(
|
||||
issueListController.model.issueList![index]['title'] ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFFFFFFF),
|
||||
fontSize: AppFontsize.title_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: ClickableContainer(
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(right: 0),
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand.svg',
|
||||
color: Colors.white,
|
||||
)
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios,
|
||||
// color: Colors.white,
|
||||
// // size: 14.rpx,
|
||||
// ),
|
||||
)),
|
||||
height: 30.rpx,
|
||||
width: 30.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/expand.svg',
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class MessageDetailPage extends StatefulWidget {
|
||||
class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
MHDeviceShareController controller = Get.find();
|
||||
MhMessageController messageController = Get.find();
|
||||
RxInt status = 0.obs;
|
||||
RxInt status = 1.obs;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
status.value = widget.data['status'];
|
||||
@@ -158,7 +158,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
))),
|
||||
),
|
||||
const Spacer(),
|
||||
bottomIcon(context)
|
||||
bottomIcon(context, messageInfo)
|
||||
],
|
||||
)),
|
||||
),
|
||||
@@ -167,7 +167,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
));
|
||||
}
|
||||
|
||||
Container bottomIcon(BuildContext context) {
|
||||
Container bottomIcon(BuildContext context, var messageInfo) {
|
||||
return Container(
|
||||
height: 120.rpx,
|
||||
decoration: BoxDecoration(
|
||||
@@ -182,8 +182,11 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!, textColor: Color(0xFF00C1AA));
|
||||
messageController.getMessageList(widget.data['type']);
|
||||
messageController.updateAll();
|
||||
messageController.updateMessageReadStatus(
|
||||
context, messageInfo['type'],
|
||||
mid: messageInfo['_id']);
|
||||
// messageController.getMessageList(widget.data['type']);
|
||||
// messageController.updateAll();
|
||||
//todo 更新设备列表
|
||||
MHTHomeController homeController = Get.find();
|
||||
//更新设备列表
|
||||
@@ -230,6 +233,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
messageController.getMessageList(widget.data['type']);
|
||||
messageController.updateAll();
|
||||
}
|
||||
status.value = 2;
|
||||
}
|
||||
},
|
||||
child: Obx(() => Text(
|
||||
|
||||
@@ -31,43 +31,6 @@ class _MinePageState extends State<NewMinePage> {
|
||||
UserInfoController userInfoController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
MhMessageController messageController = Get.find();
|
||||
// final GlobalKey _textKey = GlobalKey();
|
||||
|
||||
// double _textHalfWidth = 0;
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
|
||||
// final login = userInfoController.model.login;
|
||||
// String text;
|
||||
|
||||
// if (login == 0) {
|
||||
// text = '未命名'.tr;
|
||||
// } else {
|
||||
// final nickname = userInfoController.model.user?.nick_name;
|
||||
// text = (nickname != null && nickname.isNotEmpty) ? nickname : '未命名'.tr;
|
||||
// }
|
||||
|
||||
// _calculateTextHalfWidth(text);
|
||||
// }
|
||||
|
||||
// void _calculateTextHalfWidth(String text) {
|
||||
// final textSpan = TextSpan(
|
||||
// text: text,
|
||||
// style: TextStyle(
|
||||
// fontSize: 30.rpx,
|
||||
// height: 1,
|
||||
// ),
|
||||
// );
|
||||
// final textPainter = TextPainter(
|
||||
// text: textSpan,
|
||||
// textDirection: ui.TextDirection.ltr,
|
||||
// );
|
||||
// textPainter.layout(); // 计算文本宽度
|
||||
// setState(() {
|
||||
// _textHalfWidth = textPainter.width / 2;
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -100,29 +63,35 @@ class _MinePageState extends State<NewMinePage> {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(right: 38.rpx),
|
||||
padding: EdgeInsets.only(right: 20.rpx),
|
||||
onTap: () {
|
||||
Get.toNamed('/messagePage');
|
||||
},
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
// 扩大点击区域但不影响SVG图标尺寸
|
||||
Container(
|
||||
height: 42.rpx,
|
||||
width: 42.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/message.svg',
|
||||
color: Colors.white,
|
||||
width: 60.rpx, // 比图标大
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/message.svg',
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (messageController.model.body_message_read == 1 ||
|
||||
messageController.model.system_message_read == 1)
|
||||
Positioned(
|
||||
top: 4.rpx,
|
||||
right: -10.rpx,
|
||||
top: 8.rpx,
|
||||
right: -1.rpx,
|
||||
child: Container(
|
||||
width: 12.rpx,
|
||||
height: 12.rpx,
|
||||
width: 14.rpx,
|
||||
height: 14.rpx,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.circle,
|
||||
@@ -143,11 +112,12 @@ class _MinePageState extends State<NewMinePage> {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.rpx, left: 60.rpx, bottom: 190.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.rpx, left: 60.rpx, bottom: 190.rpx),
|
||||
child: Row(
|
||||
children: [
|
||||
Obx(() {
|
||||
return Container(
|
||||
width: 120.rpx,
|
||||
height: 120.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
@@ -172,111 +142,110 @@ class _MinePageState extends State<NewMinePage> {
|
||||
"assets/images/mine_avatar.png",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
login == 1
|
||||
? (userInfoController
|
||||
.model.user!.nick_name ??
|
||||
'未命名'.tr)
|
||||
: "未命名".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
AppConstants().title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
);
|
||||
}),
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
login == 1
|
||||
? (userInfoController
|
||||
.model.user!.nick_name ??
|
||||
'未命名'.tr)
|
||||
: "未命名".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
AppConstants().title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: const Color(0xFF055466),
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () async {
|
||||
if (userInfoController.model.login ==
|
||||
null ||
|
||||
userInfoController.model.login ==
|
||||
0) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "必须登录提示".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc9,
|
||||
);
|
||||
Get.toNamed("/loginPage");
|
||||
return;
|
||||
}
|
||||
await Get.toNamed(
|
||||
"/editUserInfoPage");
|
||||
await userInfoController
|
||||
.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
final login =
|
||||
userInfoController.model.login;
|
||||
String text;
|
||||
|
||||
if (login == 0) {
|
||||
text = '未命名'.tr;
|
||||
} else {
|
||||
final nickname = userInfoController
|
||||
.model.user?.nick_name;
|
||||
text = (nickname != null &&
|
||||
nickname.isNotEmpty)
|
||||
? nickname
|
||||
: '未命名'.tr;
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/edit.svg',
|
||||
color: Colors.white,
|
||||
width: 18.rpx,
|
||||
height: 18.rpx,
|
||||
),
|
||||
)),
|
||||
].divide(SizedBox(
|
||||
width: 20.rpx,
|
||||
)),
|
||||
),
|
||||
Text(
|
||||
login == 1
|
||||
? (() {
|
||||
final user =
|
||||
userInfoController.model.user!;
|
||||
if (user.email != null &&
|
||||
user.email!.isNotEmpty) {
|
||||
return user.email!;
|
||||
} else if (user.phone != null &&
|
||||
user.phone!.isNotEmpty) {
|
||||
return MyUtils.hidePhoneNumber(
|
||||
user.phone!);
|
||||
} else {
|
||||
return "微信用户".tr;
|
||||
}
|
||||
})()
|
||||
: "未知数据".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: const Color(0xFF055466),
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () async {
|
||||
if (userInfoController.model.login ==
|
||||
null ||
|
||||
userInfoController.model.login ==
|
||||
0) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "必须登录提示".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc9,
|
||||
);
|
||||
Get.toNamed("/loginPage");
|
||||
return;
|
||||
}
|
||||
await Get.toNamed("/editUserInfoPage");
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
final login =
|
||||
userInfoController.model.login;
|
||||
String text;
|
||||
|
||||
if (login == 0) {
|
||||
text = '未命名'.tr;
|
||||
} else {
|
||||
final nickname = userInfoController
|
||||
.model.user?.nick_name;
|
||||
text = (nickname != null &&
|
||||
nickname.isNotEmpty)
|
||||
? nickname
|
||||
: '未命名'.tr;
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/edit.svg',
|
||||
color: Colors.white,
|
||||
width: 18.rpx,
|
||||
height: 18.rpx,
|
||||
),
|
||||
)),
|
||||
].divide(SizedBox(
|
||||
width: 20.rpx,
|
||||
)),
|
||||
),
|
||||
Text(
|
||||
login == 1
|
||||
? (() {
|
||||
final user =
|
||||
userInfoController.model.user!;
|
||||
if (user.email != null &&
|
||||
user.email!.isNotEmpty) {
|
||||
return user.email!;
|
||||
} else if (user.phone != null &&
|
||||
user.phone!.isNotEmpty) {
|
||||
return MyUtils.hidePhoneNumber(
|
||||
user.phone!);
|
||||
} else {
|
||||
return "微信用户".tr;
|
||||
}
|
||||
})()
|
||||
: "未知数据".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
color: themeController.currentColor.sc4,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
],
|
||||
))
|
||||
].divide(SizedBox(
|
||||
width: 30.rpx,
|
||||
)),
|
||||
),
|
||||
],
|
||||
))
|
||||
].divide(SizedBox(
|
||||
width: 30.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
|
||||
Expanded(
|
||||
child: Container(
|
||||
@@ -304,15 +273,15 @@ class _MinePageState extends State<NewMinePage> {
|
||||
'当您的智能设备需要报修时,可以通过该功能联系解决,'.tr,
|
||||
path: '/deviceRepairPage',
|
||||
),
|
||||
_buildListTile('assets/img/icon/mall.svg', '网上商城'.tr,
|
||||
'最新的智能产品线上购买服务'.tr,
|
||||
path: "", onTap: () {
|
||||
_buildListTile('assets/img/icon/mall.svg',
|
||||
'网上商城'.tr, '最新的智能产品线上购买服务'.tr, path: "",
|
||||
onTap: () {
|
||||
JDLauncher.openShop(
|
||||
"https://mall.jd.com/index-14587480.html");
|
||||
}),
|
||||
_buildListTile('assets/img/icon/address.svg',
|
||||
'地址管理'.tr, '用于收货和报修时联系您'.tr,
|
||||
path: "/addressListPage"),
|
||||
// _buildListTile('assets/img/icon/address.svg',
|
||||
// '地址管理'.tr, '用于收货和报修时联系您'.tr,
|
||||
// path: "/addressListPage"),
|
||||
_buildListTile('assets/img/icon/help.svg',
|
||||
'问题与帮助'.tr, '常见的问题汇总,如:智能床连接流程、如何查看睡眠报告'.tr,
|
||||
path: "/issueListpage"),
|
||||
@@ -474,8 +443,8 @@ class _MinePageState extends State<NewMinePage> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.rpx)),
|
||||
),
|
||||
child:
|
||||
Text('设置'.tr, style: TextStyle(fontSize: 26.rpx, color: Colors.white)),
|
||||
child: Text('设置'.tr,
|
||||
style: TextStyle(fontSize: 26.rpx, color: Colors.white)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
34.rpx, 10, 0, 0),
|
||||
34.rpx, 10, 0, 35.rpx),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(),
|
||||
child: Column(
|
||||
@@ -230,23 +230,23 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(0, 10, 0, 24),
|
||||
.fromSTEB(0, 10, 0, 0),
|
||||
child: Container(
|
||||
width:
|
||||
MediaQuery.sizeOf(context)
|
||||
.width,
|
||||
height:
|
||||
MediaQuery.sizeOf(context)
|
||||
.height *
|
||||
0.15,
|
||||
// height:
|
||||
// MediaQuery.sizeOf(context)
|
||||
// .height *
|
||||
// 0.15,
|
||||
constraints:
|
||||
const BoxConstraints(
|
||||
|
||||
// minHeight: 140,
|
||||
),
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
width: 90,
|
||||
height: 90,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
scrollDirection:
|
||||
@@ -333,7 +333,8 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
||||
thickness: 1, // 线条厚度
|
||||
),
|
||||
endChild: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: EdgeInsets.only(
|
||||
left: 10.rpx, top: 2.rpx),
|
||||
child: RepairStatusWidget(
|
||||
data: data['flow'][index]),
|
||||
),
|
||||
@@ -649,24 +650,36 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
||||
});
|
||||
}
|
||||
|
||||
// List<Widget> getImage(List<dynamic> imgurl) {
|
||||
// List<Widget> images = [];
|
||||
// ApplyRepairController controller = Get.find();
|
||||
// imgurl!.forEach((element) async {
|
||||
// images.add(
|
||||
// Container(
|
||||
// child: ImgPreviewWidget(
|
||||
// imgUrl: element,
|
||||
// index: imgurl!.indexOf(element),
|
||||
// applyRepairController: controller,
|
||||
// isDel: false,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// });
|
||||
// return images;
|
||||
// }
|
||||
List<Widget> getImage(List<dynamic> imgurl) {
|
||||
List<Widget> images = [];
|
||||
ApplyRepairController controller = Get.find();
|
||||
imgurl!.forEach((element) async {
|
||||
images.add(
|
||||
Container(
|
||||
// height: 10,
|
||||
// width: 10,
|
||||
|
||||
child: ImgPreviewWidget(
|
||||
imgUrl: element,
|
||||
index: imgurl!.indexOf(element),
|
||||
applyRepairController: controller,
|
||||
isDel: false,
|
||||
),
|
||||
return imgurl.map<Widget>((element) {
|
||||
return SizedBox(
|
||||
width: 90,
|
||||
height: 90,
|
||||
child: ImgPreviewWidget(
|
||||
imgUrl: element,
|
||||
index: imgurl.indexOf(element),
|
||||
applyRepairController: controller,
|
||||
isDel: false,
|
||||
),
|
||||
);
|
||||
});
|
||||
return images;
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,50 +117,107 @@ class DeviceRepairPage extends GetView<RepairListController> {
|
||||
),
|
||||
SizedBox(height: 33.rpx),
|
||||
// 可滚动的正文部分,限定高度
|
||||
// Expanded(
|
||||
// child: SingleChildScrollView(
|
||||
// child: RichText(
|
||||
// text: TextSpan(
|
||||
// style: TextStyle(
|
||||
// color: Color(0XFF929699),
|
||||
// fontSize: 26.rpx,
|
||||
// ),
|
||||
// children: [
|
||||
// TextSpan(
|
||||
// text:
|
||||
// "尊敬的用户,感谢您选择我司产品。在使用过程中,如果设备出现故障需要维修,请首先确认设备是否正确连接控制器或网络,检查设置是否正常,排除误操作问题。若问题依然存在,请记录下设备名称、设备编号、和具体故障内容,方便我们快速地为您提供帮助。您可以通过智慧棉花糖APP保修页面直接报修或拨打 "
|
||||
// .tr,
|
||||
// style: TextStyle(
|
||||
// color: Color(0XFF929699),
|
||||
// fontSize: 26.rpx,
|
||||
// height: 1.3)),
|
||||
// TextSpan(
|
||||
// text: "400-8756-966",
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// // height: 1.3,
|
||||
// decoration: TextDecoration
|
||||
// .underline, // 添加下划线
|
||||
// decorationColor: Colors.white,
|
||||
// decorationThickness: 4.rpx,
|
||||
// ),
|
||||
// recognizer: TapGestureRecognizer()
|
||||
// ..onTap = () {
|
||||
// MyUtils.makePhoneCall(
|
||||
// "400-8756-966");
|
||||
// },
|
||||
// ),
|
||||
// TextSpan(
|
||||
// text: " 反馈。".tr,
|
||||
// style: TextStyle(
|
||||
// color: Color(0XFF929699),
|
||||
// fontSize: 26.rpx,
|
||||
// height: 1.3)),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Color(0XFF929699),
|
||||
fontSize: 26.rpx,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
right: 0,
|
||||
),
|
||||
child: Scrollbar(
|
||||
thumbVisibility:
|
||||
true, // 滚动时显示滑块,false 时仅在滚动中短暂显示
|
||||
thickness: 4.rpx,
|
||||
child: SingleChildScrollView(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
color: Color(0XFF929699),
|
||||
fontSize: 26.rpx,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text:
|
||||
"尊敬的用户,感谢您选择我司产品。在使用过程中,如果设备出现故障需要维修,请首先确认设备是否正确连接控制器或网络,检查设置是否正常,排除误操作问题。若问题依然存在,请记录下设备名称、设备编号、和具体故障内容,方便我们快速地为您提供帮助。您可以通过智慧棉花糖APP保修页面直接报修或拨打 "
|
||||
.tr,
|
||||
style: TextStyle(
|
||||
color: Color(0XFF929699),
|
||||
fontSize: 26.rpx,
|
||||
height: 1.3)),
|
||||
TextSpan(
|
||||
text: "400-8756-966",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
// height: 1.3,
|
||||
decoration: TextDecoration
|
||||
.underline, // 添加下划线
|
||||
decorationColor: Colors.white,
|
||||
decorationThickness: 4.rpx,
|
||||
color: Color(0XFF929699),
|
||||
fontSize: 26.rpx,
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
MyUtils.makePhoneCall(
|
||||
"400-8756-966");
|
||||
},
|
||||
),
|
||||
TextSpan(
|
||||
TextSpan(
|
||||
text: "400-8756-966",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
decoration:
|
||||
TextDecoration.underline,
|
||||
decorationColor: Colors.white,
|
||||
decorationThickness: 4.rpx,
|
||||
),
|
||||
recognizer:
|
||||
TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
MyUtils.makePhoneCall(
|
||||
"400-8756-966");
|
||||
},
|
||||
),
|
||||
TextSpan(
|
||||
text: " 反馈。".tr,
|
||||
style: TextStyle(
|
||||
color: Color(0XFF929699),
|
||||
fontSize: 26.rpx,
|
||||
height: 1.3)),
|
||||
],
|
||||
color: Color(0XFF929699),
|
||||
fontSize: 26.rpx,
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
))
|
||||
],
|
||||
))),
|
||||
SizedBox(height: 24.rpx),
|
||||
|
||||
@@ -85,50 +85,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
||||
left: 0.rpx,
|
||||
child: returnIconButtomNew(),
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 10.rpx,
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData();
|
||||
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;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
stringToColor("FCFCFC"),
|
||||
stringToColor("CEECE3"),
|
||||
],
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
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: stringToColor("#011D33"),
|
||||
letterSpacing: 0.0,
|
||||
fontSize: AppConstants().normal_text_fontSize),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -143,174 +100,258 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
60.rpx, 0.rpx, 60.rpx, 0.rpx),
|
||||
30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.213,
|
||||
height: MediaQuery.sizeOf(context).height * 0.098,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 160.rpx,
|
||||
minHeight: 160.rpx,
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width:
|
||||
MediaQuery.sizeOf(context).width * 0.213,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height * 0.098,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 160.rpx,
|
||||
minHeight: 160.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() {
|
||||
return getImageWidget(context);
|
||||
})),
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() {
|
||||
return getImageWidget(context);
|
||||
})),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc2,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 44.rpx, 0.rpx, 44.rpx),
|
||||
borderRadius: 0,
|
||||
onTap: () async {
|
||||
edm.EasyDartModule.logger
|
||||
.info("${userInfoController.model.user!}点击上传头像");
|
||||
DailyLogUtils.writeLog(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.uploadImg();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Text(
|
||||
'点击更换头像'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#85F5FF"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 79.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: TextFormField(
|
||||
initialValue: userInfoController
|
||||
.model.user!.nick_name,
|
||||
onChanged: (value) {
|
||||
userInfoController.model.user!
|
||||
.tmpNickName = 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(
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
filled: false,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 38.rpx), // 保持上下间距
|
||||
child: Center(
|
||||
child: ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc2,
|
||||
borderRadius: 8.rpx, // 可选,点击反馈更明显
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 12.rpx,
|
||||
vertical: 12.rpx), // 控制点击热区大小
|
||||
onTap: () async {
|
||||
edm.EasyDartModule.logger.info(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
DailyLogUtils.writeLog(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.uploadImg();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code ==
|
||||
HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'点击更换头像'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#85F5FF"),
|
||||
),
|
||||
].divide(SizedBox(width: 27.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 79.rpx, 30.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
TextFormField(
|
||||
initialValue: userInfoController
|
||||
.model.user!.nick_name,
|
||||
onChanged: (value) {
|
||||
userInfoController.model.user!
|
||||
.tmpNickName = value;
|
||||
},
|
||||
maxLength:
|
||||
AppConstants().text_length,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
textAlignVertical:
|
||||
TextAlignVertical.center,
|
||||
buildCounter: (_,
|
||||
{int? currentLength,
|
||||
bool? isFocused,
|
||||
int? maxLength}) =>
|
||||
null, // 禁用默认计数器
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 30.rpx),
|
||||
isDense: true,
|
||||
hintText: '未命名'.tr,
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
enabledBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
Colors.transparent,
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
Colors.transparent,
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
filled: false,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
|
||||
// 自定义右下角计数器
|
||||
Positioned(
|
||||
bottom: 4.rpx,
|
||||
right: 8.rpx,
|
||||
child: Obx(() {
|
||||
final text =
|
||||
userInfoController
|
||||
.model
|
||||
.user!
|
||||
.tmpNickName ??
|
||||
'';
|
||||
return Text(
|
||||
'${text.length} / ${AppConstants().text_length}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.rpx,
|
||||
color: Colors.grey,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
)),
|
||||
].divide(SizedBox(width: 27.rpx)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 0.rpx, right: 0.rpx, bottom: 85.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: 10.rpx,
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData();
|
||||
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;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
stringToColor("FCFCFC"),
|
||||
stringToColor("CEECE3"),
|
||||
],
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
child: Container(
|
||||
// width: 100.rpx,
|
||||
height: 90.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0.rpx, 16.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'保存'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: stringToColor("#011D33"),
|
||||
letterSpacing: 0.0,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user