Commit e15185b6 by 吴春元

1.0.4正式版本上线:

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