hyzp_ybqx-Commit001:代码刚转换好,编译通过

This commit is contained in:
WinUser01
2021-12-09 20:24:36 +08:00
commit 8c74b14e5c
800 changed files with 66912 additions and 0 deletions
+828
View File
@@ -0,0 +1,828 @@
//import '../../../widget/player_pro.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flustars/flustars.dart'
as flustars; //该组件中有ScreenUtil,// 获取网络图片尺寸flustars.WidgetUtil
import 'package:flutter/material.dart';
import 'package:flutter_drag_scale/flutter_drag_scale.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hyzp_ybqx/widget/my_superplayer.dart';
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';
import '../../../components/hyxx_data_handle.dart';
class FhycxContentNew extends StatefulWidget {
FhycxContentNew({
@required this.hyshlx,
@required this.title,
this.indexRecord,
this.id,
Key key,
}) : super(key: key);
String title;
int indexRecord = 0;
int id = -1;
String hyshlx;
_FhycxPageState createState() => _FhycxPageState();
}
//用TabController实现顶部tab切换
class _FhycxPageState extends State<FhycxContentNew> {
//try_setState(); //避免如下异常报错
try_setState() {
try {
setState(() {});
} catch (e) {
print('setState(() {})异常:${e}');
}
}
dispose() {
super.dispose();
}
BuildContext _context;
String _title = '';
//flutter_screenUtil 4.x 用法,ScreenUtil.screenWidth (sdk>=2.6 : 1.sw) //设备宽度
double _screenWidth = 1.sw;
double _marginLeft = 25;
double _marginCenter = 20;
double _fontSize = 16;
double _widthLeft = 40; // = _screenWidth / 3;
double _iconSize = 18;
double _stampSize = 100;
double _listTileHeight = 30;
Color _iconColor = Colors.blue;
double _marginVer = 10;
Map _mapTsjjGetTsStatus = {};
void initState() {
super.initState();
_context = context;
_widthLeft = _screenWidth / 2.6;
getListFlields();
}
Map _mapGetTsjjGetData = {
"ret": 200,
"data": {
"id": 1203,
"plate_id": "川QS9661",
"plate_color": "蓝色",
"zpsj": 1612770967,
"yjxx_id": "1379",
"workflow": 2,
"video_url": "video/9_6063_20210208_155607_川QS9661.mp4",
"pic_url": "/wwwroot/admin/Api/wwwroot/public/uploads/926f5168f1fe109a9b8ec88dcac7ac2c.jpg",
"clfl": "皮卡车",
"dwip": "172.16.3.9",
"dwms": "宜长路出城方向",
"lgmzs": 3,
"jczxd": "863",
"sfhy": "黑烟车"
},
"msg": ""
};
double _radioImage = 9 / 16;
getListFlields() async {
_mapGetTsjjGetData = await getWzxxItemData(widget.id); //获取指定id的违章信息返回 _mapGetTsjjGetData
print('_mapGetTsjjGetData = ${_mapGetTsjjGetData}');
await getShenheData(widget.id); //获取指定id的审核信息存入 listGetShenheData
await getMapGetShenheData(); //从listGetShenheData中取出数据分别存入mapGetHycsShenheData、mapGetHyfhShenheData
// 获取推送交警状态信息
// tsjjGetTsStatus返回字段 类型 说明
// id 整型 违章记录ID
// checkid 整型 推送的抓拍记录ID
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 3-推送成功
// ts_time 字符串 推送时间
//Future tsjjGetTsStatus(int _wzxxID)
_mapTsjjGetTsStatus = await tsjjGetTsStatus(widget.id);
// 获取网络图片尺寸
flustars.WidgetUtil.getImageWH(url: getMediaUrl(_mapGetTsjjGetData['pic_url'])).then((rect) {
if (null != rect) {
_radioImage = rect.height / rect.width;
}
});
imageWztp = getWztp(); //得到违章图片
//下面读取的是全局数据,该模块不需要修改
// 川Q565H4
try {
//_title = '${widget.title}(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length})id:${listHycsGetList2[widget.indexRecord]['id']}';
//_title = '${widget.title}(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length}):${listHycsGetList2[widget.indexRecord]["plate_id"]}(${listHycsGetList2[widget.indexRecord]["plate_color"]})';
_title =
'${widget.title}(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length})';
setState(() {});
} catch (e) {}
}
// 使用 cached_network_image 插件实现网络图片缓存
// 使用 flutter_drag_scale 实现可缩放可拖拽双击放大的图片功能。PhotoView插件不好用,有问题
Widget getNetworkImage(String url) {
return CachedNetworkImage(
imageUrl: url,
alignment: Alignment.topCenter,
imageBuilder: (context, imageProvider) => DragScaleContainer(
doubleTapStillScale: true, child: Image(image: imageProvider)
// child: Image(
// image: NetworkImage(
// 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),
// ),
),
// imageBuilder: (context, imageProvider) => PhotoView(
// imageProvider: imageProvider,
// ),
//placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) =>
getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0),
errorWidget: (context, url, error) => Icon(Icons.error),
);
}
// 167 50 3.34
Widget getLgmzs(int lgmzs, {double width = 127, double height = 127}) {
int _rgb = (255 * (5 - lgmzs)) ~/ 5;
return Stack(
children: [
Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 4),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('$lgmzs级${lgmzs * 20}%', style: TextStyle(fontSize: 10)),
//SizedBox(height: 0),
Container(
width: ScreenUtil().setWidth(66),
height: ScreenUtil().setHeight(66),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
color: Color.fromRGBO(_rgb, _rgb, _rgb, 1.0),
borderRadius: new BorderRadius.circular(0),
),
)
],
),
),
Positioned(
top: ScreenUtil().setHeight(4),
child: Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height - 8),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 0),
decoration: BoxDecoration(
border: Border.all(
color: (lgmzs == _mapGetTsjjGetData['lgmzs'])
? Colors.red
: Color.fromRGBO(244, 244, 244, 1),
width: 2),
//color: Colors.lightBlue,
borderRadius: new BorderRadius.circular(3.0),
),
),
)
],
);
}
//得到tsjj页面组件
//1、得到格林曼黑度标准和视频播放按钮组件
Widget getHdAndPlay() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
getLgmzs(0),
getLgmzs(1),
getLgmzs(2),
getLgmzs(3),
getLgmzs(4),
getLgmzs(5, width: 153),
getIconBtnSizeX(
height: 104,
//getIconBtnSizeX 中已经使用ScreenUtil().setHeight(126),此处不能传 ScreenUtil().setHeight(126) ,否则严重错位
width: 168,
text: "视频",
textSize: 12,
circular: 4,
color: Color.fromRGBO(52, 157, 237, 1),
onTop: () async {
if (Playing) {
//禁止同时启动两次播放器
return;
}
Playing = true; //禁止同时启动两次播放器
urlnew = getMediaUrl(_mapGetTsjjGetData['video_url']);
//获取视频地址失败
if (!isVideoUrl(urlnew)) {
return;
}
Navigator.of(_context).push(MaterialPageRoute(
builder: (context) => SuperPlayerPage(
loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
url: urlnew,
title:
'违章视频: ${_mapGetTsjjGetData["plate_id"]}\n${_mapGetTsjjGetData['dwms']}')));
// Navigator.of(_context).push(MaterialPageRoute(
// builder: (context) => PlayerProNew(
// loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
// url: urlnew,
// title:
// '违章视频: ${_mapGetTsjjGetData["plate_id"]}\n${_mapGetTsjjGetData['dwms']}')));
},
),
SizedBox(width: ScreenUtil().setWidth(15)),
],
);
}
Widget imageWztp;
//2、得到违章图片组件
Widget getWztp() {
//ratioList[index] = 0.5714285714285714
return Stack(
children: [
Container(
width: ScreenUtil().setWidth(1022),
//height: ScreenUtil().setHeight(639),
//height: ScreenUtil().setHeight(22 + 1022 * _radioImage),
height: ScreenUtil().setHeight(30 + 1022 * _radioImage),
decoration: BoxDecoration(
//color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
),
Positioned(
//left: ScreenUtil().setWidth(_marginLeft),
top: ScreenUtil().setHeight(_marginLeft),
child: Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(30 + 1022 * _radioImage),
child: getNetworkImage(getMediaUrl(_mapGetTsjjGetData['pic_url'])),
),
)
],
);
}
// void printScreenInformation() {
// print('Device width dp:${1.sw}dp');
// print('Device height dp:${1.sh}dp');
// print('Device pixel density:${ScreenUtil().pixelRatio}');
// print('Bottom safe zone distance dp:${ScreenUtil().bottomBarHeight}dp');
// print('Status bar height dp:${ScreenUtil().statusBarHeight}dp');
// print('The ratio of actual width to UI design:${ScreenUtil().scaleWidth}');
// print(
// 'The ratio of actual height to UI design:${ScreenUtil().scaleHeight}');
// print('System font scaling:${ScreenUtil().textScaleFactor}');
// print('0.5 times the screen width:${0.5.sw}dp');
// print('0.5 times the screen height:${0.5.sh}dp');
// }
void printScreenInformation() {
print('ScreenUtil().screenWidth = ${ScreenUtil().screenWidth}');
print('设备宽度:${1.sw}dp');
print('"1.w" = ${1.w}');
print('"1.sw" = ${1.sw}');
print('设备高度:${1.sh}dp');
print('设备的像素密度:${ScreenUtil().pixelRatio}');
print('底部安全区距离:${ScreenUtil().bottomBarHeight}dp');
print('状态栏高度:${ScreenUtil().statusBarHeight}dp');
print('实际宽度的dp与设计稿px的比例:${ScreenUtil().scaleWidth}');
print('实际高度的dp与设计稿px的比例:${ScreenUtil().scaleHeight}');
print('宽度和字体相对于设计稿放大的比例:${ScreenUtil().scaleWidth * ScreenUtil().pixelRatio}');
print('高度相对于设计稿放大的比例:${ScreenUtil().scaleHeight * ScreenUtil().pixelRatio}');
print('系统的字体缩放比例:${ScreenUtil().textScaleFactor}');
print('屏幕宽度的0.5:${0.5.sw}dp');
print('屏幕高度的0.5:${0.5.sh}dp');
}
//3、得到违章图片说明信息组件
Widget getWztpSmxx() {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(280),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
getWzxxPart1(),
getWzxxPart2(),
getWzxxPart3(),
],
),
);
}
// I/flutter (22989): ScreenUtil().screenWidth = 360.0
// I/flutter (22989): 设备宽度:360.0dp
// I/flutter (22989): "1.w" = 0.3333333333333333
// I/flutter (22989): "1.sw" = 360.0
// I/flutter (22989): 设备高度:640.0dp
// I/flutter (22989): 设备的像素密度:3.0
// I/flutter (22989): 底部安全区距离:0.0dp
// I/flutter (22989): 状态栏高度:24.0dp
// I/flutter (22989): 实际宽度的dp与设计稿px的比例:0.3333333333333333
// I/flutter (22989): 实际高度的dp与设计稿px的比例:0.3333333333333333
// I/flutter (22989): 宽度和字体相对于设计稿放大的比例:1.0
// I/flutter (22989): 高度相对于设计稿放大的比例:1.0
// I/flutter (22989): 系统的字体缩放比例:1.0
// I/flutter (22989): 屏幕宽度的0.5:180.0dp
// I/flutter (22989): 屏幕高度的0.5:320.0dp
//3、得到违章信息组件1:车牌号码、车牌颜色
//车牌颜色Map cpysMap = {
// '蓝色': cpysItem(
// cpysText: '蓝色',
// cpysBackground: Colors.blue,
// cpysFont: Colors.white,
// cpysBorder: Colors.orange),
// }
Widget getWzxxPart1() {
//printScreenInformation();
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
getTitleText('车牌号码:'),
getBoderText(_mapGetTsjjGetData['plate_id'].toString(),
width: ScreenUtil().setWidth(1022 / 3.2)),
SizedBox(width: ScreenUtil().setWidth(_marginCenter)),
getTitleText('颜色:'),
getBoderText(_mapGetTsjjGetData['plate_color'], width: ScreenUtil().setWidth(1022 / 4.8)),
],
);
}
Widget getTitleText(String text, {double fontSize = 16}) {
return Text(text,
style: TextStyle(fontSize: fontSize),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis);
}
Widget getTrailText(String text, {double fontSize = 16, double off = 0}) {
return Container(
width: _screenWidth - _widthLeft - off - (2 * ScreenUtil().setWidth(_marginLeft)),
child: Text(text,
style: TextStyle(fontSize: fontSize),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis),
);
}
Widget getBoderText(String text, {double width = 40}) {
cpysItem _cpysItem = cpysMap[_mapGetTsjjGetData['plate_color']];
return Container(
//color: _cpysItem.cpysBackground,
alignment: Alignment(0, -1),
width: width,
decoration: BoxDecoration(
border: Border.all(color: _cpysItem.cpysBorder, width: 2),
color: _cpysItem.cpysBackground,
borderRadius: BorderRadius.circular(3),
),
child: Padding(
padding: EdgeInsets.only(bottom: 3),
child: Text(text,
style: TextStyle(fontSize: _fontSize, color: _cpysItem.cpysFont),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis),
),
);
}
//I/flutter (17555): _mapGetTsjjGetData = {
// id: 1222, plate_id: 川Q736X2, plate_color: 蓝色, zpsj: 1612857077, yjxx_id: 1399, workflow: 999,
// video_url: video/9_6063_20210209_155117_川Q736X2.mp4,
// pic_url: /wwwroot/admin/Api/wwwroot/public/uploads/9d2f45fd24b41f2b94abe42b30970d75.jpg,
// clfl: 集装箱卡车, dwip: 172.16.3.9, dwms: 宜长路出城方向, lgmzs: 3, jczxd: 994, sfhy: 黑烟车
// }
Widget getIcon(IconData _iconData) {
return Container(
width: _iconSize - 2,
height: _iconSize,
child: Padding(
padding: EdgeInsets.only(top: 2),
child: Icon(_iconData, size: _iconSize, color: _iconColor),
),
);
}
//4、得到违章信息组件2:抓拍时间组件
Widget getWzxxPart2() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) - ScreenUtil().setWidth(_marginLeft),
child: getTitleText(
'抓拍时间:' +
getDate(
(_mapGetTsjjGetData['zpsj'] is int)
? _mapGetTsjjGetData['zpsj']
: int.parse(_mapGetTsjjGetData['zpsj']),
),
),
),
],
);
}
Widget getWzxxPart3() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) - ScreenUtil().setWidth(_marginLeft),
child: getTitleText('抓拍地点:' + _mapGetTsjjGetData['dwms']),
),
],
);
}
//6、得到审核信息组件4:违章类型、格林曼黑度组件
Widget getWzxxPart4() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Container(
alignment: Alignment(-1, 0),
width: _widthLeft,
child: getTitleText('违章类型:' + _mapGetTsjjGetData['sfhy']),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
//getIcon(Icons.location_on_outlined),
Container(
width: _iconSize,
height: _iconSize,
decoration: BoxDecoration(
//color: Colors.white,
image: DecorationImage(image: AssetImage("assets/images/hyc.png"), fit: BoxFit.contain),
),
alignment: Alignment.center,
//child:
),
getTrailText(':' + _mapGetTsjjGetData['lgmzs'].toString(), off: _iconSize),
],
);
}
//从listGetShenheData中取出数据分别存入mapGetHycsShenheData、mapGetHyfhShenheData
//7、得到审核信息组件5:初审人员,初审时间
Widget getWzxxPart5() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Container(
alignment: Alignment(-1, 0),
width: _widthLeft,
child: getTitleText('初审人员:' + mapGetHycsShenheData['uname']),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
getIcon(Icons.query_builder),
getTrailText(':' + mapGetHycsShenheData['addtime'], off: _iconSize),
],
);
}
//8、得到审核信息组件6:复审人员,复审时间
Widget getWzxxPart6() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Container(
alignment: Alignment(-1, 0),
width: _widthLeft,
child: getTitleText('复审人员:' + mapGetHyfhShenheData['uname']),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
getIcon(Icons.query_builder),
getTrailText(':' + mapGetHyfhShenheData['addtime'], off: _iconSize),
],
);
}
//5、得到黑烟初审'hycsInfo'、或者黑烟'hyfhInfo'複核信息组件
//style: TextStyle(fontSize: _fontSize),
Widget getHyshInfo(String _hyshInfo) {
String _hyshlx = '初审';
Map _hyshMap = mapGetHycsShenheData;
if (_hyshInfo == 'hyfhInfo') {
_hyshlx = '复审';
if (mapGetHyfhShenheData.isNotEmpty) {
_hyshMap = mapGetHyfhShenheData;
} else {
//保留_hyshMap所有字段,但遍历清空所有字段的值
_hyshMap.forEach((var key, var value) {
_hyshMap[key] = '';
});
}
}
double _radio = 2.2;
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(161),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) / _radio,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Text('$_hyshlx结果:' + _hyshMap['title'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
SizedBox(width: ScreenUtil().setWidth(6)),
Container(
width: my_iconSize,
height: my_iconSize,
decoration: _hyshMap['title'] == ''
? null
: BoxDecoration(
//color: Colors.white,
image: DecorationImage(
image: AssetImage(_hyshMap['title'] == "黑烟车"
? "assets/images/hyc.png"
: "assets/images/fhyc.png"),
fit: BoxFit.contain),
),
alignment: Alignment.center,
//child:
),
],
),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Expanded(
child: Text('意见:' + _hyshMap['shuoming'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) / _radio,
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Text('$_hyshlx用户:' + _hyshMap['uname'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
]),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Expanded(
child: Text('时间:' + _hyshMap['addtime'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
),
],
),
],
),
);
}
//9、得到推送交警状态信息组件7:推送状态
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 3-推送成功
//_mapTsjjGetTsStatus['tszt']
Widget getWzxxPart7() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Container(
alignment: Alignment(-1, 0),
width: _screenWidth - ScreenUtil().setWidth(_marginLeft),
child: getTitleText('推送状态:' + mapTsztText[_mapTsjjGetTsStatus['tszt']]),
),
],
);
}
//10、得到推送交警确认组件
Widget getTsjjQr() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
getBtnSizeX(
text: "返回",
onPressedFun: () async {
Navigator.pop(context);
},
width: 90.0),
],
);
}
bool showMoreWidget = false;
@override
Widget build(BuildContext context) {
return Scaffold(
//resizeToAvoidBottomPadding: false,
appBar: PreferredSize(
preferredSize: Size.fromHeight(ScreenUtil().setHeight(173)), // 设置appBar高度
// 设置appBar高度
child: AppBar(
automaticallyImplyLeading: false,
centerTitle: true,
titleSpacing: 0.0,
//设置title的左边距
flexibleSpace: Container(
//SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
// SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
child: Container(
//height: ScreenUtil().setHeight(173),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color.fromRGBO(12, 186, 156, 1),
Color.fromRGBO(39, 127, 235, 1),
],
),
),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [
// Color(0xFF0018EB),
// Color(0xFF01C1D9),
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
// ),
),
),
title: Padding(
padding: EdgeInsets.only(left: 0, right: 0),
child: Row(
//mainAxisAlignment: MainAxisAlignment.start,
children: [
getIconAndTextButton(
iconColor: Colors.white,
iconData: Icons.chevron_left_outlined,
onPress: showMoreWidget
? null
: () {
Navigator.pop(context);
},
),
Expanded(
child: Text(_title,
style: TextStyle(color: Colors.white, fontSize: 20),
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis),
),
SizedBox(width: 30),
],
),
),
),
),
body: null == imageWztp
// 显示加载中的圈圈
? getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0)
: Stack(
children: [
//SizedBox.shrink() 创建父类允许最小尺寸的约束Box
showMoreWidget
? Align(
alignment: Alignment(0, 0.8),
child: Container(
height: 200,
width: 200,
child: getMoreWidget2(
text: '推送中...',
color: Colors.red,
size: 40.0,
strokeWidth: 3.0), //显示加载中的圈圈,
),
)
: SizedBox.shrink(),
KeyboardAvoider(
autoScroll: true,
child: Container(
color: Color.fromRGBO(244, 244, 244, 1),
child: Column(
children: <Widget>[
//1、得到格林曼黑度标准和视频播放按钮组件
getHdAndPlay(),
//2、得到违章图片组件
imageWztp,
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//3、得到违章图片说明信息组件
getWztpSmxx(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//7、得到黑烟初审信息组件
getHyshInfo('hycsInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//8、得到黑烟复审信息组件
getHyshInfo('hyfhInfo'),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
// //7、得到审核信息组件5:初审人员,初审时间
// getWzxxPart5(),
// //8、得到审核信息组件6:复审人员,复审时间
// getWzxxPart6(),
// SizedBox(height: 6),
// Divider(height: 1.0, color: Colors.blue),
// SizedBox(height: 6),
//6、得到推送交警状态信息组件7:推送状态
//getWzxxPart7(),
// SizedBox(height: 8),
// Divider(height: 1.0, color: Colors.blue),
SizedBox(height: 18),
//9、得到推送交警确认组件
getTsjjQr(),
SizedBox(height: 10),
],
),
),
),
Positioned(
//alignment: Alignment(0.9, 0.35),
//alignment: Alignment(0.8, 0.45),
right: ScreenUtil().setWidth(80),
top: ScreenUtil().setHeight(1045),
child: Container(
//alignment: Alignment(0.5, -0.5),
width: _stampSize,
height: _stampSize,
//color: Colors.black12,
decoration: BoxDecoration(
//color: Colors.white,
image: DecorationImage(
//image: AssetImage("assets/images/jkzx_stamp.png"), fit: BoxFit.contain),
image: AssetImage("assets/images/fhyc.png"),
fit: BoxFit.contain),
),
//child:
),
),
],
),
);
}
Widget getBtnSizeX({@required text, width = 70.0, height = 35.0, onPressedFun}) {
return Container(
color: Colors.white12, //onPressedFun为null时无效
width: width,
height: height,
child: RaisedButton(
padding: EdgeInsets.all(0),
textColor: Colors.black,
child: Text(text),
onPressed: onPressedFun,
),
);
}
}
+919
View File
@@ -0,0 +1,919 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:hyzp_ybqx/widget/JdButton.dart';
//import 'package:hyzp_ybqx/widget/player_pro_new.dart';
import '../../../widget/CarNumberAndCpysItems.dart';
import '../../../components/dioFun.dart';
import '../../../components/doJSON.dart';
import '../../../components/hyxx_data_handle.dart';
import '../../../services/EventBus.dart';
import '../../../components/commonFun.dart';
import '../../../config/service_url.dart';
//import '../../../widget/player_pro.dart';
import '../../../widget/customRadioWidget.dart';
import 'package:dio/dio.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:photo_view/photo_view.dart';
//屏幕适配 flutter_screenutil 库与 flustars(获取网络图片尺寸要用到其 WidgetUtil) 库使用的 ScreenUtil() 类名冲突
// 解决办法是将 flustars 库取个别名 as flustars
import 'package:flustars/flustars.dart' as flustars;
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:keyboard_avoider/keyboard_avoider.dart';
import 'package:flutter_drag_scale/flutter_drag_scale.dart';
import 'hysh_group.dart';
import 'package:hyzp_ybqx/widget/my_superplayer.dart';
class HyshContentNew extends StatefulWidget {
HyshContentNew({
@required this.hyshlx,
@required this.title,
this.indexRecord,
this.id,
Key key,
}) : super(key: key);
String title;
int indexRecord = 0;
int id = -1;
String hyshlx;
_HyshPageState createState() => _HyshPageState();
}
//用TabController实现顶部tab切换
class _HyshPageState extends State<HyshContentNew> with SingleTickerProviderStateMixin {
//try_setState(); //避免如下异常报错
try_setState() {
try {
setState(() {});
} catch (e) {
print('setState(() {})异常:${e}');
}
}
//获取黑烟初审单条数据
//接口地址:http://49.235.208.235:9001/?s=App.Car_Yjxx.Get
//接口参数
// 参数名字 类型 是否必须 默认值 其他 说明
// id 字符串 必须 最小:1 ID
//List<TextEditingController> listController = [];
//List<List<TextEditingController>> listZpljController = [];
List ratioList = [];
//用TabController实现顶部tab切换
TabController _tabController;
//监听登录页面销毁的事件
dispose() {
_tabController?.dispose();
super.dispose();
//eventBus.fire(UserEvent('登录成功...'));
}
//int listLen = 0;
String nums = '';
bool bModifiable = false;
String cpysText = '';
String myCpys = '蓝色';
void initState() {
// TODO: implement initState
fh_hyc = true;
tsjj = true;
_context = context;
getListFlields();
// //监听违章信息数据更新事件
// eventBus.on<HycsDataUpdateEvent>().listen((event) {
// print(event.str);
// getListFlields();
// });
// //监听违章信息数据审核事件
// eventBus.on<WzxxDataAuditEvent>().listen((event) {
// print('HycsContentModify: ' + event.str);
// getListFlields();
// });
//黑监听烟初审数据审核Radio选项改变事件
eventBus.on<HycsDataAuditRadioEvent>().listen((event) {
print(event.str);
print('event.selectedRadio = ${event.selectedRadio.toString()}');
if (null != _tabController) {
topTabs_map['auditTitle'][_tabController.index] =
(event.selectedRadio == 0) ? hyc_text : fhyc_text;
topTabs_map['auditShuoming_Controller_List'][_tabController.index].text =
((widget.hyshlx == 'hyfh') ? '初审为' + mapGetHycsShenheData['title'] + '。复审' : '') +
((event.selectedRadio == 0) ? hyc_shyj : fhyc_shyj);
//解决 setState(() {}); 抛异常Unhandled Exception: setState() called after dispose():
try_setState(); //避免如下异常报错
}
});
//黑烟审核推送交警Checkbox改变事件
eventBus.on<HycsDataAuditCheckboxButton>().listen((event) {
print(event.str);
if (null != _tabController) {
//解决 setState(() {}); 抛异常Unhandled Exception: setState() called after dispose():
try_setState(); //避免如下异常报错
}
});
//黑烟初审数据审核Dropdown选项改变事件
eventBus.on<HycsDataAuditDropdownEvent>().listen((event) {
print(event.str);
print('event.selectedValue = ${event.selectedValue}');
print('_tabController.index = ${_tabController.index}');
//topTabs_map['cpysText_List'][_tabController.index] = event.selectedValue; //这样报错如下
myCpys = event.selectedValue;
try_setState(); //避免如下异常报错
//This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer inc
// ludes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
// topTabs_map['carNumberAndCpys_List'][_tabController.index] =
// getCarNumberAndCpys(_tabController.index);
//延时500毫秒执行
// Future.delayed(const Duration(milliseconds: 10), () {
// print('延时后输出:_tabController.index = ${_tabController.index}');
// //延时执行的代码
// //延时更新状态
// setState(() {});
// });
});
super.initState();
}
//避免如下异常报错
// try {
// setState(() {});
// } catch (e) {}
//E/flutter (12227): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: setState() called after dispose(): _LoginPageState#c4f60(lifecycle state: defunct, not mo
// unted, ticker inactive)
// E/flutter (12227): This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer inc
// ludes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
// E/flutter (12227): The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" prop
// erty of this object before calling setState() to ensure the object is still in the tree.
// E/flutter (12227): This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has bee
// n removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
// E/flutter (12227): #0 State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1208:9)
// E/flutter (12227): #1 State.setState (package:flutter/src/widgets/framework.dart:1243:6)
// E/flutter (12227): #2 _LoginPageState.getZpjlFields (package:hyzp_ybqx/pages/Works/HYSH/hysh_content.dart:163:7)
// E/flutter (12227): #3 _rootRunUnary (dart:async/zone.dart:1198:47)
// E/flutter (12227): #4 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
// E/flutter (12227): #5 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
// E/flutter (12227): #6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
// E/flutter (12227): #7 Future._propagateToListeners (dart:async/future_impl.dart:725:32)
// E/flutter (12227): #8 Future._completeWithValue (dart:async/future_impl.dart:529:5)
// E/flutter (12227): #9 Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
// E/flutter (12227): #10 _rootRun (dart:async/zone.dart:1190:13)
// E/flutter (12227): #11 _CustomZone.run (dart:async/zone.dart:1093:19)
// E/flutter (12227): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7)
// E/flutter (12227): #13 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
// E/flutter (12227): #14 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
// E/flutter (12227): #15 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
// E/flutter (12227):
// E/flutter (12227): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: 'package:flutter/src/widgets/media_query.dart': Failed assertion: line 812 pos 12: 'conte
// xt != null': is not true.
// E/flutter (12227): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
// E/flutter (12227): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
// E/flutter (12227): #2 MediaQuery.of (package:flutter/src/widgets/media_query.dart:812:12)
// E/flutter (12227): #3 _LoginPageState.getTopTabsMap (package:hyzp_ybqx/pages/Works/HYSH/hysh_content.dart:415:41)
// E/flutter (12227): #4 _LoginPageState.getZpjlFields (package:hyzp_ybqx/pages/Works/HYSH/hysh_content.dart:162:7)
//getListFlields({bool b = true}) async {
getListFlields() async {
//await getHycsGetData();
//Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'Map<dynamic, dynamic>'
//print('getListFlields().mapGetHycsGetData = ${mapGetHycsGetData}');
//if (b) {
//listZpljController.clear();
listGetZpjl.clear(); //必须先行清空,否则会出现记录数据错位问题
listFieldModify.clear();
mapGetHycsGetData.clear();
//1、获取指定id的抓拍记录列表存入listGetZpjl
//2、如果是黑烟复审,还需获取指定id的违章记录审核信息存入mapGetShenheData
await getItemData(widget.id);
//}
print('getListFlields().listGetZpjl = ${listGetZpjl}');
//print('getListFlields().mapGetHycsGetData = ${mapGetHycsGetData}');
await getZpjlFields();
//nums = '${(widget.indexRecord + 1).toString()} / $listLen';
try {
// nums = '(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length})id:${listHycsGetList2[widget.indexRecord]['id']}';
nums = '(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length})';
setState(() {});
} catch (e) {}
//setState(() {}); //刚进入时,执行该语句会会抛异常
//print('mapGetHycsGetData = \n${mapGetHycsGetData}');
}
Future getZpjlFields() async {
if (listGetZpjl.isNotEmpty) {
int len = listGetZpjl.length;
for (int i = 0; i < len; i++) {
// 获取网络图片尺寸
Rect rect =
await flustars.WidgetUtil.getImageWH(url: getMediaUrl(listGetZpjl[i]['pic_url']));
ratioList.add(rect.height / rect.width);
print("rect: " + rect.toString());
print("ratio: " + ratioList[i].toString());
}
await getTopTabsMap();
//用TabController实现顶部tab切换
_tabController = TabController(vsync: this, length: topTabs_map['listView_List'].length);
_tabController.addListener(() {
print('_tabController.index = ${_tabController.index}');
//Tab切换时,设置 sfyc 和 tsjj,只处理当前选中的抓拍记录 _tabController.index
set_sfyc_tsjj(int.parse(listGetZpjl[_tabController.index]['zpsj']));
//Tab切换时,初始化所有审核意见
int len = listGetZpjl.length;
for (int i = 0; i < len; i++) {
topTabs_map['auditShuoming_Controller_List'][i].text =
((widget.hyshlx == 'hyfh') ? '初审为' + mapGetHycsShenheData['title'] + '。复审' : '') +
hyc_shyj;
}
});
print('first : _tabController.index = ${_tabController.index}');
set_sfyc_tsjj(int.parse(listGetZpjl[_tabController.index]['zpsj']));
//避免如下异常报错
try_setState(); //避免如下异常报错
}
}
// 使用 cached_network_image 插件实现网络图片缓存
// 使用 flutter_drag_scale 实现可缩放可拖拽双击放大的图片功能。PhotoView插件不好用,有问题
Widget getNetworkImage(String url) {
return CachedNetworkImage(
imageUrl: url,
alignment: Alignment.topCenter,
imageBuilder: (context, imageProvider) => DragScaleContainer(
doubleTapStillScale: true, child: Image(image: imageProvider)
// child: Image(
// image: NetworkImage(
// 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),
// ),
),
// imageBuilder: (context, imageProvider) => PhotoView(
// imageProvider: imageProvider,
// ),
//placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) =>
getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0),
errorWidget: (context, url, error) => Icon(Icons.error),
);
}
//使用 cached_network_image 插件实现网络图片缓存
Widget getNetworkImage1(String url) {
return CachedNetworkImage(
imageUrl: url,
alignment: Alignment.topCenter,
//placeholder: (context, url) => CircularProgressIndicator(),
imageBuilder: (context, imageProvider) => PhotoView(
imageProvider: imageProvider,
),
placeholder: (context, url) =>
getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0),
errorWidget: (context, url, error) => Icon(Icons.error),
);
}
//3、得到违章图片说明信息组件
Widget getWztpSmxx(int index) {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(141),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
getWztpSmxx1(index),
getWztpSmxx2(index),
],
),
);
}
//3.1、得到违章图片说明信息1:黑度、抓拍时间组件
Widget getWztpSmxx1(int index) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(_marginLeft)),
width: ScreenUtil().setWidth(_preItem),
child:
Text('黑度:' + listGetZpjl[index]['lgmzs'].toString(), overflow: TextOverflow.ellipsis),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Icon(
Icons.query_builder,
size: ScreenUtil().setWidth(_iconSize),
color: _iconColor,
),
Container(
alignment: Alignment.centerLeft,
width: ScreenUtil().setWidth(1022 - _preItem - _marginLeft - _iconSize),
child: Text(
' :' +
getDate((listGetZpjl[index]['zpsj'] is int)
? listGetZpjl[index]['zpsj']
: int.parse(listGetZpjl[index]['zpsj'])),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis),
),
],
);
}
//3.2、得到违章图片说明信息:车型、抓拍地点组件
Widget getWztpSmxx2(int index) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(_marginLeft)),
width: ScreenUtil().setWidth(_preItem),
child: Text('车型:' + listGetZpjl[index]['clfl'], overflow: TextOverflow.ellipsis),
),
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Icon(
Icons.location_on_outlined,
size: ScreenUtil().setWidth(_iconSize),
color: _iconColor,
),
Container(
alignment: Alignment.centerLeft,
width: ScreenUtil().setWidth(1022 - _preItem - _marginLeft - _iconSize),
child: Text(' :' + listGetZpjl[index]['dwms'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis)),
],
);
}
//4、得到黑烟初审结果组件,在复审页面需要
Widget getHycsResult(int index) {
double _radio = 2.2;
return Column(
children: [
Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(141),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022 / _radio),
//height: ScreenUtil().setHeight(my_listTileHeight2),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Text('初审结果: ' + mapGetHycsShenheData['title'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
SizedBox(width: ScreenUtil().setWidth(6)),
Container(
width: ScreenUtil().setWidth(_iconSize),
height: ScreenUtil().setHeight(_iconSize),
decoration: BoxDecoration(
//color: Colors.white,
image: DecorationImage(
image: AssetImage(mapGetHycsShenheData['title'] == "黑烟车"
? "assets/images/hyc.png"
: "assets/images/fhyc.png"),
fit: BoxFit.contain),
),
alignment: Alignment.center,
//child:
),
],
),
),
SizedBox(width: ScreenUtil().setWidth(10)),
Expanded(
child: Text('意见: ' + mapGetHycsShenheData['shuoming'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022 / _radio),
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
SizedBox(width: ScreenUtil().setWidth(_marginLeft)),
Text('初审用户: ' + mapGetHycsShenheData['uname'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
]),
),
SizedBox(width: ScreenUtil().setWidth(10)),
Expanded(
child: Text('时间: ' + mapGetHycsShenheData['addtime'],
textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
),
],
),
],
),
),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
],
);
}
// 167 50 3.34
Widget getLgmzs(int index, int lgmzs, {double width = 127, double height = 127}) {
int _rgb = (255 * (5 - lgmzs)) ~/ 5;
return Stack(
children: [
Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 4),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('$lgmzs级${lgmzs * 20}%', style: TextStyle(fontSize: 10)),
//SizedBox(height: 0),
Container(
width: ScreenUtil().setWidth(66),
height: ScreenUtil().setHeight(66),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
color: Color.fromRGBO(_rgb, _rgb, _rgb, 1.0),
borderRadius: new BorderRadius.circular(0),
),
)
],
),
),
Positioned(
top: ScreenUtil().setHeight(4),
child: Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height - 8),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 0),
decoration: BoxDecoration(
border: Border.all(
color: (lgmzs == listGetZpjl[index]['lgmzs'])
? Colors.red
: Color.fromRGBO(244, 244, 244, 1),
width: 2),
//color: Colors.lightBlue,
borderRadius: new BorderRadius.circular(3.0),
),
),
)
],
);
}
//1、得到格林曼黑度标准和视频播放按钮组件
Widget getHdAndPlay(int index) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
getLgmzs(index, 0),
getLgmzs(index, 1),
getLgmzs(index, 2),
getLgmzs(index, 3),
getLgmzs(index, 4),
getLgmzs(index, 5, width: 153),
getIconBtnSizeX(
height: 104,
//getIconBtnSizeX 中已经使用ScreenUtil().setHeight(126),此处不能传 ScreenUtil().setHeight(126) ,否则严重错位
width: 168,
text: "视频",
textSize: 12,
circular: 4,
color: Color.fromRGBO(52, 157, 237, 1),
onTop: () async {
if (Playing) {
//禁止同时启动两次播放器
return;
}
Playing = true; //禁止同时启动两次播放器
urlnew = getMediaUrl(listGetZpjl[index]['video_url']);
//获取视频地址失败
if (!isVideoUrl(urlnew)) {
return;
}
Navigator.of(_context).push(MaterialPageRoute(
builder: (context) => SuperPlayerPage(
loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
url: urlnew,
title:
'违章视频: ${listGetZpjl[index]["car_number"]}(抓拍${index + 1})\n${listGetZpjl[index]['dwms']}')));
// Navigator.of(_context).push(MaterialPageRoute(
// builder: (context) => PlayerProNew(
// loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
// url: urlnew,
// title:
// '违章视频: ${listGetZpjl[index]["car_number"]}(抓拍${index + 1})\n${listGetZpjl[index]['dwms']}')));
},
),
SizedBox(width: ScreenUtil().setWidth(15)),
],
);
}
//2、得到违章图片组件
Widget getWztp(int index) {
print('ratioList[index] = ${ratioList[index]}');
//ratioList[index] = 0.5714285714285714
return Stack(
children: [
Container(
width: ScreenUtil().setWidth(1022),
//height: ScreenUtil().setHeight(639),
height: ScreenUtil()
.setHeight(22 + 1022 * (ratioList.isNotEmpty ? ratioList[index] : 9 / 16)),
decoration: BoxDecoration(
//color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
),
Positioned(
//left: ScreenUtil().setWidth(25),
top: ScreenUtil().setHeight(11),
child: Container(
width: ScreenUtil().setWidth(1022),
height:
ScreenUtil().setHeight(1022 * (ratioList.isNotEmpty ? ratioList[index] : 9 / 16)),
child: getNetworkImage(getMediaUrl(listGetZpjl[index]['pic_url'])),
),
)
],
);
}
double _fontSize = 16;
double _listTileHeight = 30;
double _iconSize = 55;
Color _iconColor = Colors.blue;
double _textFieldHeight = 8;
double _preItem = 360;
double _marginLeft = 33;
double _marginVer = 6;
BuildContext _context;
double _marginVertical1 = 3;
double _marginVertical2 = 5;
//double _marginVertical3 = 6;
double _marginVertical3 = 3;
//double _marginVertical4 = 10;
double _marginVertical4 = 6;
double _marginVertical5 = 10;
double _marginVertical6 = 20;
Future getTopTabsMap() async {
//map遍历,清空数据
topTabs_map.forEach((key, value) {
topTabs_map[key].clear();
});
int len = listGetZpjl.length;
for (int index = 0; index < len; index++) {
//顶部Tab标题
//topTabs_map['tabs_list'].add(Tab(text: '抓拍ID:${listGetZpjl[index]['id']}'));
topTabs_map['tabs_list'].add(Tab(text: '抓拍 ${(index + 1).toString()}'));
//可供用户修改的车牌号码
topTabs_map['car_number_List'].add(listGetZpjl[index]['car_number']);
//可供用户修改的车牌颜色
topTabs_map['cpysText_List'].add(listGetZpjl[index]['cpys']);
//可供用户修改的审核意见
topTabs_map['auditShuoming_Controller_List'].add(
TextEditingController.fromValue(TextEditingValue(
text: ((widget.hyshlx == 'hyfh') ? '初审为' + mapGetHycsShenheData['title'] + '。复审' : '') +
hyc_shyj,
// 保持光标在最后
selection: TextSelection.fromPosition(
TextPosition(affinity: TextAffinity.downstream, offset: hyc_shyj.length)))),
);
//可供用户修改的审核结果
topTabs_map['auditTitle'].add(hyc_text);
//车牌号码、车牌颜色
topTabs_map['carNumberAndCpys_List']
.add(CarNumberAndCpysItems(index, topTabs_map['cpysText_List'][index]));
//Tab页面
topTabs_map['listView_List'].add(
//flutter开发弹起键盘出现Overflow问题的解决方法,我出现的情况,这三种方法就可以解决。
KeyboardAvoider(
autoScroll: true,
child: Container(
decoration: new BoxDecoration(
color: Color.fromRGBO(244, 244, 244, 1),
),
child: Column(
children: <Widget>[
//1、得到格林曼黑度标准和视频播放按钮组件
getHdAndPlay(index),
//2、得到违章图片组件
getWztp(index),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//3、得到违章图片说明信息组件
getWztpSmxx(index),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//4、得到黑烟初审结果组件,在复审页面需要
widget.hyshlx == 'hyfh' ? getHycsResult(index) : SizedBox.shrink(),
//为了用户在切换审核结果Radio时显示不同图片,必须将以下组件都移入到RadioListItems类中
//5-6、得到黑烟审核组件、审核确认组件
HyshGroup(
index: index,
hyshlx: hyshlx,
fontSize: _fontSize,
size: Size(_listTileHeight, _listTileHeight),
id: widget.id),
//为了用户在切换审核结果Radio时显示不同图片,必须将以下组件都移入到RadioListItems类中
// SizedBox(height: 6),
// Divider(height: 1.0, color: Colors.blue),
// SizedBox(height: 10),
// //9、得到审核确认组件
// getShqr(index),
],
),
),
),
);
}
}
//flutter开发弹起键盘出现Overflow问题的解决方法
// 方法1:
// //Scaffold节点下添加resizeToAvoidBottomPadding: false,这样页面就不会随着键盘弹起而滚动。
// Scaffold(
// resizeToAvoidBottomPadding: false,
// body: Column()
// );
// 方法2:
// //外层使用SingleChildScrollView包裹一层,这样页面回随着键盘弹起而向上滚动。
// SingleChildScrollView(
// child: Column(
// children: [
// TextField()
// ],
// ),
// ),
// 方法3:
// //使用第三方库:keyboard_avoider,并且设置autoScroll为true
// pubspec.yaml文件下添加依赖:
// dependencies:
// keyboard_avoider: ^0.1.2
// 外层使用KeyboardAvoider包裹,设置autoScroll为true
// KeyboardAvoider(
// autoScroll: true
// child: Column(
// children: [
// TextField()
// ],
// )
// ),
// 我出现的情况,这三种方法就可以解决。
@override
Widget build(BuildContext context) {
print('topTabs_map[\'tabs_list\'].length = ${topTabs_map['tabs_list'].length}');
print('topTabs_map[\'listViewList\'].length = ${topTabs_map['listView_List'].length}');
return DefaultTabController(
//length: 8, //必须使用常数
//length: topTabs_map['tabs_list'].length,
length: topTabs_map['listView_List'].length,
//报错:Another exception was thrown: A RenderFlex overflowed by 99896 pixels on the bottom
//length: g_tabs, //报错: Another exception was thrown: RangeError (index): Invalid value: Valid value range is empty: 0
child: Scaffold(
//resizeToAvoidBottomPadding: false,
appBar: PreferredSize(
preferredSize: Size.fromHeight(ScreenUtil().setHeight(173)), // 设置appBar高度
child: AppBar(
//backgroundColor: Colors.black12,
// title: Text("${mapHyshlx[hyshlx]['text']}详情$nums",
// style: TextStyle(
// fontSize: _fontSize, color: myCpys == '绿色' ? Colors.green : Colors.blue)),
// title: Text("${mapHyshlx[hyshlx]['text']}详情$nums",
// style: TextStyle(fontSize: _fontSize)),
automaticallyImplyLeading: false,
centerTitle: true,
//leading: Text(''),
titleSpacing: 0.0,
//设置title的左边距
flexibleSpace: Container(
//SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
// SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
child: Container(
//height: ScreenUtil().setHeight(173),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color.fromRGBO(12, 186, 156, 1),
Color.fromRGBO(39, 127, 235, 1),
],
),
),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [
// Color(0xFF0018EB),
// Color(0xFF01C1D9),
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
// ),
),
),
title: Padding(
padding: EdgeInsets.only(left: 0, right: 0),
child: Row(
//mainAxisAlignment: MainAxisAlignment.start,
children: [
//1.1、返回按钮
getIconAndTextButton(
iconColor: Colors.white,
iconData: Icons.chevron_left_outlined,
onPress: () {
Navigator.pop(context);
},
),
Expanded(
// child: Text("${mapHyshlx[hyshlx]['text']}",
// textAlign: TextAlign.left, overflow: TextOverflow.ellipsis),
child: Text("${mapHyshlx[hyshlx]['text']}详情$nums",
style: TextStyle(color: Colors.white, fontSize: 20),
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis),
),
SizedBox(width: 30),
],
),
),
),
),
body: Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(ScreenUtil().setHeight(99)), // 设置appBar高度
child: AppBar(
automaticallyImplyLeading: false,
centerTitle: true,
//leading: Text(''),
titleSpacing: 0.0,
//设置title的左边距
title: Padding(
padding: EdgeInsets.only(left: 0, right: 0),
),
//bottom必须要套PreferredSize,否则会报错:The argument type 'Container' can't be assigned to the parameter type 'PreferredSizeWidget'.
bottom: PreferredSize(
preferredSize: Size.fromHeight(30.0), // 设置TabBar高度
child: Container(
//color: Colors.blueAccent,
alignment: Alignment.centerLeft, //左对齐,有效
height: 30, // 设置TabBar高度
child: listGetZpjl.isNotEmpty
? TabBar(
//labelColor: Colors.blueAccent,
controller: _tabController,
//注意:用TabController实现顶部tab切换,必须添加该行
isScrollable: true,
//如果多个按钮的话可以自动左右移动
tabs: (topTabs_map['listView_List'].isNotEmpty)
? topTabs_map['tabs_list']
: [],
)
: PreferredSize(
preferredSize: Size.fromHeight(48.0),
child: Theme(
data: Theme.of(context).copyWith(accentColor: Colors.white),
child: Container(),
),
),
),
),
),
),
//: Container(),
//type 'Container' is not a subtype of type 'PreferredSizeWidget'
body: listGetZpjl.isNotEmpty
? TabBarView(
controller: _tabController, //注意:用TabController实现顶部tab切换,必须添加该行
physics: NeverScrollableScrollPhysics(), //必须放到TabBarView下面,禁止TabBarView左右滑动-OK
children:
(topTabs_map['listView_List'].isNotEmpty) ? topTabs_map['listView_List'] : [],
)
: getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0), //显示加载中的圈圈
),
),
);
}
Widget getBtnSizeX({@required text, width = 70.0, height = 35.0, onPressedFun}) {
return Container(
color: Colors.white12, //onPressedFun为null时无效
width: width,
height: height,
child: RaisedButton(
padding: EdgeInsets.all(0),
textColor: Colors.black,
child: Text(text),
onPressed: onPressedFun,
),
);
}
// App.Car_Yjxx.Workflow
// 审核数据
// 接口地址:http://49.235.208.235:9001/?s=App.Car_Yjxx.Workflow
// 接口文档
// 根据ID审核数据库中的一条纪录数据
//
// 接口参数
// 参数名字 类型 是否必须 默认值 其他 说明
// id 整型 必须 最小:1 ID
// workflow 整型 必须 2 最小:1 审核标记: 2=>初审通过 | 999=>复审通过 | 1000=>确认为非黑烟车
// shuoming 字符串 必须 最小:1 审核意见:如 黑烟超标,交由交警处罚
// uid 字符串 必须 最小:1 审核用户ID
// 返回结果
// 返回字段 类型 说明
// code 整型 更新的结果,1表示成功,0表示无更新,false表示失败
//违章信息审核
Future<bool> auditWzxxData() async {
var api = ServicePath.auditWzxxUrl;
print(api);
try {
print('开始处理网络请求...');
Response response;
Dio dio = Dio();
await copyMapUpdateWzxxData(mapGetHycsGetData);
response = await dio.post(api, data: mapUpdateWzxxData);
print('response = ${response.toString()}');
if (response.statusCode == 200) {
print('违章信息更新网络请求过程正常完成');
return true;
} else {
throw Exception('后端接口出现异常,请检测代码和服务器情况.........');
}
} catch (e) {
print('网络请求过程异常e:${e}');
Fluttertoast.showToast(
msg: 'ERROR:======>${e}',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
);
}
return false;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+538
View File
@@ -0,0 +1,538 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screen_util.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:hyzp_ybqx/components/EncryptUtil.dart';
import 'package:hyzp_ybqx/components/customDialogF.dart';
import 'package:hyzp_ybqx/components/customDialogHysh.dart';
import 'package:hyzp_ybqx/components/dioFun.dart';
import '../../../components/doJSON.dart';
import '../../../components/hyxx_data_handle.dart';
import '../../../services/EventBus.dart';
import '../../../widget/CheckboxButtonItem.dart';
class HyshGroup extends StatefulWidget {
HyshGroup(
{@required this.index,
@required this.hyshlx,
this.size = const Size(30, 30),
this.fontSize = 16,
this.selectedRadio = 0,
this.id = -1});
//I don't know what is this index for but I will put it in anyway
final int index;
Size size;
double fontSize;
String hyshlx;
int selectedRadio;
int id;
@override
_HyshGroupState createState() => _HyshGroupState();
}
class _HyshGroupState extends State<HyshGroup> {
//try_setState(); //避免如下异常报错
try_setState() {
try {
setState(() {});
} catch (e) {
print('setState(() {})异常:${e}');
}
}
int _selectedRadio = 0;
String _sfcyTextTrue = '当前时间 > 抓拍时间 + 审核间隔,只能审核,不推送交警';
String _sfcyTextFalse = '当前时间 < 抓拍时间 + 审核间隔,复审后可以推送交警';
void initState() {
_selectedRadio = widget.selectedRadio;
//黑烟审核推送交警Checkbox改变事件
eventBus.on<HycsDataAuditSfyc>().listen((event) {
print(event.str);
try_setState(); //避免如下异常报错
});
super.initState();
}
Widget getRadio(int index, Size size) {
return Container(
alignment: Alignment(-1, 1),
width: size.width,
height: size.height,
child: Radio(
value: index,
onChanged: (value) {
_selectedRadio = value;
//黑烟初审数据审核Radio选项改变广播
eventBus.fire(HycsDataAuditRadioEvent('黑烟初审数据审核Radio选项已改变', _selectedRadio));
setState(() {});
print('selectedRadio = ${_selectedRadio.toString()}');
},
groupValue: _selectedRadio,
),
);
}
//Couldn't infer type parameter 'T'. Tried to infer 'dynamic' for 'T' which doesn't work:
// Parameter 'onChanged' declared as 'void Function(T)' but argument is 'Null Function(String)'.
// The type 'dynamic' was inferred from: Parameter 'value' declared as 'T' but argument is 'String'.
// Parameter 'groupValue' declared as 'T' but argument is 'dynamic'.
// Consider passing explicit type argument(s) to the generic.
//原因是selectedRadio的类型为int,示例中_radValue为String
//无法推断类型参数“t”。试图推断“T”的“dynamic”无效:参数“onChanged”声明为“void Function(T)”,
// 但参数为“Null Function(String)”。类型“dynamic”的推断依据:参数“value”声明为“T”,
// 但参数为“String”。参数“groupValue”声明为“T”,但参数为“dynamic”。考虑将显式类型参数传递给泛型。
//5、得到黑烟审核组件
getHyshItems(int index) {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(550),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(height: ScreenUtil().setHeight(20)),
//5.1、车牌号码、车牌颜色
topTabs_map['carNumberAndCpys_List'][index],
SizedBox(height: ScreenUtil().setHeight(15)),
//5.2、审核意见
getShyj(widget.index),
//SizedBox(height: ScreenUtil().setHeight(25)),
//5.3、得到审核结果组件
getShjg(widget.index),
],
),
);
}
@override
Widget build(BuildContext context) {
return Column(
children: [
//5、得到黑烟审核组件
getHyshItems(widget.index),
SizedBox(height: ScreenUtil().setHeight(6)),
//6、得到审核确认组件
getShqr(widget.index),
],
);
}
//6、得到审核确认组件
Widget getShqr(int index) {
return Container(
//padding: EdgeInsets.only(top: ScreenUtil().setWidth(6)),
width: ScreenUtil().setWidth(1022),
height: ScreenUtil()
.setHeight(widget.hyshlx == 'hyfh' ? (1 == sfyc ? 215 : 150) : (1 == sfyc ? 215 : 150)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
children: [
SizedBox(height: ScreenUtil().setHeight(20)),
1 == sfyc
? Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(30)),
child: Text(
_sfcyTextTrue,
textAlign: TextAlign.left,
style: TextStyle(color: Colors.blue, fontSize: 13),
))
: SizedBox.shrink(),
SizedBox(height: ScreenUtil().setHeight(1 == sfyc ? 6 : 0)),
widget.hyshlx == 'hyfh'
? Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
CheckboxButtonItem(widget.index),
//_getShjgImage(widget.tabController, _selectedRadio, 35),
Container(
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setHeight(100),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(_selectedRadio == 0
? "assets/images/hyc.png"
: "assets/images/fhyc.png"),
fit: BoxFit.contain),
),
),
getBtnSizeX(
text: '复审提交',
fontColor: 0 == _selectedRadio ? Colors.red : Colors.green,
onPressedFun: 1 == sfyc
? null
: () async {
int ret = -1;
print('等待复审提交确认');
await Navigator.of(context)
.push(
PageRouteBuilder(
opaque: false,
pageBuilder: (context, animation, secondaryAnimation) =>
CustomDialogHysh(
shjg: 0 == _selectedRadio ? hyc_text : fhyc_text,
title: '复审',
content:
'是否进行复审提交${tsjj && 0 == sfyc ? '、同时推送交警' : ''}?\n${1 == sfyc ? _sfcyTextTrue : ''}'),
),
)
.then((value) async {
print('value = $value');
if (value) {
print('用户已确认,开始处理复审提交!');
//复审接口增加是否延迟字段 sfyc (是否延迟)整型 必须 是否延误,0-正常 1-延误。延误状态的不推送
// 初审不用判断,sfyc 直接提交0即可。只有复审的时候才判断时间
// A、若在规定时间内,则 int sfyc = 0,审核完毕后正常推送交警。
// B、若超出规定时间,即当前时间>抓拍时间+间隔时间,则 sfyc = 1,不推送交警。
//设置 sfyc 和 tsjj
set_sfyc_tsjj(int.parse(listGetZpjl[widget.index]['zpsj']))
.then((value) async {
hyshContentFirstAudit(
widget.id,
widget.index,
mapHyshlx[hyshlx]['audit_workflow'],
topTabs_map['auditShuoming_Controller_List'][widget.index]
.text,
topTabs_map['auditTitle'][widget.index],
sfyc: sfyc,
).then((value) {
eventBus.fire(HycsDataUpdateEvent(
'${mapHyshlx[hyshlx]['text']}数据已更新'));
//必须等待审核过程完成后,再处理同时推送交警,否则推送交警总是失败
print('tsjj = $tsjj');
if (tsjj) {
print('before tsjjFun(widget.id, _plateAndID)');
String _plateAndID =
topTabs_map['car_number_List'].toString() +
'(ID:${widget.id.toString()})';
tsjjFun(widget.id, _plateAndID);
print('after tsjjFun(widget.id, _plateAndID)');
Fluttertoast.showToast(
msg: '$_plateAndID 已推送交警,请等待返回结果。',
gravity: ToastGravity.CENTER);
}
});
});
} else {
print('用户取消了复审提交');
}
});
Navigator.pop(context, ret);
},
width: 90.0,
height: 34.0), //'复审提交'
getBtnSizeX(
text: "取消",
onPressedFun: () async {
Navigator.pop(context);
},
width: 60.0,
height: 34.0), //'取消'
],
)
: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
//_getShjgImage(widget.tabController, _selectedRadio, 35),
Container(
width: 35,
height: 35,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(_selectedRadio == 0
? "assets/images/hyc.png"
: "assets/images/fhyc.png"),
fit: BoxFit.contain),
),
),
getBtnSizeX(
text: '初审提交',
fontColor: 0 == _selectedRadio ? Colors.red : Colors.green,
onPressedFun: 1 == sfyc
? null
: () async {
int ret = -1;
print('等待初审提交确认');
await Navigator.of(context)
.push(
PageRouteBuilder(
opaque: false,
pageBuilder: (context, animation, secondaryAnimation) =>
CustomDialogHysh(
shjg: 0 == _selectedRadio ? hyc_text : fhyc_text,
title: '初审',
content: '是否进行初审提交?'),
),
)
.then((value) async {
print('value = $value');
if (value) {
print('用户已确认,开始处理初审提交!');
//return;
hyshContentFirstAudit(
widget.id,
widget.index,
mapHyshlx[hyshlx]['audit_workflow'],
topTabs_map['auditShuoming_Controller_List'][widget.index]
.text,
topTabs_map['auditTitle'][widget.index],
sfyc: 0,
).then((value) {
eventBus.fire(
HycsDataUpdateEvent('${mapHyshlx[hyshlx]['text']}数据已更新'));
});
} else {
print('用户取消了初审提交');
}
});
Navigator.pop(context, ret);
},
width: 90.0), //'初审提交'
getBtnSizeX(
text: "取消",
onPressedFun: () async {
Navigator.pop(context);
},
width: 60.0), //'取消'
],
),
],
),
);
}
//5.3、得到审核结果组件
Widget getShjg(int index) {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(175),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
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: <Widget>[
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(
// constraints: BoxConstraints(
// minWidth: double.infinity, //宽度尽可能大
// //minHeight: _listTileHeight, //最小高度
// maxHeight: my_listTileHeight, //最大高度
// ),
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(120),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.baseline,
children: <Widget>[
SizedBox(width: my_marginLeft),
Text((widget.hyshlx == 'hyfh' ? '复审' : '初审') + '意见: ',
style: TextStyle(
fontSize: my_fontSize, color: 0 == _selectedRadio ? Colors.red : Colors.green)),
Container(
alignment: Alignment(-1, 0),
height: 120,
//widthTrail = 400报错,360刚能显示,300换行,266
width: ScreenUtil().setWidth(775),
child: TextField(
//textAlign: TextAlign.right,
//style: TextStyle(fontSize: _fontSize, color: cpysList[getIndexOfCpysList(colorText: topTabs_map['cpysText_List'][i])].cpysFont),
//style: TextStyle(fontSize: _fontSize, color: cpysList[getIndexOfCpysList(colorText: myCpys)].cpysFont),
style: TextStyle(fontSize: my_fontSize),
textAlign: TextAlign.left,
decoration: InputDecoration(
hintText: '請輸入审核意见',
//border: InputBorder.none, //TextField去掉下划线
//contentPadding: EdgeInsets.only(right: 0),
//contentPadding: EdgeInsets.symmetric(vertical: my_textFieldHeight),
contentPadding: EdgeInsets.only(left: 4, right: 4), //这行代码是关键,设置这个之后,居中
//contentPadding: EdgeInsets.zero, //这行代码是关键,设置这个之后,居中
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey[600]),
//borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(3),
),
),
controller: topTabs_map['auditShuoming_Controller_List'][index],
maxLines: 1,
minLines: 1,
//maxLengthEnforced: false,
//maxLength: 10,
enabled: true,
//利用控制器初始化文本
onChanged: (value) {
topTabs_map['auditShuoming_Controller_List'][index].text = value;
},
),
),
],
),
);
}
Widget getBtnSizeX(
{@required text, width = 70.0, height = 35.0, onPressedFun, fontColor = Colors.black}) {
return Container(
color: Colors.white12, //onPressedFun为null时无效
width: width,
height: height,
child: RaisedButton(
padding: EdgeInsets.all(0),
textColor: Colors.black,
child: Text(text, style: TextStyle(color: fontColor)),
onPressed: onPressedFun,
),
);
}
}
class CustomRadioWidget<T> extends StatelessWidget {
final T value;
final String title;
final double fontSize;
final T groupValue;
final ValueChanged<T> onChanged;
final double width;
final double height;
CustomRadioWidget(
{this.value,
this.title = '',
this.fontSize = 16,
this.groupValue,
this.onChanged,
this.width = 25,
this.height = 25});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(0),
child: GestureDetector(
onTap: () {
onChanged(this.value);
},
child: Container(
//alignment: Alignment(0, 0),
height: this.height,
width: this.width,
child: value == groupValue
? Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(top: 2),
child: Icon(Icons.radio_button_checked_rounded,
color: onChanged == null ? Colors.grey : Colors.blue),
),
SizedBox(width: title.isEmpty ? 0 : 2),
Text(
title,
style: TextStyle(
fontSize: fontSize,
color: onChanged == null ? Colors.grey : Colors.blue,
fontWeight: FontWeight.bold,
),
),
],
)
: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(top: 2),
child: Icon(Icons.radio_button_unchecked_rounded,
color: onChanged == null ? Colors.grey : Colors.black),
),
SizedBox(width: title.isEmpty ? 0 : 2),
Text(title,
style: TextStyle(
fontSize: fontSize,
color: onChanged == null ? Colors.grey : Colors.black)),
],
),
),
),
);
}
}
+926
View File
@@ -0,0 +1,926 @@
//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';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:hyzp_ybqx/components/customDialogF.dart';
import 'package:hyzp_ybqx/services/EventBus.dart';
import 'package:hyzp_ybqx/widget/my_superplayer.dart';
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';
import '../../../components/hyxx_data_handle.dart';
class TsjjContentNew extends StatefulWidget {
TsjjContentNew({
@required this.hyshlx,
@required this.title,
this.indexRecord,
this.id,
Key key,
}) : super(key: key);
String title;
int indexRecord = 0;
int id = -1;
String hyshlx;
_LoginPageState createState() => _LoginPageState();
}
//用TabController实现顶部tab切换
class _LoginPageState extends State<TsjjContentNew> with SingleTickerProviderStateMixin {
//try_setState(); //避免如下异常报错
try_setState() {
try {
setState(() {});
} catch (e) {
print('setState(() {})异常:${e}');
}
}
dispose() {
super.dispose();
}
BuildContext _context;
String _title = '';
//flutter_screenUtil 4.x 用法,ScreenUtil.screenWidth (sdk>=2.6 : 1.sw) //设备宽度
double _screenWidth = 1.sw;
double _marginLeft = 8;
double _marginCenter = 70;
double _fontSize = 16;
double _widthLeft = 40; // = _screenWidth / 3;
double _iconSize = 18;
double _stampSize = 100;
double _listTileHeight = 30;
double _marginVer = 10;
Color _iconColor = Colors.blue;
Map _mapTsjjGetTsStatus = {};
void initState() {
//黑烟审核推送交警Checkbox改变事件
eventBus.on<HycsDataAuditSfyc>().listen((event) {
print(event.str);
try_setState(); //避免如下异常报错
});
_widthLeft = _screenWidth / 2;
getListFlields();
_context = context;
super.initState();
}
Map _mapGetTsjjGetData = {
"id": 1203,
"plate_id": "川QS9661",
"plate_color": "蓝色",
"zpsj": 1612770967,
"yjxx_id": "1379",
"workflow": 2,
"video_url": "video/9_6063_20210208_155607_川QS9661.mp4",
"pic_url": "/wwwroot/admin/Api/wwwroot/public/uploads/926f5168f1fe109a9b8ec88dcac7ac2c.jpg",
"clfl": "皮卡车",
"dwip": "172.16.3.9",
"dwms": "宜长路出城方向",
"lgmzs": 3,
"jczxd": "863",
"sfhy": "黑烟车",
};
double _radioImage = 9 / 16;
Widget imageWztp;
getListFlields() async {
_mapGetTsjjGetData = await getWzxxItemData(widget.id); //获取指定id的违章信息返回 _mapGetTsjjGetData
print('_mapGetTsjjGetData = ${_mapGetTsjjGetData}');
await getShenheData(widget.id); //获取指定id的审核信息存入 listGetShenheData
await getMapGetShenheData(); //从listGetShenheData中取出数据分别存入mapGetHycsShenheData、mapGetHyfhShenheData
//Tab切换时,设置 sfyc 和 tsjj,只处理当前选中的抓拍记录 _tabController.index,zpsj抓拍时间
set_sfyc_tsjj(_mapGetTsjjGetData['zpsj']);
// 获取推送交警状态信息
// tsjjGetTsStatus返回字段 类型 说明
// id 整型 违章记录ID
// checkid 整型 推送的抓拍记录ID
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 3-推送成功
// 20210529更新:
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 2-推送成功 | 3-规定时间内已有违章记录,本次不推送 | 4-现场登记,不推送
// ts_time 字符串 推送时间
//Future tsjjGetTsStatus(int _wzxxID)
_mapTsjjGetTsStatus = await tsjjGetTsStatus(widget.id);
print('_mapTsjjGetTsStatus = $_mapTsjjGetTsStatus');
// 获取网络图片尺寸
flustars.WidgetUtil.getImageWH(url: getMediaUrl(_mapGetTsjjGetData['pic_url'])).then((rect) {
if (null != rect) {
_radioImage = rect.height / rect.width;
}
});
imageWztp = getWztp(); //得到违章图片
//下面读取的是全局数据,该模块不需要修改
// 川Q565H4
try {
//_title = '违章黑烟车详情(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length})id:${listHycsGetList2[widget.indexRecord]['id']}';
//_title = '违章黑烟车(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length}):${listHycsGetList2[widget.indexRecord]["plate_id"]}(${listHycsGetList2[widget.indexRecord]["plate_color"]})';
_title = '推送交警详情(${(widget.indexRecord + 1).toString()} / ${listHycsGetList2.length})';
setState(() {});
} catch (e) {}
}
// 使用 cached_network_image 插件实现网络图片缓存
// 使用 flutter_drag_scale 实现可缩放可拖拽双击放大的图片功能。PhotoView插件不好用,有问题
Widget getNetworkImage(String url) {
return CachedNetworkImage(
imageUrl: url,
alignment: Alignment.topCenter,
imageBuilder: (context, imageProvider) => DragScaleContainer(
doubleTapStillScale: true, child: Image(image: imageProvider)
// child: Image(
// image: NetworkImage(
// 'http://h.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=0d023672312ac65c67506e77cec29e27/9f2f070828381f30dea167bbad014c086e06f06c.jpg'),
// ),
),
// imageBuilder: (context, imageProvider) => PhotoView(
// imageProvider: imageProvider,
// ),
//placeholder: (context, url) => CircularProgressIndicator(),
placeholder: (context, url) =>
getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0),
errorWidget: (context, url, error) => Icon(Icons.error),
);
}
// 167 50 3.34
Widget getLgmzs(int lgmzs, {double width = 127, double height = 127}) {
int _rgb = (255 * (5 - lgmzs)) ~/ 5;
return Stack(
children: [
Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 4),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('$lgmzs级${lgmzs * 20}%', style: TextStyle(fontSize: 10)),
//SizedBox(height: 0),
Container(
width: ScreenUtil().setWidth(66),
height: ScreenUtil().setHeight(66),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
color: Color.fromRGBO(_rgb, _rgb, _rgb, 1.0),
borderRadius: new BorderRadius.circular(0),
),
)
],
),
),
Positioned(
top: ScreenUtil().setHeight(4),
child: Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height - 8),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(6), left: ScreenUtil().setWidth(6), top: 0, bottom: 0),
decoration: BoxDecoration(
border: Border.all(
color: (lgmzs == _mapGetTsjjGetData['lgmzs'])
? Colors.red
: Color.fromRGBO(244, 244, 244, 1),
width: 2),
//color: Colors.lightBlue,
borderRadius: new BorderRadius.circular(3.0),
),
),
)
],
);
}
//1、得到格林曼黑度标准和视频播放按钮组件
Widget getHdAndPlay() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
getLgmzs(0),
getLgmzs(1),
getLgmzs(2),
getLgmzs(3),
getLgmzs(4),
getLgmzs(5, width: 153),
getIconBtnSizeX(
height: 104,
//getIconBtnSizeX 中已经使用ScreenUtil().setHeight(126),此处不能传 ScreenUtil().setHeight(126) ,否则严重错位
width: 168,
text: "视频",
textSize: 12,
circular: 4,
color: Color.fromRGBO(52, 157, 237, 1),
onTop: () async {
if (Playing) {
//禁止同时启动两次播放器
return;
}
Playing = true; //禁止同时启动两次播放器
urlnew = getMediaUrl(_mapGetTsjjGetData['video_url']);
//获取视频地址失败
if (!isVideoUrl(urlnew)) {
return;
}
Navigator.of(_context).push(MaterialPageRoute(
builder: (context) => SuperPlayerPage(
loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
url: urlnew,
title:
'违章视频: ${_mapGetTsjjGetData["plate_id"]}\n${_mapGetTsjjGetData['dwms']}')));
// Navigator.of(_context).push(MaterialPageRoute(
// builder: (context) => PlayerProNew(
// loop: 0, //设置播放循环,默认播放器的循环次数是1, 即不循环播放。如果设置循环次数0,表示无限循环。
// url: urlnew,
// title:
// '违章视频: ${_mapGetTsjjGetData["plate_id"]}\n${_mapGetTsjjGetData['dwms']}')));
},
),
SizedBox(width: ScreenUtil().setWidth(15)),
],
);
}
//2、得到违章图片组件
Widget getWztp() {
//ratioList[index] = 0.5714285714285714
return Stack(
children: [
Container(
width: ScreenUtil().setWidth(1022),
//height: ScreenUtil().setHeight(639),
//height: ScreenUtil().setHeight(22 + 1022 * _radioImage),
height: ScreenUtil().setHeight(30 + 1022 * _radioImage),
decoration: BoxDecoration(
//color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
),
Positioned(
//left: ScreenUtil().setWidth(25),
top: ScreenUtil().setHeight(25),
child: Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(30 + 1022 * _radioImage),
child: getNetworkImage(getMediaUrl(_mapGetTsjjGetData['pic_url'])),
),
)
],
);
}
// void printScreenInformation() {
// print('Device width dp:${1.sw}dp');
// print('Device height dp:${1.sh}dp');
// print('Device pixel density:${ScreenUtil().pixelRatio}');
// print('Bottom safe zone distance dp:${ScreenUtil().bottomBarHeight}dp');
// print('Status bar height dp:${ScreenUtil().statusBarHeight}dp');
// print('The ratio of actual width to UI design:${ScreenUtil().scaleWidth}');
// print(
// 'The ratio of actual height to UI design:${ScreenUtil().scaleHeight}');
// print('System font scaling:${ScreenUtil().textScaleFactor}');
// print('0.5 times the screen width:${0.5.sw}dp');
// print('0.5 times the screen height:${0.5.sh}dp');
// }
void printScreenInformation() {
print('ScreenUtil().screenWidth = ${ScreenUtil().screenWidth}');
print('设备宽度:${1.sw}dp');
print('"1.w" = ${1.w}');
print('"1.sw" = ${1.sw}');
print('设备高度:${1.sh}dp');
print('设备的像素密度:${ScreenUtil().pixelRatio}');
print('底部安全区距离:${ScreenUtil().bottomBarHeight}dp');
print('状态栏高度:${ScreenUtil().statusBarHeight}dp');
print('实际宽度的dp与设计稿px的比例:${ScreenUtil().scaleWidth}');
print('实际高度的dp与设计稿px的比例:${ScreenUtil().scaleHeight}');
print('宽度和字体相对于设计稿放大的比例:${ScreenUtil().scaleWidth * ScreenUtil().pixelRatio}');
print('高度相对于设计稿放大的比例:${ScreenUtil().scaleHeight * ScreenUtil().pixelRatio}');
print('系统的字体缩放比例:${ScreenUtil().textScaleFactor}');
print('屏幕宽度的0.5:${0.5.sw}dp');
print('屏幕高度的0.5:${0.5.sh}dp');
}
//3、得到违章图片说明信息组件
Widget getWztpSmxx() {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(270),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
getWzxxPart1(),
getWzxxPart2(),
getWzxxPart3(),
],
),
);
}
// I/flutter (22989): ScreenUtil().screenWidth = 360.0
// I/flutter (22989): 设备宽度:360.0dp
// I/flutter (22989): "1.w" = 0.3333333333333333
// I/flutter (22989): "1.sw" = 360.0
// I/flutter (22989): 设备高度:640.0dp
// I/flutter (22989): 设备的像素密度:3.0
// I/flutter (22989): 底部安全区距离:0.0dp
// I/flutter (22989): 状态栏高度:24.0dp
// I/flutter (22989): 实际宽度的dp与设计稿px的比例:0.3333333333333333
// I/flutter (22989): 实际高度的dp与设计稿px的比例:0.3333333333333333
// I/flutter (22989): 宽度和字体相对于设计稿放大的比例:1.0
// I/flutter (22989): 高度相对于设计稿放大的比例:1.0
// I/flutter (22989): 系统的字体缩放比例:1.0
// I/flutter (22989): 屏幕宽度的0.5:180.0dp
// I/flutter (22989): 屏幕高度的0.5:320.0dp
//3、得到违章信息组件1:车牌号码、车牌颜色
//车牌颜色Map cpysMap = {
// '蓝色': cpysItem(
// cpysText: '蓝色',
// cpysBackground: Colors.blue,
// cpysFont: Colors.white,
// cpysBorder: Colors.orange),
// }
Widget getWzxxPart1() {
//printScreenInformation();
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
getTitleText('车牌号码:'),
getBoderText(_mapGetTsjjGetData['plate_id'].toString(),
width: ScreenUtil().setWidth(1022 / 3.2)),
SizedBox(width: ScreenUtil().setWidth(_marginCenter)),
getTitleText('颜色:'),
getBoderText(_mapGetTsjjGetData['plate_color'], width: ScreenUtil().setWidth(1022 / 4.8)),
],
);
}
Widget getTitleText(String text, {double fontSize = 16, int lines = 1, Color color}) {
return Text(text,
style: TextStyle(fontSize: fontSize, color: color),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis,
maxLines: lines);
}
Widget getTrailText(String text, {double fontSize = 16, double off = 0}) {
return Container(
width: ScreenUtil().setWidth(1022) - _widthLeft - off - (2 * _marginLeft),
child: Text(text,
style: TextStyle(fontSize: fontSize),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis),
);
}
Widget getBoderText(String text, {double width = 40}) {
cpysItem _cpysItem = cpysMap[_mapGetTsjjGetData['plate_color']];
return Container(
//color: _cpysItem.cpysBackground,
alignment: Alignment(0, -1),
width: width,
decoration: BoxDecoration(
border: Border.all(color: _cpysItem.cpysBorder, width: 2),
color: _cpysItem.cpysBackground,
borderRadius: BorderRadius.circular(3),
),
child: Padding(
padding: EdgeInsets.only(bottom: 3),
child: Text(text,
style: TextStyle(fontSize: _fontSize, color: _cpysItem.cpysFont),
textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis),
),
);
}
//I/flutter (17555): _mapGetTsjjGetData = {
// id: 1222, plate_id: 川Q736X2, plate_color: 蓝色, zpsj: 1612857077, yjxx_id: 1399, workflow: 999,
// video_url: video/9_6063_20210209_155117_川Q736X2.mp4,
// pic_url: /wwwroot/admin/Api/wwwroot/public/uploads/9d2f45fd24b41f2b94abe42b30970d75.jpg,
// clfl: 集装箱卡车, dwip: 172.16.3.9, dwms: 宜长路出城方向, lgmzs: 3, jczxd: 994, sfhy: 黑烟车
// }
Widget getIcon(IconData _iconData) {
return Container(
width: _iconSize - 2,
height: _iconSize,
child: Padding(
padding: EdgeInsets.only(top: 2),
child: Icon(_iconData, size: _iconSize, color: _iconColor),
),
);
}
//4、得到违章信息组件2:抓拍时间组件
Widget getWzxxPart2() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) - _marginLeft,
child: getTitleText(
'抓拍时间:' +
getDate(
(_mapGetTsjjGetData['zpsj'] is int)
? _mapGetTsjjGetData['zpsj']
: int.parse(_mapGetTsjjGetData['zpsj']),
),
),
),
],
);
}
Widget getWzxxPart3() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) - _marginLeft,
child: getTitleText('抓拍地点:' + _mapGetTsjjGetData['dwms']),
),
],
);
}
//4、得到审核信息组件
Widget getShxx() {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(380),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
getWzxxPart4(),
getWzxxPart5(),
getWzxxPart6(),
],
),
);
}
//6、得到审核信息组件4:违章类型、格林曼黑度组件
Widget getWzxxPart4() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: _widthLeft,
child: getTitleText('违章类型:' + _mapGetTsjjGetData['sfhy']),
),
SizedBox(width: _marginLeft),
//getIcon(Icons.location_on_outlined),
Container(
width: _iconSize,
height: _iconSize,
decoration: BoxDecoration(
//color: Colors.white,
image: DecorationImage(image: AssetImage("assets/images/hyc.png"), fit: BoxFit.contain),
),
alignment: Alignment.center,
//child:
),
getTrailText(':' + _mapGetTsjjGetData['lgmzs'].toString(), off: _iconSize),
],
);
}
//从listGetShenheData中取出数据分别存入mapGetHycsShenheData、mapGetHyfhShenheData
//7、得到审核信息组件5:初审人员,初审时间
Widget getWzxxPart5() {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: 300,
child: getTitleText('初审人员:' + mapGetHycsShenheData['uname']),
),
// SizedBox(width: _marginLeft),
// getIcon(Icons.query_builder),
// getTrailText(':' + mapGetHycsShenheData['addtime'], off: _iconSize),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: 300,
child: getTitleText('初审时间:' + mapGetHycsShenheData['addtime']),
),
],
)
],
);
}
//8、得到审核信息组件6:复审人员,复审时间
Widget getWzxxPart6() {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: 300,
child: getTitleText('复审人员:' + mapGetHyfhShenheData['uname']),
),
// SizedBox(width: _marginLeft),
// getIcon(Icons.query_builder),
// getTrailText(':' + mapGetHycsShenheData['addtime'], off: _iconSize),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: 300,
child: getTitleText('复审时间:' + mapGetHyfhShenheData['addtime']),
),
],
)
],
);
}
//5、得到推送交警状态组件
Widget getTsjjStatus() {
return Container(
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(1 == _mapTsjjGetTsStatus['tszt'] ||
2 == _mapTsjjGetTsStatus['tszt'] ||
2 != _mapTsjjGetTsStatus['tszt'] && 1 == sfyc
? 170
: 90),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
getWzxxPart7(),
],
),
);
}
//7、得到推送交警状态信息组件7:推送状态
// 20210529更新:
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 2-推送成功 | 3-规定时间内已有违章记录,本次不推送 | 4-现场登记,不推送
//_mapTsjjGetTsStatus['tszt']
Widget getWzxxPart7() {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
SizedBox(width: _marginLeft),
Container(
alignment: Alignment(-1, 0),
width: ScreenUtil().setWidth(1022) - _marginLeft,
child: Container(
child: getTitleText(
'推送状态:' +
mapTsztText[_mapTsjjGetTsStatus['tszt']] +
(1 == _mapTsjjGetTsStatus['tszt'] || 2 == _mapTsjjGetTsStatus['tszt']
? '\n推送时间:${getDate((_mapTsjjGetTsStatus['ts_time'] is int) ? _mapTsjjGetTsStatus['ts_time'] : int.parse(_mapTsjjGetTsStatus['ts_time']))}'
: '') +
(0 == _mapTsjjGetTsStatus['tszt'] && 1 == sfyc
? ',但已超时。当前时间 > 抓拍时间 + 审核间隔,不能推送交警!'
: ''),
lines: 2,
color: Colors.blue),
),
),
],
);
}
//10、得到推送交警确认组件
Widget getTsjjQr() {
Widget qxButton = getBtnSizeX(
text: "取消",
onPressedFun: showMoreWidget
? null
: () async {
Navigator.pop(context);
},
width: 90.0);
// App.Car_Hyc.GetTs接口返回值说明中没有tszt为2,但许多记录返回值都是2,返回值为2是否是推送成功?
// App.Car_Hyc.GetTs接口返回值说明有误,返回值为2表示推送成功、而不是3
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 3-推送成功
// 20210529更新:
// tszt 整型 推送状态:0-未推送 | 1-推送失败 | 2-推送成功 | 3-规定时间内已有违章记录,本次不推送 | 4-现场登记,不推送
//_mapTsjjGetTsStatus['tszt']
return Container(
//padding: EdgeInsets.only(top: ScreenUtil().setWidth(6)),
width: ScreenUtil().setWidth(1022),
height: ScreenUtil().setHeight(155),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(12),
),
),
child: 2 == _mapTsjjGetTsStatus['tszt']
? Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text('已推送', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
SizedBox(width: 2),
Padding(
padding: EdgeInsets.only(top: 3),
child: Icon(
Icons.check,
size: 18,
),
),
],
),
qxButton, //'取消'
],
)
: 1 == sfyc
? Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
getBtnSizeX(text: '已超时', onPressedFun: null, width: 90.0), //'复审提交'
qxButton, //'取消'
],
)
: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
getBtnSizeX(
text: '推送',
onPressedFun: showMoreWidget
? null
: () async {
print('等待推送交警确认');
await Navigator.of(context)
.push(
PageRouteBuilder(
opaque: false,
pageBuilder: (context, animation, secondaryAnimation) =>
CustomDialogF(title: '推送确认', content: '是否推送交警?'),
),
)
.then((value) async {
print('value = $value');
if (value) {
print('用户已确认,开始处理推送交警!');
//return;
print('before tsjjFun(widget.id)');
showMoreWidget = true;
try_setState();
String _plateAndID = _mapGetTsjjGetData['plate_id'].toString() +
'(ID:${widget.id.toString()})';
tsjjFun(widget.id, _plateAndID);
showMoreWidget = false;
try_setState();
Fluttertoast.showToast(
msg: '$_plateAndID 已推送交警,请等待返回结果。',
gravity: ToastGravity.CENTER);
} else {
print('用户取消了推送交警操作');
}
});
//Unhandled Exception: type 'String' is not a subtype of type 'int' of 'result'
Navigator.pop(context, -1);
},
width: 90.0), //'复审提交'
qxButton, //'取消'
],
),
);
}
bool showMoreWidget = false;
@override
Widget build(BuildContext context) {
return Scaffold(
//resizeToAvoidBottomPadding: false,
appBar: PreferredSize(
preferredSize: Size.fromHeight(ScreenUtil().setHeight(173)), // 设置appBar高度
child: AppBar(
automaticallyImplyLeading: false,
centerTitle: true,
titleSpacing: 0.0,
flexibleSpace: Container(
//SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
// SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
child: Container(
//height: ScreenUtil().setHeight(173),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color.fromRGBO(12, 186, 156, 1),
Color.fromRGBO(39, 127, 235, 1),
],
),
),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [
// Color(0xFF0018EB),
// Color(0xFF01C1D9),
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
// ),
),
),
//设置title的左边距
title: Padding(
padding: EdgeInsets.only(left: 0, right: 0),
child: Row(
//mainAxisAlignment: MainAxisAlignment.start,
children: [
//1.1、返回按钮
getIconAndTextButton(
iconColor: Colors.white,
iconData: Icons.chevron_left_outlined,
onPress: () {
Navigator.pop(context);
},
),
Expanded(
child: Text(_title,
style: TextStyle(color: Colors.white, fontSize: 20),
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis),
),
SizedBox(width: 30),
],
),
),
),
),
body: null == imageWztp
// 显示加载中的圈圈
? getMoreWidget(color: Colors.black38, size: 20.0, strokeWidth: 2.0)
: Stack(
children: [
//SizedBox.shrink() 创建父类允许最小尺寸的约束Box
showMoreWidget
? Align(
alignment: Alignment(0, 0.8),
child: Container(
height: 200,
width: 200,
child: getMoreWidget2(
text: '加载中...',
color: Colors.red,
size: 40.0,
strokeWidth: 3.0), //显示加载中的圈圈,
),
)
: SizedBox.shrink(),
KeyboardAvoider(
autoScroll: true,
child: Container(
color: Color.fromRGBO(244, 244, 244, 1),
child: Column(
children: <Widget>[
//1、得到格林曼黑度标准和视频播放按钮组件
getHdAndPlay(),
//2、得到违章图片组件
//getWztp(),
imageWztp,
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//3、得到违章图片说明信息组件
getWztpSmxx(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//4、得到审核信息组件
getShxx(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//5、得到推送交警状态组件
getTsjjStatus(),
SizedBox(height: ScreenUtil().setHeight(_marginVer)),
//9、得到推送交警确认组件
getTsjjQr(),
SizedBox(height: 10),
],
),
),
),
Positioned(
//alignment: Alignment(0.9, 0.35),
//alignment: Alignment(0.8, 0.48),
left: ScreenUtil().setWidth(80),
top: ScreenUtil().setHeight(1015),
child: Container(
//alignment: Alignment(0.5, -0.5),
width: _stampSize,
height: _stampSize,
//color: Colors.black12,
decoration: BoxDecoration(
//color: Colors.white,
image: DecorationImage(
image: AssetImage("assets/images/jkzx_stamp.png"), fit: BoxFit.contain),
),
//child:
),
),
Positioned(
//alignment: Alignment(0.9, 0.35),
//alignment: Alignment(0.8, 0.48),
right: ScreenUtil().setWidth(80),
top: ScreenUtil().setHeight(1015),
child: Container(
//alignment: Alignment(0.5, -0.5),
width: _stampSize,
height: _stampSize,
//color: Colors.black12,
decoration: BoxDecoration(
//color: Colors.white,
image: DecorationImage(
image: AssetImage("assets/images/hyc.png"), fit: BoxFit.contain),
),
//child:
),
),
],
),
);
}
Widget getBtnSizeX({@required text, width = 70.0, height = 35.0, onPressedFun}) {
return Container(
color: Colors.white12, //onPressedFun为null时无效
width: width,
height: height,
child: RaisedButton(
padding: EdgeInsets.all(0),
textColor: Colors.black,
child: Text(text),
onPressed: onPressedFun,
),
);
}
}