diff --git a/lib/pages/Works/DWDT/dwInfo_data.dart b/lib/pages/Works/DWDT/dwInfo_data.dart index 3c92c1c..11838d0 100644 --- a/lib/pages/Works/DWDT/dwInfo_data.dart +++ b/lib/pages/Works/DWDT/dwInfo_data.dart @@ -45,6 +45,8 @@ Future getListBMFMarker({List listDwinfo}) async { for (int i = 0; i < len; i++) { BMFMarker marker; if (Platform.isIOS) { + // if (true) { + // 用于安卓环境下测试 marker = BMFMarker( position: getBMFCoordinate(listDwinfo[i]["dwzb"]), // title: '${listDwinfo[i]["id"].toString()}、${listDwinfo[i]["dwmc"]}', @@ -98,7 +100,6 @@ Future getListBMFMarker({List listDwinfo}) async { draggable: dragable); } - // 百度地图的脑残设计,用Flutter添加多个BMFMarker时,必须在添加BMFMarker时自己保存ID, // 否则响应点击时无法确定用户点击的是哪个定位标注 // 代码不会自动返回,也没有任何文档说明,是花了一天时间搜索网络无果,是自己翻江倒海摸索出来的 @@ -109,6 +110,8 @@ Future getListBMFMarker({List listDwinfo}) async { // android版专有 if (Platform.isAndroid) { + // if (false) { + // 用于安卓环境下测试 g_listBMFText.add(BMFText( // text: '${listDwinfo[i]["id"].toString()}、${listDwinfo[i]["dwmc"]}', text: '${(i + 1).toString()}、${listDwinfo[i]["dwmc"]}', diff --git a/lib/pages/Works/DWDT/widget_to_image.dart b/lib/pages/Works/DWDT/widget_to_image.dart index a5a3035..c5bd99d 100644 --- a/lib/pages/Works/DWDT/widget_to_image.dart +++ b/lib/pages/Works/DWDT/widget_to_image.dart @@ -22,25 +22,6 @@ Future getIconWidget(String name) async { color: Colors.transparent, child: Column( children: [ - Row( - textDirection: TextDirection.ltr, - children: [ - SizedBox(width: _widthBtn * 0.5 + _icon_width), - Container( - // margin: EdgeInsets.only(left: _widthBtn * 0.5), - // padding: EdgeInsets.only(left: _widthBtn * 0.5), - width: _widthBtn, - height: _text_height, - color: Colors.yellow, - child: Directionality( - textDirection: TextDirection.ltr, - child: Text(name, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.black, fontWeight: FontWeight.bold, fontSize: 36.0))), - ), - ], - ), Container( width: _widthBtn, height: _icon_height, @@ -62,6 +43,25 @@ Future getIconWidget(String name) async { ), ), ), + Row( + textDirection: TextDirection.ltr, + children: [ + SizedBox(width: _widthBtn * 0.5 + _icon_width), + Container( + // margin: EdgeInsets.only(left: _widthBtn * 0.5), + // padding: EdgeInsets.only(left: _widthBtn * 0.5), + width: _widthBtn, + height: _text_height, + color: Colors.yellow, + child: Directionality( + textDirection: TextDirection.ltr, + child: Text(name, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, fontWeight: FontWeight.bold, fontSize: 36.0))), + ), + ], + ), ], ), ); diff --git a/lib/pages/Works/HYSH/hysh_group.dart b/lib/pages/Works/HYSH/hysh_group.dart index 9107bdc..3f34084 100644 --- a/lib/pages/Works/HYSH/hysh_group.dart +++ b/lib/pages/Works/HYSH/hysh_group.dart @@ -93,7 +93,8 @@ class _HyshGroupState extends State { return Container( width: ScreenUtil().setWidth(1022), // height: ScreenUtil().setHeight(550), - height: ScreenUtil().setHeight(480), + // height: ScreenUtil().setHeight(480), + height: ScreenUtil().setHeight(380), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( diff --git a/lib/pages/Works/TJXX/tj_data.dart b/lib/pages/Works/TJXX/tj_data.dart index df120c5..9a84c3b 100644 --- a/lib/pages/Works/TJXX/tj_data.dart +++ b/lib/pages/Works/TJXX/tj_data.dart @@ -697,6 +697,8 @@ Future getAllSumCll(String field, List listStatis) async { Future bmfInit() async { // 只有IOS版才需要 if (Platform.isIOS) { + // if (true) { + // 用于安卓环境下测试 g_myIconPathPre = await createDir(g_myIconDir); print("g_myIconPathPre = $g_myIconPathPre"); // g_myIconPathPre = /data/user/0/com.example.hyzp_yibin_bmfmap/app_flutter/myIcons diff --git a/lib/widget/CarNumberAndCpysItems.dart b/lib/widget/CarNumberAndCpysItems.dart index 40c348a..997649a 100644 --- a/lib/widget/CarNumberAndCpysItems.dart +++ b/lib/widget/CarNumberAndCpysItems.dart @@ -85,104 +85,95 @@ class _CarNumberAndCpysItemsState extends State { Widget getCarNumberAndCpys(int i) { return Container( width: ScreenUtil().setWidth(1022), - height: ScreenUtil().setHeight(my_listTileHeight2 * 2 + 15), - child: Column(children: [ - //1、车牌号码 - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), - Text('${mapGetZpjlGetDataSpecial['car_number'].fieldText}: ', - style: TextStyle(fontSize: my_fontSize)), - Container( - alignment: Alignment(-1, 0), - //widthTrail = 400报错,360刚能显示,300换行,260 - height: ScreenUtil().setHeight(my_listTileHeight2), //最大高度 - width: ScreenUtil().setWidth(400), - child: TextField( - textAlign: TextAlign.center, - style: TextStyle( - fontSize: my_fontSize, - //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysFont, - //color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysFont, - color: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysFont, - ), - // background: Paint() - // ..color = cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])] - // .cpysBackground), - decoration: InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(width: 2.0), borderRadius: BorderRadius.circular(3.0)), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(width: 2.0), borderRadius: BorderRadius.circular(3.0)), - //prefixText: "pre", - filled: true, - //fillColor: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBackground, - //fillColor: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysBackground, - fillColor: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysBackground, - hintText: '车牌号码', - //border: InputBorder.none, //TextField去掉下划线 - //contentPadding: EdgeInsets.only(right: 0), - //contentPadding: const EdgeInsets.symmetric(vertical: _textFieldHeight), - //contentPadding: EdgeInsets.symmetric(vertical: _textFieldHeight), - contentPadding: EdgeInsets.all(0), - //contentPadding: EdgeInsets.only(top: 0), + height: ScreenUtil().setHeight(my_listTileHeight2 + 15), + child: Row( + children: [ + SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), + //1、车牌号码 + // Text('${mapGetZpjlGetDataSpecial['car_number'].fieldText}: ', + // style: TextStyle(fontSize: my_fontSize)), + Text('车牌号码\n及颜色: ', maxLines: 2), + SizedBox(width: ScreenUtil().setWidth(my_marginLeft)), + Container( + alignment: Alignment(-1, 0), + //widthTrail = 400报错,360刚能显示,300换行,260 + height: ScreenUtil().setHeight(my_listTileHeight2), //最大高度 + width: ScreenUtil().setWidth(400), + child: TextField( + textAlign: TextAlign.center, + style: TextStyle( + fontSize: my_fontSize, + //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysFont, + //color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysFont, + color: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysFont, + ), + // background: Paint() + // ..color = cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])] + // .cpysBackground), + decoration: InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(width: 2.0), borderRadius: BorderRadius.circular(3.0)), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 2.0), borderRadius: BorderRadius.circular(3.0)), + //prefixText: "pre", + filled: true, + //fillColor: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBackground, + //fillColor: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysBackground, + fillColor: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysBackground, + hintText: '车牌号码', + //border: InputBorder.none, //TextField去掉下划线 + //contentPadding: EdgeInsets.only(right: 0), + //contentPadding: const EdgeInsets.symmetric(vertical: _textFieldHeight), + //contentPadding: EdgeInsets.symmetric(vertical: _textFieldHeight), + contentPadding: EdgeInsets.all(0), + //contentPadding: EdgeInsets.only(top: 0), - // border: OutlineInputBorder( - // //borderRadius: BorderRadius.circular(1.0), - // borderSide: BorderSide( - // //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBorder, - // color: - // cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])] - // .cpysBorder, - // width: 2.0)), - ), - //controller: listZpljController[i][indexField], - controller: TextEditingController.fromValue(TextEditingValue( - text: listGetZpjl[i]['car_number'].toString(), - // 保持光标在最后 - selection: TextSelection.fromPosition(TextPosition( - affinity: TextAffinity.downstream, - offset: '${listGetZpjl[i]['car_number'].toString()}'.length)))), - enabled: true, - //利用控制器初始化文本 - onChanged: (value) { - listGetZpjl[i]['car_number'] = value; - }, + // border: OutlineInputBorder( + // //borderRadius: BorderRadius.circular(1.0), + // borderSide: BorderSide( + // //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBorder, + // color: + // cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])] + // .cpysBorder, + // width: 2.0)), ), + //controller: listZpljController[i][indexField], + controller: TextEditingController.fromValue(TextEditingValue( + text: listGetZpjl[i]['car_number'].toString(), + // 保持光标在最后 + selection: TextSelection.fromPosition(TextPosition( + affinity: TextAffinity.downstream, + offset: '${listGetZpjl[i]['car_number'].toString()}'.length)))), + enabled: true, + //利用控制器初始化文本 + onChanged: (value) { + listGetZpjl[i]['car_number'] = value; + }, ), - SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), - ], - ), - SizedBox(height: ScreenUtil().setHeight(15)), - //2、车牌颜色 - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), - Text('车牌颜色: ', - style: TextStyle(fontSize: my_fontSize)), - Container( - alignment: Alignment(1, 0), - //widthTrail = 400报错,360刚能显示,300换行,260 - height: ScreenUtil().setHeight(my_listTileHeight2), //最大高度 - width: ScreenUtil().setWidth(400), - margin: EdgeInsets.only(bottom: 0), - padding: EdgeInsets.only(left: 0, bottom: 2), - decoration: BoxDecoration( - //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBackground, - //color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysBackground, - color: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysBackground, - border: Border.all(color: Colors.black87, width: 2), - //边框圆角设置 - borderRadius: BorderRadius.vertical( - top: Radius.elliptical(3, 3), bottom: Radius.elliptical(3, 3)), - ), - child: getDropdownButton(), - ) - ], - ), - ],), + ), + SizedBox(width: ScreenUtil().setWidth(my_marginLeft)), + //2、车牌颜色 + Container( + alignment: Alignment(1, 0), + //widthTrail = 400报错,360刚能显示,300换行,260 + height: ScreenUtil().setHeight(my_listTileHeight2), + //最大高度 + width: ScreenUtil().setWidth(400), + margin: EdgeInsets.only(bottom: 0), + padding: EdgeInsets.only(left: 0, bottom: 2), + decoration: BoxDecoration( + //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBackground, + //color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysBackground, + color: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysBackground, + border: Border.all(color: Colors.black87, width: 2), + //边框圆角设置 + borderRadius: BorderRadius.vertical( + top: Radius.elliptical(3, 3), bottom: Radius.elliptical(3, 3)), + ), + child: getDropdownButton(), + ), + ], + ), ); } diff --git a/lib/widget/CarNumberAndCpysItems0.dart b/lib/widget/CarNumberAndCpysItems0.dart new file mode 100644 index 0000000..40c348a --- /dev/null +++ b/lib/widget/CarNumberAndCpysItems0.dart @@ -0,0 +1,193 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/screen_util.dart'; +import '../components/hyxx_data_handle.dart'; +import '../services/EventBus.dart'; + +class CarNumberAndCpysItems extends StatefulWidget { + int index; + String initValue; + + CarNumberAndCpysItems( + this.index, this.initValue); //I don't know what is this index for but I will put it in anyway + @override + _CarNumberAndCpysItemsState createState() => _CarNumberAndCpysItemsState(); +} + +class _CarNumberAndCpysItemsState extends State { + List> _dropDownMenuItems; + String selectedValue; + + @override + void initState() { + super.initState(); + selectedValue = widget.initValue; + _dropDownMenuItems = getDropDownMenuItems(); + } + + List> getDropDownMenuItems() { + List> items = []; + int len = cpysList.length; + for (int i = 0; i < len; i++) { + items.add( + DropdownMenuItem( + value: cpysList[i].cpysText, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + cpysList[i].cpysText, + style: TextStyle( + color: cpysList[i].cpysFont, + background: Paint()..color = cpysList[i].cpysBackground), + ), + (selectedValue == cpysList[i].cpysText) + ? Icon( + Icons.check, + //color: cpysList[i].cpysBackground, + size: 16, + ) + : SizedBox( + width: 0, + ), + ], + ), + ), + ); + } + return items; + } + + Widget getDropdownButton() { + //DropdownButton默认有一条下划线,DropdownButtonHideUnderline去除下划线 + //更改图标亮度 + return Theme( + //data: Theme.of(context).copyWith(primaryColor: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysFont), + data: Theme.of(context).copyWith(brightness: Brightness.dark), + child: DropdownButtonHideUnderline( + child: DropdownButton( + iconEnabledColor: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysFont, + value: selectedValue, + items: _dropDownMenuItems, + onChanged: (String _selectedFruit) { + selectedValue = _selectedFruit; + _dropDownMenuItems = getDropDownMenuItems(); + //黑烟初审数据审核Dropdown选项改变广播 + eventBus.fire(HycsDataAuditDropdownEvent('黑烟初审数据审核Dropdown选项已改变', selectedValue)); + setState(() {}); + print('selectedValue = $selectedValue'); + }, + ), + ), + ); + } + + //Tab页面中的车牌号码、车牌颜色组件 + Widget getCarNumberAndCpys(int i) { + return Container( + width: ScreenUtil().setWidth(1022), + height: ScreenUtil().setHeight(my_listTileHeight2 * 2 + 15), + child: Column(children: [ + //1、车牌号码 + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), + Text('${mapGetZpjlGetDataSpecial['car_number'].fieldText}: ', + style: TextStyle(fontSize: my_fontSize)), + Container( + alignment: Alignment(-1, 0), + //widthTrail = 400报错,360刚能显示,300换行,260 + height: ScreenUtil().setHeight(my_listTileHeight2), //最大高度 + width: ScreenUtil().setWidth(400), + child: TextField( + textAlign: TextAlign.center, + style: TextStyle( + fontSize: my_fontSize, + //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysFont, + //color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysFont, + color: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysFont, + ), + // background: Paint() + // ..color = cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])] + // .cpysBackground), + decoration: InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(width: 2.0), borderRadius: BorderRadius.circular(3.0)), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(width: 2.0), borderRadius: BorderRadius.circular(3.0)), + //prefixText: "pre", + filled: true, + //fillColor: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBackground, + //fillColor: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysBackground, + fillColor: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysBackground, + hintText: '车牌号码', + //border: InputBorder.none, //TextField去掉下划线 + //contentPadding: EdgeInsets.only(right: 0), + //contentPadding: const EdgeInsets.symmetric(vertical: _textFieldHeight), + //contentPadding: EdgeInsets.symmetric(vertical: _textFieldHeight), + contentPadding: EdgeInsets.all(0), + //contentPadding: EdgeInsets.only(top: 0), + + // border: OutlineInputBorder( + // //borderRadius: BorderRadius.circular(1.0), + // borderSide: BorderSide( + // //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBorder, + // color: + // cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])] + // .cpysBorder, + // width: 2.0)), + ), + //controller: listZpljController[i][indexField], + controller: TextEditingController.fromValue(TextEditingValue( + text: listGetZpjl[i]['car_number'].toString(), + // 保持光标在最后 + selection: TextSelection.fromPosition(TextPosition( + affinity: TextAffinity.downstream, + offset: '${listGetZpjl[i]['car_number'].toString()}'.length)))), + enabled: true, + //利用控制器初始化文本 + onChanged: (value) { + listGetZpjl[i]['car_number'] = value; + }, + ), + ), + SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), + ], + ), + SizedBox(height: ScreenUtil().setHeight(15)), + //2、车牌颜色 + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox(width: ScreenUtil().setWidth(my_marginLeft2)), + Text('车牌颜色: ', + style: TextStyle(fontSize: my_fontSize)), + Container( + alignment: Alignment(1, 0), + //widthTrail = 400报错,360刚能显示,300换行,260 + height: ScreenUtil().setHeight(my_listTileHeight2), //最大高度 + width: ScreenUtil().setWidth(400), + margin: EdgeInsets.only(bottom: 0), + padding: EdgeInsets.only(left: 0, bottom: 2), + decoration: BoxDecoration( + //color: cpysList[getIndexOfCpysList(colorText: listGetZpjl[i]['cpys'])].cpysBackground, + //color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysBackground, + color: cpysList[getIndexOfCpysList(colorText: selectedValue)].cpysBackground, + border: Border.all(color: Colors.black87, width: 2), + //边框圆角设置 + borderRadius: BorderRadius.vertical( + top: Radius.elliptical(3, 3), bottom: Radius.elliptical(3, 3)), + ), + child: getDropdownButton(), + ) + ], + ), + ],), + ); + } + + @override + Widget build(BuildContext context) { + return getCarNumberAndCpys(widget.index); + } +}