diff --git a/android/app/release/output.json b/android/app/release/output.json index e6aa759..758c3cd 100644 --- a/android/app/release/output.json +++ b/android/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":20220502,"versionName":"1.4.29","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":20220504,"versionName":"1.4.30","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/lib/components/commonFun.dart b/lib/components/commonFun.dart index 7ec6495..d46ebdc 100644 --- a/lib/components/commonFun.dart +++ b/lib/components/commonFun.dart @@ -23,6 +23,10 @@ import 'UserInfo.dart'; import 'dioFun.dart'; //////////////////////////////////////////// +double g_radioImage = 10 / 16; // 违章图片默认宽高比率 + + + AudioPlayer playerClick; AudioPlayer playerClacks; AudioPlayer playerVoiceRemind; @@ -875,7 +879,7 @@ Widget getImageWidget() { color: Color.fromRGBO(49, 216, 123, 1), fontWeight: FontWeight.bold)), ), - SizedBox(height: ScreenUtil().setHeight(copyright_info.contains('\n') ? 40 : 90)), + SizedBox(height: ScreenUtil().setHeight(copyright_info.contains('\n') ? 25 : 90)), Container( alignment: Alignment.center, child: Text(copyright_info, diff --git a/lib/main.dart b/lib/main.dart index ce367ed..e24d0d1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -140,6 +140,13 @@ class _MyAppState extends State { theme: ThemeData( // primaryColor: Colors.yellow primaryColor: Colors.white), + //设置文字大小不随系统字体设置改变 + builder: (context, widget) { + return MediaQuery( + data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), + child: widget, + ); + }, ), ), ); 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/fhycx_content_new.dart b/lib/pages/Works/HYSH/fhycx_content_new.dart index 97b5a76..fe4fd52 100644 --- a/lib/pages/Works/HYSH/fhycx_content_new.dart +++ b/lib/pages/Works/HYSH/fhycx_content_new.dart @@ -11,6 +11,7 @@ import 'package:keyboard_avoider/keyboard_avoider.dart'; // import '../../../components/commonFun.dart'; + //import 'package:hyzp_ybqx/widget/player_pro_new.dart'; import '../../../components/dioFun.dart'; import '../../../components/doJSON.dart'; @@ -112,7 +113,8 @@ class _FhycxPageState extends State { _mapTsjjGetTsStatus = await tsjjGetTsStatus(widget.id); // 获取网络图片尺寸 - await flustars.WidgetUtil.getImageWH(url: getMediaUrl(_mapGetTsjjGetData['pic_url'])).then((rect) { + await flustars.WidgetUtil.getImageWH(url: getMediaUrl(_mapGetTsjjGetData['pic_url'])) + .then((rect) { if (null != rect) { _radioImage = rect.height / rect.width; } @@ -138,7 +140,7 @@ class _FhycxPageState extends State { imageUrl: url, alignment: Alignment.topCenter, imageBuilder: (context, imageProvider) => DragScaleContainer( - doubleTapStillScale: true, child: Image(image: imageProvider) + doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill) // child: Image( // image: NetworkImage( // 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'), @@ -268,7 +270,7 @@ class _FhycxPageState extends State { width: ScreenUtil().setWidth(1022), //height: ScreenUtil().setHeight(639), //height: ScreenUtil().setHeight(22 + 1022 * _radioImage), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), decoration: BoxDecoration( //color: Colors.white, borderRadius: BorderRadius.all( @@ -281,7 +283,8 @@ class _FhycxPageState extends State { top: ScreenUtil().setHeight(_marginLeft), child: Container( width: ScreenUtil().setWidth(1022), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + // height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), child: getNetworkImage(getMediaUrl(_mapGetTsjjGetData['pic_url'])), ), ) @@ -617,8 +620,10 @@ class _FhycxPageState extends State { width: ScreenUtil().setWidth(1022) / _radio, child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(width: ScreenUtil().setWidth(_marginLeft)), - Text('$_hyshlx用户:' + _hyshMap['uname'], - textAlign: TextAlign.left, overflow: TextOverflow.ellipsis), + // Flutter 解决Text内容展示越界 + Expanded( + child: Text('$_hyshlx用户:' + _hyshMap['uname'], + textAlign: TextAlign.left, overflow: TextOverflow.ellipsis)), ]), ), SizedBox(width: ScreenUtil().setWidth(_marginLeft)), diff --git a/lib/pages/Works/HYSH/hysh_content_new.dart b/lib/pages/Works/HYSH/hysh_content_new.dart index b8eaf03..f293a45 100644 --- a/lib/pages/Works/HYSH/hysh_content_new.dart +++ b/lib/pages/Works/HYSH/hysh_content_new.dart @@ -261,7 +261,7 @@ class _HyshPageState extends State with SingleTickerProviderStat imageUrl: url, alignment: Alignment.topCenter, imageBuilder: (context, imageProvider) => DragScaleContainer( - doubleTapStillScale: true, child: Image(image: imageProvider) + doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill) // child: Image( // image: NetworkImage( // 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'), @@ -550,9 +550,9 @@ class _HyshPageState extends State with SingleTickerProviderStat Container( width: ScreenUtil().setWidth(1022), //height: ScreenUtil().setHeight(639), - // height: ScreenUtil().setHeight(22 + 1022 * (9 / 16)), // 兴文县的违章图片无法获取,暂时调整 - height: ScreenUtil() - .setHeight(22 + 1022 * (ratioList.isNotEmpty ? ratioList[index] : 9 / 16)), + height: ScreenUtil().setHeight(22 + 1022 * g_radioImage), // 兴文县的违章图片无法获取,暂时调整 + // height: ScreenUtil() + // .setHeight(22 + 1022 * (ratioList.isNotEmpty ? ratioList[index] : 9 / 16)), decoration: BoxDecoration( //color: Colors.white, borderRadius: BorderRadius.all( @@ -565,9 +565,10 @@ class _HyshPageState extends State with SingleTickerProviderStat top: ScreenUtil().setHeight(11), child: Container( width: ScreenUtil().setWidth(1022), - height: - ScreenUtil().setHeight(1022 * (ratioList.isNotEmpty ? ratioList[index] : 9 / 16)), - // height: ScreenUtil().setHeight(1022 * (9 / 16)), // 兴文县的违章图片无法获取,暂时调整 + // height: + // ScreenUtil().setHeight(1022 * (ratioList.isNotEmpty ? ratioList[index] : 9 / 16)), + height: ScreenUtil().setHeight(1022 * g_radioImage), + // 兴文县的违章图片无法获取,暂时调整 child: getNetworkImage(getMediaUrl(listGetZpjl[index]['pic_url'])), ), ) diff --git a/lib/pages/Works/HYSH/hysh_group.dart b/lib/pages/Works/HYSH/hysh_group.dart index 9107bdc..5719938 100644 --- a/lib/pages/Works/HYSH/hysh_group.dart +++ b/lib/pages/Works/HYSH/hysh_group.dart @@ -49,6 +49,10 @@ class _HyshGroupState extends State { void initState() { _selectedRadio = widget.selectedRadio; + // 解决初审为非黑烟、复审默认勾选非黑烟车,同时取消勾选“同时推送交警”复选框 + tsjj = _selectedRadio == 0 ? true : false; // 是否选中“同时推送交警”复选框 + fh_hyc = _selectedRadio == 0 ? true : false; // 是否禁用“同时推送交警”复选框 + //黑烟审核推送交警Checkbox改变事件 eventBus.on().listen((event) { print(event.str); @@ -93,7 +97,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( @@ -406,69 +411,6 @@ class _HyshGroupState extends State { ); } - //5.3-0、得到审核结果组件 - Widget getShjg0(int index) { - return Container( - width: ScreenUtil().setWidth(1022), - height: ScreenUtil().setHeight(175), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox(width: my_marginLeft), - Text((widget.hyshlx == 'hyfh' ? '复审' : '初审') + '结果: ', - style: TextStyle( - fontSize: widget.fontSize, - color: 0 == _selectedRadio ? Colors.red : Colors.green)), - CustomRadioWidget( - value: 0, - title: mapHyshlx[hyshlx]['nick_text'] + "为黑烟车", - fontSize: widget.fontSize, - width: ScreenUtil().setWidth(400), - groupValue: _selectedRadio, - onChanged: (int value) { - _selectedRadio = value; - fh_hyc = true; //复审为黑烟车 - tsjj = true; //同时推送交警 - //黑烟初审数据审核Radio选项改变广播 - eventBus.fire(HycsDataAuditRadioEvent('黑烟初审数据审核Radio选项已改变', _selectedRadio)); - setState(() {}); - print('selectedRadio = ${_selectedRadio.toString()}'); - }, - ), - ], - ), - SizedBox(height: ScreenUtil().setHeight(15)), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox(width: my_marginLeft), - Text((widget.hyshlx == 'hyfh' ? '复审' : '初审') + '结果: ', - style: TextStyle(fontSize: widget.fontSize, color: Colors.white)), - CustomRadioWidget( - value: 1, - title: "非黑烟车", - fontSize: widget.fontSize, - width: ScreenUtil().setWidth(400), - groupValue: _selectedRadio, - onChanged: (int value) { - _selectedRadio = value; - fh_hyc = false; //复审为黑烟车 - tsjj = false; //同时推送交警 - //黑烟初审数据审核Radio选项改变广播 - eventBus.fire(HycsDataAuditRadioEvent('黑烟初审数据审核Radio选项已改变', _selectedRadio)); - setState(() {}); - print('selectedRadio = ${_selectedRadio.toString()}'); - }, - ), - ], - ), - ], - ), - ); - } - //5.2、得到审核意见组件 Widget getShyj(int index) { // return ConstrainedBox( diff --git a/lib/pages/Works/HYSH/tsjj_content_new.dart b/lib/pages/Works/HYSH/tsjj_content_new.dart index ccd9ac2..fadb4d6 100644 --- a/lib/pages/Works/HYSH/tsjj_content_new.dart +++ b/lib/pages/Works/HYSH/tsjj_content_new.dart @@ -150,7 +150,7 @@ class _LoginPageState extends State with SingleTickerProviderSta imageUrl: url, alignment: Alignment.topCenter, imageBuilder: (context, imageProvider) => DragScaleContainer( - doubleTapStillScale: true, child: Image(image: imageProvider) + doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill) // child: Image( // image: NetworkImage( // 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'), @@ -278,7 +278,8 @@ class _LoginPageState extends State with SingleTickerProviderSta //height: ScreenUtil().setHeight(639), //height: ScreenUtil().setHeight(22 + 1022 * _radioImage), // height: ScreenUtil().setHeight(30 + 1022 * _radioImage), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + // height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), decoration: BoxDecoration( // color: Colors.red, borderRadius: BorderRadius.all( @@ -291,7 +292,8 @@ class _LoginPageState extends State with SingleTickerProviderSta top: ScreenUtil().setHeight(25), child: Container( width: ScreenUtil().setWidth(1022), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + // height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), child: getNetworkImage(getMediaUrl(_mapGetTsjjGetData['pic_url'])), ), ) 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/pages/Works/TJXX/today_list_zpjl_content_new.dart b/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart index 76c50f0..c037eea 100644 --- a/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart +++ b/lib/pages/Works/TJXX/today_list_zpjl_content_new.dart @@ -1,6 +1,7 @@ //import '../../../widget/player_pro.dart'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flustars/flustars.dart' as flustars; //该组件中有ScreenUtil import 'package:flutter/material.dart'; import 'package:flutter_drag_scale/flutter_drag_scale.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -11,7 +12,6 @@ import 'package:keyboard_avoider/keyboard_avoider.dart'; import '../../../components/commonFun.dart'; import '../../../components/doJSON.dart'; import '../../../components/hyxx_data_handle.dart'; -import 'package:flustars/flustars.dart' as flustars; //该组件中有ScreenUtil // "today": { // "total": 4, @@ -134,7 +134,7 @@ class _TodayListZpjlPageState extends State { imageUrl: url, alignment: Alignment.topCenter, imageBuilder: (context, imageProvider) => DragScaleContainer( - doubleTapStillScale: true, child: Image(image: imageProvider) + doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill) // child: Image( // image: NetworkImage( // 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'), @@ -263,7 +263,7 @@ class _TodayListZpjlPageState extends State { width: ScreenUtil().setWidth(1022), //height: ScreenUtil().setHeight(639), //height: ScreenUtil().setHeight(22 + 1022 * _radioImage), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), decoration: BoxDecoration( //color: Colors.white, borderRadius: BorderRadius.all( @@ -276,7 +276,8 @@ class _TodayListZpjlPageState extends State { top: ScreenUtil().setHeight(_marginLeft), child: Container( width: ScreenUtil().setWidth(1022), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + // height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), child: getNetworkImage(getMediaUrl(mapZpjl['pic_url'])), ), ) @@ -506,10 +507,41 @@ class _TodayListZpjlPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(width: ScreenUtil().setWidth(_marginLeft)), - Text(text, + // Flutter 解决Text内容展示越界 + Expanded( + child: Text(text, + textAlign: TextAlign.left, + overflow: TextOverflow.ellipsis, + style: TextStyle(color: color))) + ], + ), + ), + ], + ); + } + + Widget getUserAndTime(String user, String time, {Color color}) { + return Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + alignment: Alignment(-1, 0), + width: ScreenUtil().setWidth(1022 - 2 * _marginLeft), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox(width: ScreenUtil().setWidth(_marginLeft)), + Text(user, textAlign: TextAlign.left, overflow: TextOverflow.ellipsis, - style: TextStyle(color: color)) + style: TextStyle(color: color)), + SizedBox(width: ScreenUtil().setWidth(_marginCenter)), + // Flutter 解决Text内容展示越界 + Expanded( + child: Text(time, + textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, + style: TextStyle(color: color))) ], ), ), @@ -550,7 +582,9 @@ class _TodayListZpjlPageState extends State { String _hyshJg = (_hyshInfo == 'hycsInfo' ? 'cs_tile' : 'fs_tile'); //黑烟审核结果 String _hyshYj = (_hyshInfo == 'hycsInfo' ? 'cs_shuoming' : 'fs_shuoming'); //黑烟审核意见 - double _height = _hyshInfo == 'hyfhInfo' && widget.hyshlx == 'tsjj' ? 315 : 265; + // double _height = _hyshInfo == 'hyfhInfo' && widget.hyshlx == 'tsjj' ? 315 : 265; + double _height = _hyshInfo == 'hyfhInfo' && widget.hyshlx == 'tsjj' ? 285 : 215; + return Column( children: [ Container( @@ -600,8 +634,9 @@ class _TodayListZpjlPageState extends State { ], ), getText('${_hyshLx}意见:' + mapZpjl[_hyshYj]), - getText('${_hyshLx}用户:' + mapZpjl[_hyshYh]), - getText('${_hyshLx}时间:' + mapZpjl[_hyshSj]), + // getText('${_hyshLx}用户:' + mapZpjl[_hyshYh]), + // getText('${_hyshLx}时间:' + mapZpjl[_hyshSj]), + getUserAndTime('${_hyshLx}用户:' + mapZpjl[_hyshYh], '时间:' + mapZpjl[_hyshSj]), _hyshInfo == 'hyfhInfo' && widget.hyshlx == 'tsjj' ? (getText2('推送状态:', widget.tsztText, ' (${getDate(mapZpjl['ts_time'])})', color: diff --git a/lib/pages/Works/TJXX/today_list_zpjl_content.dart b/lib/pages/Works/TJXX/today_list_zpjl_content_new0.dart similarity index 84% rename from lib/pages/Works/TJXX/today_list_zpjl_content.dart rename to lib/pages/Works/TJXX/today_list_zpjl_content_new0.dart index eaab13b..5d7ef70 100644 --- a/lib/pages/Works/TJXX/today_list_zpjl_content.dart +++ b/lib/pages/Works/TJXX/today_list_zpjl_content_new0.dart @@ -11,6 +11,7 @@ import 'package:keyboard_avoider/keyboard_avoider.dart'; import '../../../components/commonFun.dart'; import '../../../components/doJSON.dart'; import '../../../components/hyxx_data_handle.dart'; +import 'package:flustars/flustars.dart' as flustars; //该组件中有ScreenUtil // "today": { // "total": 4, @@ -28,30 +29,36 @@ import '../../../components/hyxx_data_handle.dart'; // "video_url": "video/3_6063_20210404_113111_川15A2563.mp4" // }, -class TodayListZpjlContent extends StatefulWidget { - TodayListZpjlContent({ +class TodayListZpjlContentNew extends StatefulWidget { + TodayListZpjlContentNew({ @required this.hyshlx, - @required this.num, + @required this.index, + // @required this.num, @required this.text, - @required this.mapZpjl, + // @required this.mapZpjl, this.tsztText = '', Key key, }) : super(key: key); String hyshlx; - String num; + + // String num; + int index; String text; - Map mapZpjl; + + // Map mapZpjl; String tsztText; _TodayListZpjlPageState createState() => _TodayListZpjlPageState(); } //用TabController实现顶部tab切换 -class _TodayListZpjlPageState extends State { +class _TodayListZpjlPageState extends State { //try_setState(); //避免如下异常报错 try_setState() { try { - setState(() {}); + if (mounted) { + setState(() {}); + } } catch (e) { print('setState(() {})异常:${e}'); } @@ -80,6 +87,11 @@ class _TodayListZpjlPageState extends State { Map mapName = {}; + int listLen = 0; + String num; + Map mapZpjl; + + @override void initState() { _context = context; _widthLeft = _screenWidth / 2.6; @@ -89,10 +101,30 @@ class _TodayListZpjlPageState extends State { mapName['plate_id'] = widget.hyshlx == 'jrzp' ? 'car_number' : 'plate_id'; mapName['plate_color'] = widget.hyshlx == 'jrzp' ? 'cpys' : 'plate_color'; - imageWztp = getWztp(); //得到违章图片 + getZpjlData(); // 得到 index 对应的今日抓拍记录数据 super.initState(); } + getZpjlData() async { + listLen = listTodayList.length; + num = '(${widget.index + 1}/${listLen})'; + mapZpjl = listTodayList[widget.index]; + + // 获取网络图片尺寸,getMediaUrl(_mapGetTsjjGetData['pic_url']) + await flustars.WidgetUtil.getImageWH(url: getMediaUrl(mapZpjl['pic_url'])).then((rect) { + if (null != rect) { + _radioImage = rect.height / rect.width; + print("rect = $rect,_radioImage = $_radioImage"); + // rect = Rect.fromLTRB(0.0, 0.0, 0.0, 0.0),_radioImage = NaN + // rect = Rect.fromLTRB(0.0, 0.0, 4096.0, 3360.0),_radioImage = 0.8203125 + } + }); + + imageWztp = getWztp(); //得到违章图片 + getPreBtn_NextBtn(); + try_setState(); + } + double _radioImage = 9 / 16; // 使用 cached_network_image 插件实现网络图片缓存 @@ -102,7 +134,7 @@ class _TodayListZpjlPageState extends State { imageUrl: url, alignment: Alignment.topCenter, imageBuilder: (context, imageProvider) => DragScaleContainer( - doubleTapStillScale: true, child: Image(image: imageProvider) + doubleTapStillScale: true, child: Image(image: imageProvider, fit: BoxFit.fill) // child: Image( // image: NetworkImage( // 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'), @@ -154,9 +186,8 @@ class _TodayListZpjlPageState extends State { right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 0), decoration: BoxDecoration( border: Border.all( - color: (lgmzs == widget.mapZpjl['lgmzs']) - ? Colors.red - : Color.fromRGBO(244, 244, 244, 1), + color: + (lgmzs == mapZpjl['lgmzs']) ? Colors.red : Color.fromRGBO(244, 244, 244, 1), width: 2), //color: Colors.lightBlue, borderRadius: new BorderRadius.circular(3.0), @@ -194,7 +225,7 @@ class _TodayListZpjlPageState extends State { } Playing = true; //禁止同时启动两次播放器 - urlnew = getMediaUrl(widget.mapZpjl['video_url']); + urlnew = getMediaUrl(mapZpjl['video_url']); //获取视频地址失败 if (!isVideoUrl(urlnew)) { @@ -206,14 +237,14 @@ class _TodayListZpjlPageState extends State { loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。 url: urlnew, title: - '${widget.text}视频${widget.num}\n${widget.mapZpjl[mapName['plate_id']]}(${getDwmc(widget.mapZpjl['dwip'])})'))); + '${widget.text}视频${num}\n${mapZpjl[mapName['plate_id']]}(${getDwmc(mapZpjl['dwip'])})'))); // Navigator.of(_context).push(MaterialPageRoute( // builder: (context) => PlayerProNew( // loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。 // url: urlnew, // title: - // '${widget.text}视频${widget.num}\n${widget.mapZpjl[mapName['plate_id']]}(${getDwmc(widget.mapZpjl['dwip'])})'))); + // '${widget.text}视频${num}\n${mapZpjl[mapName['plate_id']]}(${getDwmc(mapZpjl['dwip'])})'))); }, ), SizedBox(width: ScreenUtil().setWidth(15)), @@ -232,7 +263,7 @@ class _TodayListZpjlPageState extends State { width: ScreenUtil().setWidth(1022), //height: ScreenUtil().setHeight(639), //height: ScreenUtil().setHeight(22 + 1022 * _radioImage), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), decoration: BoxDecoration( //color: Colors.white, borderRadius: BorderRadius.all( @@ -245,8 +276,9 @@ class _TodayListZpjlPageState extends State { top: ScreenUtil().setHeight(_marginLeft), child: Container( width: ScreenUtil().setWidth(1022), - height: ScreenUtil().setHeight(30 + 1022 * _radioImage), - child: getNetworkImage(getMediaUrl(widget.mapZpjl['pic_url'])), + // height: ScreenUtil().setHeight(30 + 1022 * _radioImage), + height: ScreenUtil().setHeight(30 + 1022 * g_radioImage), + child: getNetworkImage(getMediaUrl(mapZpjl['pic_url'])), ), ) ], @@ -302,13 +334,13 @@ class _TodayListZpjlPageState extends State { //违章信息组件1:车牌号码、车牌颜色 getWzxxPart1(), //违章信息组件2:抓拍时间组件 - getWzxxText('抓拍时间:' + widget.mapZpjl['zpsj']), + getWzxxText('抓拍时间:' + mapZpjl['zpsj']), //违章信息组件3:车牌类型 + 黑度 getWzxxPart3(), //违章信息组件4:抓拍地点(简称) - getWzxxText('抓拍地点:' + getDwmc(widget.mapZpjl['dwip']) + ' (简称)'), + getWzxxText('抓拍地点:' + getDwmc(mapZpjl['dwip']) + ' (简称)'), //违章信息组件5:抓拍地点 - getWzxxText('抓拍地点:' + widget.mapZpjl['dwms']), + getWzxxText('抓拍地点:' + mapZpjl['dwms']), ], ), ); @@ -345,12 +377,11 @@ class _TodayListZpjlPageState extends State { children: [ SizedBox(width: ScreenUtil().setWidth(_marginLeft)), getTitleText('车牌号码:'), - getBoderText(widget.mapZpjl[mapName['plate_id']].toString(), + getBoderText(mapZpjl[mapName['plate_id']].toString(), width: ScreenUtil().setWidth(1022 / 3.2)), Expanded(child: SizedBox.shrink()), getTitleText('颜色:'), - getBoderText(widget.mapZpjl[mapName['plate_color']], - width: ScreenUtil().setWidth(1022 / 4.8)), + getBoderText(mapZpjl[mapName['plate_color']], width: ScreenUtil().setWidth(1022 / 4.8)), SizedBox(width: ScreenUtil().setWidth(_marginLeft)), ], ); @@ -391,7 +422,7 @@ class _TodayListZpjlPageState extends State { } Widget getBoderText(String text, {double width = 40}) { - cpysItem _cpysItem = cpysMap[widget.mapZpjl[mapName['plate_color']]]; + cpysItem _cpysItem = cpysMap[mapZpjl[mapName['plate_color']]]; return Container( //color: _cpysItem.cpysBackground, @@ -455,11 +486,11 @@ class _TodayListZpjlPageState extends State { Container( alignment: Alignment(-1, 0), //width: ScreenUtil().setWidth(1022) - ScreenUtil().setWidth(_marginLeft), - child: getTitleText('车牌类型:' + widget.mapZpjl['cplx']), + child: getTitleText('车牌类型:' + mapZpjl['cplx']), ), Expanded(child: SizedBox.shrink()), - //getTitleText('黑度: ${widget.mapZpjl['lgmzs']}'), - getTitleRichText('黑度:', text2: '${widget.mapZpjl['lgmzs']} '), + //getTitleText('黑度: ${mapZpjl['lgmzs']}'), + getTitleRichText('黑度:', text2: '${mapZpjl['lgmzs']} '), SizedBox(width: ScreenUtil().setWidth(_marginLeft)), ], ); @@ -476,10 +507,12 @@ class _TodayListZpjlPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(width: ScreenUtil().setWidth(_marginLeft)), - Text(text, - textAlign: TextAlign.left, - overflow: TextOverflow.ellipsis, - style: TextStyle(color: color)) + // Flutter 解决Text内容展示越界 + Expanded( + child: Text(text, + textAlign: TextAlign.left, + overflow: TextOverflow.ellipsis, + style: TextStyle(color: color))) ], ), ), @@ -545,18 +578,18 @@ class _TodayListZpjlPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(width: ScreenUtil().setWidth(_marginLeft)), - Text('${_hyshLx}结果:' + widget.mapZpjl[_hyshJg], + Text('${_hyshLx}结果:' + mapZpjl[_hyshJg], textAlign: TextAlign.left, overflow: TextOverflow.ellipsis), SizedBox(width: ScreenUtil().setWidth(20)), Container( width: my_iconSize, height: my_iconSize, - decoration: widget.mapZpjl[_hyshJg] == '' + decoration: mapZpjl[_hyshJg] == '' ? null : BoxDecoration( //color: Colors.white, image: DecorationImage( - image: AssetImage(widget.mapZpjl[_hyshJg] == "黑烟车" + image: AssetImage(mapZpjl[_hyshJg] == "黑烟车" ? "assets/images/hyc.png" : "assets/images/fhyc.png"), fit: BoxFit.contain), @@ -569,11 +602,11 @@ class _TodayListZpjlPageState extends State { ), ], ), - getText('${_hyshLx}意见:' + widget.mapZpjl[_hyshYj]), - getText('${_hyshLx}用户:' + widget.mapZpjl[_hyshYh]), - getText('${_hyshLx}时间:' + widget.mapZpjl[_hyshSj]), + getText('${_hyshLx}意见:' + mapZpjl[_hyshYj]), + getText('${_hyshLx}用户:' + mapZpjl[_hyshYh]), + getText('${_hyshLx}时间:' + mapZpjl[_hyshSj]), _hyshInfo == 'hyfhInfo' && widget.hyshlx == 'tsjj' - ? (getText2('推送状态:', widget.tsztText, ' (${getDate(widget.mapZpjl['ts_time'])})', + ? (getText2('推送状态:', widget.tsztText, ' (${getDate(mapZpjl['ts_time'])})', color: widget.tsztText.indexOf('成功') >= 0 ? Colors.blueAccent : Colors.black26)) : SizedBox.shrink(), @@ -613,10 +646,72 @@ class _TodayListZpjlPageState extends State { Navigator.pop(context); }, width: 90.0), + preBtn, + nextBtn, ], ); } + //解决第一次进入报错问题。因为getPreBtn_NextBtn()还未执行,preBtn和nextBtn为空 + Widget preBtn = Container( + color: Colors.white12, //onPressedFun为null时无效 + width: 70.0, + height: 35.0, + child: RaisedButton( + padding: EdgeInsets.all(0), + textColor: Colors.black, + child: Text('上一条'), + onPressed: null, + ), + ); + + Widget nextBtn = Container( + color: Colors.white12, //onPressedFun为null时无效 + width: 70.0, + height: 35.0, + child: RaisedButton( + padding: EdgeInsets.all(0), + textColor: Colors.black, + child: Text('下一条'), + onPressed: null, + ), + ); + + getPreBtn_NextBtn() { + preBtn = getBtnSizeX( + text: "上一条", + onPressedFun: null, + ); + nextBtn = getBtnSizeX( + text: "下一条", + onPressedFun: null, + ); + + if (widget.index > 0 && listLen > 0) { + preBtn = getBtnSizeX( + text: "上一条", + onPressedFun: () async { + if (widget.index > 0) { + widget.index--; + getZpjlData(); + } + }, + ); + } + + if (widget.index < (listLen - 1) && listLen > 0) { + nextBtn = getBtnSizeX( + text: "下一条", + onPressedFun: () async { + if (widget.index < listLen - 1) { + widget.index++; + getZpjlData(); + } + }, + ); + } + } + bool showMoreWidget = false; @override @@ -670,7 +765,7 @@ class _TodayListZpjlPageState extends State { }, ), Expanded( - child: Text(widget.text + '记录' + widget.num, + child: Text(widget.text + '记录' + num, style: TextStyle(color: Colors.white, fontSize: 20), textAlign: TextAlign.center, overflow: TextOverflow.ellipsis), @@ -748,7 +843,7 @@ class _TodayListZpjlPageState extends State { //color: Colors.white, image: DecorationImage( //image: AssetImage("assets/images/jkzx_stamp.png"), fit: BoxFit.contain), - image: AssetImage(widget.mapZpjl['fs_tile'] == '黑烟车' + image: AssetImage(mapZpjl['fs_tile'] == '黑烟车' ? "assets/images/hyc.png" : "assets/images/fhyc.png"), fit: BoxFit.contain), 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); + } +}