Commit e15185b6 by 吴春元

1.0.4正式版本上线:

1、登录页面 "欢迎登录"文字改为 "晋特保助手"。
2、首页使用单位和生产单位切换,您的身份:生产单位-安全总监、安全员改为质量安全总监、质量安全员。
3、公司账户:用户设置列表文字样式没有换行问题修改。
parent 100c118f
......@@ -4,7 +4,7 @@ class Api {
static var IS_DEBUG = true;
static String URL =
IS_DEBUG ? "https://special.sxyztech.cn/" : "http://47.92.138.92:8009/";
IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.215:8181/";
///演示 ip
// static String URL = "http://47.92.138.92:8009/";
......
......@@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
import 'package:get/route_manager.dart';
import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_error.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/dialog/loading_dialog_helper.dart';
......@@ -46,6 +47,7 @@ class DoUtils {
} else {
///errorCode==0 表示登录失效,重新登录
if (responseData['errorCode'] == '0') {
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else {
ToastUtils.showCenter('${responseData['msg']}');
......@@ -91,6 +93,7 @@ class DoUtils {
} else {
///errorCode==0 表示登录失效,重新登录
if (responseData['errorCode'] == '0') {
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else {
ToastUtils.showCenter('${responseData['msg']}');
......@@ -137,6 +140,7 @@ class DoUtils {
} else {
//errorCode==0 表示登录失效,重新登录
if (responseData['errorCode'] == '0') {
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else {
ToastUtils.showCenter('${responseData['msg']}');
......@@ -185,6 +189,7 @@ class DoUtils {
} else {
//errorCode==0 表示登录失效,重新登录
if (responseData['errorCode'] == '0') {
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else {
ToastUtils.showCenter('${responseData['msg']}');
......
......@@ -39,32 +39,50 @@ import 'api.dart';
import 'net_utils.dart';
class HttpUtils {
///登录接口
static Future doLogin(
BuildContext context, String userName, String passWord) async {
/// 登录接口
static void doLogin(BuildContext context, String userName, String passWord,
{Function(LoginBo bo)? onSuccess}) {
Map<String, dynamic> params = {
'username': userName,
'password': passWord,
};
var response =
await NetUtils.post(context, Api.LOGIN_URL, true, '登录中', params);
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
LoginBo loginBo = LoginBo.fromJson(resultData);
if (entity.errorCode == '-1') {
// ToastUtils.showCenter( entity.msg!,gravity: ToastGravity.CENTER,);
return loginBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} catch (e) {
log(e.toString());
return {"message": e.toString()};
}
DoUtils.post(context, Api.LOGIN_URL,
parameters: params,
isLoading: true,
loadingText: '登录中', onSuccess: (Response response) {
var resultObj =
ResultObjBo.fromJson(response.data, (json) => LoginBo.fromJson(json));
LoginBo? bo = resultObj.body;
onSuccess!(bo!);
}, onError: (e) {});
}
///登录接口
// static Future doLogin(
// BuildContext context, String userName, String passWord) async {
// Map<String, dynamic> params = {
// 'username': userName,
// 'password': passWord,
// };
// var response =
// await NetUtils.post(context, Api.LOGIN_URL, true, '登录中', params);
// try {
// BaseModel entity = BaseModel.fromJson(response);
// Map<String, dynamic> resultData = entity.body;
// LoginBo loginBo = LoginBo.fromJson(resultData);
// if (entity.errorCode == '-1') {
// // ToastUtils.showCenter( entity.msg!,gravity: ToastGravity.CENTER,);
// return loginBo;
// } else {
// ToastUtils.showCenter(entity.msg!);
// return;
// }
// } catch (e) {
// log(e.toString());
// return {"message": e.toString()};
// }
// }
///退出接口
static Future doLoginOut(BuildContext context) async {
Map<String, dynamic> params = {};
......
......@@ -9,7 +9,6 @@ import 'package:flutter/material.dart';
import 'package:get/route_manager.dart';
import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/model/base/base_model.dart';
import 'package:special_equipment_flutter/utils/sp_util.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/dialog/loading_dialog_helper.dart';
......@@ -40,8 +39,8 @@ class NetUtils {
BaseModel entity = BaseModel.fromJson(response.data);
if (entity.errorCode == '0') {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else if (entity.errorCode == '-1') {
} else {
......@@ -105,8 +104,8 @@ class NetUtils {
if (entity.success!) {
if (entity.errorCode == '0') {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else if (entity.errorCode == '-1') {
} else {
......@@ -155,8 +154,8 @@ class NetUtils {
if (entity.success!) {
if (entity.errorCode == '0') {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else if (entity.errorCode == '-1') {
} else {
......@@ -191,8 +190,8 @@ class NetUtils {
if (entity.success!) {
if (entity.errorCode == '0') {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else if (entity.errorCode == '-1') {
} else {
......@@ -226,8 +225,8 @@ class NetUtils {
if (entity.success!) {
if (entity.errorCode == '0') {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else if (entity.errorCode == '-1') {
} else {
......@@ -264,8 +263,8 @@ class NetUtils {
if (entity.success!) {
if (entity.errorCode == '0') {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAndToNamed(RouteString.LOGIN);
} else if (entity.errorCode == '-1') {
} else {
......
......@@ -10,6 +10,7 @@ class StandingConfig {
static const String SAFETY_OFFICER = "安全员";
static const String SAFETY_DIRECTOR = "安全总监";
static const String PERSON_CHARGE = "主要负责人";
static const String SY_DEVICE = '客运索道,电梯,起重机械,锅炉,压力管道,压力容器,大型游乐设施,场车,气瓶';
}
bool? isUnitRoles(rolesName) {
......
......@@ -12,7 +12,6 @@ import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/login_bo.dart';
import 'package:special_equipment_flutter/ui/common/data.dart';
import 'package:special_equipment_flutter/utils/sp_util.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
......@@ -100,8 +99,10 @@ class EditTextState extends State<EditTextWidget>
setState(() {});
});
phoneController.value =
phoneController.value.copyWith(text: Api.IS_DEBUG ? '' : 'csgs123');
phoneController.value = phoneController.value.copyWith(
text: Api.IS_DEBUG
? StorageUtil.getInstance().getUserName()
: '15201506331');
passController.value =
passController.value.copyWith(text: Api.IS_DEBUG ? '' : 'Aa123456.');
super.initState();
......@@ -188,6 +189,7 @@ class EditTextState extends State<EditTextWidget>
},
),
),
const SizedBox(width: 5),
buildTitle()
],
),
......@@ -197,6 +199,7 @@ class EditTextState extends State<EditTextWidget>
accountTextField(context), //账号
const SizedBox(height: 12), //账号和密码间距
buildPasswordTextField(context), //密码
const SizedBox(height: 40), //密码和登录按钮间距
//嵌套SizedBox, 设置button的宽高
buildLogin(),
......@@ -287,19 +290,13 @@ class EditTextState extends State<EditTextWidget>
}
Widget buildTitle() {
return const Padding(
// 设置边距
padding: EdgeInsets.all(5),
child: Align(
alignment: Alignment.bottomLeft,
child: Text(
'欢迎登录',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
),
),
));
return const Text(
'晋特宝助手',
style: TextStyle(
fontSize: 25,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold),
);
}
Widget buildTips() {
......@@ -545,9 +542,9 @@ class EditTextState extends State<EditTextWidget>
//登录
_startLogin(username, pwd) async {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
SPUtil().clearAll();
HttpUtils.doLogin(context, username, pwd).then((value) {
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
HttpUtils.doLogin(context, username, pwd, onSuccess: (value) {
if (value != null) {
LoginBo loginBo = value;
StorageUtil.getInstance().set(SpKeys.USER_NAME, loginBo.username);
......@@ -580,6 +577,40 @@ class EditTextState extends State<EditTextWidget>
}
}
});
// HttpUtils.doLogin(context, username, pwd).then((value) {
// if (value != null) {
// LoginBo loginBo = value;
// StorageUtil.getInstance().set(SpKeys.USER_NAME, loginBo.username);
// StorageUtil.getInstance().set(SpKeys.NAME, loginBo.name);
// StorageUtil.getInstance().set(SpKeys.JSESSION_ID, loginBo.jsessionid);
// StorageUtil.getInstance().set(SpKeys.USER_ID, loginBo.userId);
// StorageUtil.getInstance()
// .set(SpKeys.OFFICE_ID, loginBo.user!.office!.id);
// StorageUtil.getInstance()
// .set(SpKeys.OFFICE_TYPE, loginBo.user!.office!.type);
// StorageUtil.getInstance()
// .set(SpKeys.OFFICE_NAME, loginBo.user!.office!.name);
// StorageUtil.getInstance()
// .set(SpKeys.ROLE_NAMES, loginBo.user!.roleNames);
//
// ///公司账户
// if (isUnitRoles(loginBo.user!.roleNames)!) {
// Get.offAllNamed(RouteString.HOME);
// } else {
// var split = loginBo.user!.office!.type!.split(",");
// switch (split.length) {
// case 1:
// StorageUtil.getInstance().set(SpKeys.UNIT_STATUS, split[0]);
// Get.offAllNamed(RouteString.HOME);
// break;
// case 2:
// showUnitTypeDialog(split);
// break;
// }
// }
// }
// });
}
}
......
......@@ -12,7 +12,6 @@ import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/check_update.dart';
import 'package:special_equipment_flutter/model/count_bo.dart';
import 'package:special_equipment_flutter/model/device_list_bo.dart';
import 'package:special_equipment_flutter/model/echart_bo.dart';
import 'package:special_equipment_flutter/model/find_charge_list_bo.dart';
import 'package:special_equipment_flutter/model/find_count_bo.dart';
......@@ -435,7 +434,7 @@ class _HomePageState extends State<HomePage>
style: const TextStyle(fontSize: 12, color: Colors.red)),
],
),
content: buildTable(value!, isUser),
content: buildTable(value, isUser),
actions: <Widget>[
Center(
child: GradientButton(
......@@ -498,7 +497,11 @@ class _HomePageState extends State<HomePage>
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.roleName!,
child: Text(
!StandingConfig.SY_DEVICE
.contains(value.name!)
? item.roleName!.replaceAll('(质量)', '质量')
: item.roleName!.replaceAll('(质量)', ''),
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
......@@ -517,7 +520,11 @@ class _HomePageState extends State<HomePage>
child: Container(
height: 30,
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: Text(item.roleName!,
child: Text(
!StandingConfig.SY_DEVICE
.contains(value.name!)
? item.roleName!.replaceAll('(质量)', '质量')
: item.roleName!.replaceAll('(质量)', ''),
style: const TextStyle(
fontSize: 13, color: Colors.black)),
)),
......@@ -955,7 +962,7 @@ class _HomePageState extends State<HomePage>
fontSize: SizeConfig.isIpad()! ? 20 : 12,
fontStyle: FontStyle.normal)),
TextSpan(
text: roleNames,
text: roleNamesText(unitId),
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.isIpad()! ? 20 : 12,
......@@ -972,6 +979,57 @@ class _HomePageState extends State<HomePage>
);
}
///切换使用单位、生产单位(安全总监、安全员加质量),重新赋值身份
roleNamesText(unitId) {
var roleName = '';
if (roleNames.contains(StandingConfig.SAFETY_DIRECTOR) ||
roleNames.contains(StandingConfig.SAFETY_OFFICER) ||
roleNames.contains(StandingConfig.PERSON_CHARGE)) {
var roleNameStr = roleNames.split(',');
if (roleNames.contains(StandingConfig.PERSON_CHARGE)) {
if (roleNameStr.length == 1) {
roleName = roleName += '主要负责人';
} else {
roleName = roleName += '主要负责人,';
}
} else {
roleName = roleName += '';
}
///使用单位
if (unitId == '1') {
//安全总监、安全员
if (roleNames.contains(StandingConfig.SAFETY_DIRECTOR) &&
roleNames.contains(StandingConfig.SAFETY_OFFICER)) {
roleName = roleName += '安全总监,安全员';
} else if (roleNames.contains(StandingConfig.SAFETY_OFFICER)) {
//安全员
roleName = roleName += '安全员';
} else if (roleNames.contains(StandingConfig.SAFETY_DIRECTOR)) {
//安全总监
roleName = roleName += '安全总监';
}
///生产单位
} else if (unitId == '2') {
//安全总监、安全员
if (roleNames.contains(StandingConfig.SAFETY_DIRECTOR) &&
roleNames.contains(StandingConfig.SAFETY_OFFICER)) {
roleName = roleName += '质量安全总监,质量安全员';
} else if (roleNames.contains(StandingConfig.SAFETY_OFFICER)) {
//安全员
roleName = roleName += '质量安全员';
} else if (roleNames.contains(StandingConfig.SAFETY_DIRECTOR)) {
//安全总监
roleName = roleName += '质量安全总监';
}
}
} else {
roleName = roleNames;
}
return roleName;
}
String? buildCount(index) {
if (index == 0) {
return dayCount ?? '0';
......@@ -1109,7 +1167,8 @@ class _HomePageState extends State<HomePage>
HttpUtils.doLoginOut(context).then((value) {
if (mounted) {
///清除本地所有数据
StorageUtil.getInstance().clearAll();
// StorageUtil.getInstance().clearAll();
StorageUtil.getInstance().remove(SpKeys.JSESSION_ID);
Get.offAllNamed(RouteString.LOGIN);
}
});
......@@ -1451,10 +1510,11 @@ class _HomePageState extends State<HomePage>
@override
void dispose() {
_controller.dispose();
if (_controller != null) {
_controller.dispose();
}
super.dispose();
}
// _requestPermission() async {
// // var camera = await Permission.camera.status;
// // var storage = await Permission.storage.status;
......
......@@ -60,9 +60,9 @@ class EquipmentPersonnelTable extends StatelessWidget {
buildTableTitle(
name: '主要负责人', color: ColorConst.blueColor),
buildTableTitle(
name: '安全总监', color: ColorConst.blueColor),
name: '(质量)\n安全总监', color: ColorConst.blueColor),
buildTableTitle(
name: '安全员', color: ColorConst.blueColor),
name: '(质量)\n安全员', color: ColorConst.blueColor),
]),
TableRow(children: [
Table(
......@@ -99,7 +99,9 @@ class EquipmentPersonnelTable extends StatelessWidget {
height: 35,
child: TextButton(
onPressed: () {
onTapSyCharge!(deviceList, chargeList);
if (chargeList!.isNotEmpty) {
onTapSyCharge!(deviceList, chargeList);
}
},
child: Text(chargeList!.isNotEmpty ? '✔' : '✘',
style: TextStyle(
......@@ -121,7 +123,9 @@ class EquipmentPersonnelTable extends StatelessWidget {
height: 35,
child: TextButton(
onPressed: () {
onTapSyDirector!(item);
if (item.safetyDirector!.isNotEmpty) {
onTapSyDirector!(item);
}
},
child: Text(
item.safetyDirector!.isNotEmpty
......@@ -150,7 +154,9 @@ class EquipmentPersonnelTable extends StatelessWidget {
height: 35,
child: TextButton(
onPressed: () {
onTapSyOfficer!(item);
if (item.safetyOfficer!.isNotEmpty) {
onTapSyOfficer!(item);
}
},
child: Text(
item.safetyOfficer!.isNotEmpty
......
......@@ -511,8 +511,8 @@ class _RegisterPage2State extends State<RegisterPage2> {
ToastUtils.showCenter('注册成功');
///注册成功直接登录
HttpUtils.doLogin(context, loginNameText!.text, okPasswordText!.text)
.then((value) {
HttpUtils.doLogin(context, loginNameText!.text, okPasswordText!.text,
onSuccess: (value) {
if (value != null) {
LoginBo loginBo = value;
StorageUtil.getInstance().set(SpKeys.USER_NAME, loginBo.username);
......
......@@ -204,6 +204,31 @@ class _InspectListSyPageState extends State<InspectListSyPage>
InkWell buildItem(int index, BuildContext context) {
return InkWell(
onTap: () {
// if (type == '1') {
// Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
// } else if (type == '2') {
// Get.toNamed(RouteString.WEEK_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
// } else if (type == '3') {
// Get.toNamed(RouteString.MONTH_INSPECT_SUBMIT_SY,
// arguments: {'argsData': widget.args, 'listBo': list(index)})
// ?.then((value) {
// if (value != null && value) {
// getData();
// }
// });
// }
if (type == '1') {
Get.toNamed(RouteString.DAY_INSPECT_SUBMIT_SY,
arguments: {'argsData': widget.args, 'listBo': list(index)})
......
......@@ -148,7 +148,7 @@ class _UserListPageState extends State<UserListPage> {
),
child: Padding(
padding:
const EdgeInsets.only(left: 10, right: 0, top: 15, bottom: 10),
const EdgeInsets.only(left: 8, right: 0, top: 15, bottom: 10),
child: Column(
children: <Widget>[
Row(
......@@ -161,7 +161,7 @@ class _UserListPageState extends State<UserListPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(left: 10, bottom: 5),
margin: const EdgeInsets.only(left: 8, bottom: 5),
child: Text.rich(TextSpan(children: [
const TextSpan(
text: '用户名:',
......@@ -174,7 +174,7 @@ class _UserListPageState extends State<UserListPage> {
])),
),
Container(
margin: const EdgeInsets.only(left: 10, bottom: 5),
margin: const EdgeInsets.only(left: 8, bottom: 5),
child: Text.rich(TextSpan(children: [
const TextSpan(
text: '姓名:',
......@@ -187,18 +187,36 @@ class _UserListPageState extends State<UserListPage> {
])),
),
Container(
margin: const EdgeInsets.only(left: 10),
child: Text.rich(TextSpan(children: [
const TextSpan(
text: '用户身份:',
style: TextStyle(
fontSize: 13, color: Colors.black)),
TextSpan(
text: roleNames(index),
style: const TextStyle(
fontSize: 13, color: Colors.black54)),
])),
)
width: 250,
margin: const EdgeInsets.only(left: 8),
child: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// const Text('用户身份:',
// style: TextStyle(
// fontSize: 13, color: Colors.black)),
// Expanded(
// child: Text(roleNames(index),
// style: const TextStyle(
// fontSize: 13, color: Colors.black54)),
// ),
Expanded(
child: Text.rich(TextSpan(children: [
const TextSpan(
text: '用户身份:',
style: TextStyle(
fontSize: 13, color: Colors.black)),
TextSpan(
text: roleNames(index),
style: const TextStyle(
fontSize: 13,
color: Colors.black54)),
])),
),
],
))
],
)
],
......
......@@ -412,193 +412,201 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
child: const Text('使用单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: newSyList(index) != null
? newSyList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
newSyList(index)![subIndex].check =
!newSyList(index)![subIndex].check!;
});
},
child: newSyList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
if (newSyList(index)!.isNotEmpty) ...[
Container(
margin: const EdgeInsets.only(
left: 10, right: 10, top: 5),
child: const Text('使用单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: newSyList(index) != null
? newSyList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
newSyList(index)![subIndex].check =
!newSyList(index)![subIndex].check!;
});
},
child: newSyList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
// child: Container(
// decoration: BoxDecoration(
// color: newSyList(index)![subIndex].check!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: newSyList(index)![subIndex].check!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// newSyList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: newSyList(index)![subIndex].check!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
],
if (newScList(index)!.isNotEmpty) ...[
Container(
margin: const EdgeInsets.only(
left: 10, right: 10, top: 5),
child: const Text('生产单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: newScList(index) != null
? newScList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
// child: Container(
// decoration: BoxDecoration(
// color: newSyList(index)![subIndex].check!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: newSyList(index)![subIndex].check!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// newSyList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: newSyList(index)![subIndex].check!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
child: const Text('生产单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: newScList(index) != null
? newScList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
newScList(index)![subIndex].check =
!newScList(index)![subIndex].check!;
});
},
child: newScList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
newScList(index)![subIndex].check =
!newScList(index)![subIndex].check!;
});
},
child: newScList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newScList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
newScList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: newScList(index)![subIndex].check!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: newScList(index)![subIndex].check!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// newScList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: newScList(index)![subIndex].check!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
// child: Container(
// decoration: BoxDecoration(
// color: newScList(index)![subIndex].check!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: newScList(index)![subIndex].check!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// newScList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: newScList(index)![subIndex].check!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
]
],
),
),
......@@ -743,195 +751,155 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
child: const Text('使用单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: userDtoSyList(index) != null
? userDtoSyList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
userDtoSyList(index)![subIndex].check =
!userDtoSyList(index)![subIndex].check!;
});
},
child: userDtoSyList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
if (userDtoSyList(index)!.isNotEmpty) ...[
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
child: const Text('使用单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: userDtoSyList(index) != null
? userDtoSyList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
userDtoSyList(index)![subIndex].check =
!userDtoSyList(index)![subIndex].check!;
});
},
child: userDtoSyList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.blue[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.blue),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_blue.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoSyList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
);
},
),
],
if (userDtoScList(index)!.isNotEmpty) ...[
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
child: const Text('生产单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: userDtoScList(index) != null
? userDtoScList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
// child: Container(
// decoration: BoxDecoration(
// color: userDtoSyList(index)![subIndex].check!
// ? Colors.blue[50]
// : Colors.transparent,
// border: Border.all(
// color: userDtoSyList(index)![subIndex].check!
// ? Colors.blue
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// userDtoSyList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: userDtoSyList(index)![subIndex].check!
// ? Colors.blue
// : Colors.black),
// ),
// ),
);
},
),
Container(
margin: const EdgeInsets.only(left: 10, right: 10),
child: const Text('生产单位',
style: TextStyle(fontWeight: FontWeight.bold))),
GridView.builder(
itemCount: userDtoScList(index) != null
? userDtoScList(index)!.length
: 0,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.only(
top: 10, left: 5, right: 5, bottom: 10),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, // 每行显示的列数
crossAxisSpacing: 3.0, // 列之间的间距
childAspectRatio: 2 / 0.5,
mainAxisSpacing: 8.0 // 行之间的间距
),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
userDtoScList(index)![subIndex].check =
!userDtoScList(index)![subIndex].check!;
});
},
child: userDtoScList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
itemBuilder: (BuildContext context, int subIndex) {
return GestureDetector(
// 点击每个Grid Item时切换选中状态
onTap: () {
setState(() {
userDtoScList(index)![subIndex].check =
!userDtoScList(index)![subIndex].check!;
});
},
child: userDtoScList(index)![subIndex].check!
? Stack(
children: [
Container(
decoration: BoxDecoration(
color: Colors.orange[100],
borderRadius:
BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: TextStyle(
fontSize: 12,
color: Colors.orange[900]),
),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
Positioned(
bottom: 0,
right: 0,
child: Image.asset(
'assets/home/select_check_orange.png',
height: 15,
width: 15),
)
],
)
: Container(
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: ColorConst.greyD2Color,
width: 0.7),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
userDtoScList(index)![subIndex].name!,
style: const TextStyle(
fontSize: 12, color: Colors.black),
),
),
// child: Container(
// decoration: BoxDecoration(
// color: userDtoScList(index)![subIndex].check!
// ? Colors.orange[50]
// : Colors.transparent,
// border: Border.all(
// color: userDtoScList(index)![subIndex].check!
// ? Colors.orange
// : ColorConst.greyD2Color,
// width: 1),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child: Text(
// userDtoScList(index)![subIndex].name!,
// style: TextStyle(
// fontSize: 12,
// color: userDtoScList(index)![subIndex].check!
// ? Colors.orange
// : Colors.black),
// ),
// ),
);
},
),
);
},
),
],
],
),
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment