import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:hyzp_ybqx/components/commonFun.dart'; // import 'package:hyzp_ybqx/pages/Works/DWSP/dw_list_sound.dart'; // import 'package:hyzp_ybqx/pages/Works/DWSP/dw_sound.dart'; import 'package:hyzp_ybqx/pages/Works/DWSP/dwsp_getList.dart'; import 'package:hyzp_ybqx/pages/Works/HYSH/hysh_getList_fliter.dart'; import 'package:hyzp_ybqx/pages/Works/HYSH/hysh_getList_new.dart'; import 'package:hyzp_ybqx/pages/Works/LED_XSXX/led_xsxx_content.dart'; import 'package:hyzp_ybqx/pages/Works/SBBJ/sbbj_getList.dart'; import 'package:hyzp_ybqx/pages/Works/SBGL/dwxx_getList.dart'; import 'package:hyzp_ybqx/pages/Works/TJXX/tj_data.dart'; import 'package:hyzp_ybqx/pages/Works/TJXX/today_list.dart'; import 'package:hyzp_ybqx/pages/Works/TJXX/zptj_bar_chart.dart'; import 'package:hyzp_ybqx/pages/Works/TJXX/zptj_bar_chart_one.dart'; import 'package:hyzp_ybqx/pages/Works/TJXX/zptj_page.dart'; import 'package:hyzp_ybqx/services/EventBus.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../components/hyxx_data_handle.dart'; import '../Works/DWDT/basic_map.dart'; ///flutter中如何获取子类Widget并调用它的方法 萤火虫离别的礼物 2019.08.07 15:46:08 https://www.jianshu.com/p/b16f70dd692c //在flutter中开发中,会发现当子类Widget是StatefulWidget类型的时候,想要获取它的State并调用State中的方法,感觉无从下手。 // 不像是在iOS中,可以直接调用一个类的公开的方法,flutter可以通过key来实现。每个Widget都是唯一标识的。此唯一标识对应于可选的Key参数。 // 如果省略,Flutter将为您生成一个。key主要分为四种:GlobalKey,LocalKey,UniqueKey或ObjectKey,GlobalKey确保key是在整个应用程序唯一的, // 这次我们就要使用它来实现。我们需要给子Widget定义一个唯一的GlobalKey,然后根据这个key获取到这个Widget,进行相关的操作,下面是相关的代码: //这里就是关键的代码,定义一个key //GlobalKey _myFijkPanelWidgetBuilderStateKey = new GlobalKey(); class Page1_Works extends StatefulWidget { Page1_Works({@required this.pageType, this.title, Key key}) : super(key: key); //该美工优化的页面 Page1_Works,是供多个页面共享的代码框架。不同的页面以 PageType 字段进行区分 String pageType = ''; //'home_page'、'statis_page'、'device_page' String title = ''; @override _Page1_WorksState createState() => _Page1_WorksState(); } //class _Page1WorkState extends State with WidgetsBindingObserver, AutomaticKeepAliveClientMixin { class _Page1_WorksState extends State with WidgetsBindingObserver, AutomaticKeepAliveClientMixin { //Begin:底部导航栏,使用PageView方式,配置每页面的保持状态。必须添加继承:with AutomaticKeepAliveClientMixin //try_setState(); //避免异常报错 try_setState() { try { setState(() {}); } catch (e) { print('setState(() {})异常:${e}'); } } @override // TODO: implement wantKeepAlive bool get wantKeepAlive => true; //End:底部导航栏,使用PageView方式,配置每页面的保持状态 // final FijkPlayer player = FijkPlayer(); // bool bFirstPlay; @override void initState() { // getDataListFun().then((list) { // _listBtnItems = list; // try_setState(); // }); //startGetStatisData(); //已经在 _MyAppState 中提前开始获取统计数据 updateStatisData(); //监听统计数据改变事件 eventBus.on().listen((event) { print(event.str); print('listZptjStatisAlone.length:${listZptjStatisAlone.length},dwSum:${dwSum}'); // I/flutter (18666): listZptjStatisAlone.length:1,dwSum:5 updateStatisData(); }); //监听 选择LED点位 更新事件 eventBus.on().listen((event) async { print(event.str); try_setState(); }); super.initState(); } // 更新工作页面的今日统计数据 Future updateStatisData() async { if (cllRStatisDataOk) { cllRStatisDataGeting = false; } if (-1 == mapStatisInfo['今日抓拍']) { getAllSumNew().then((_) { try_setState(); }); } else { try_setState(); } // if (listZptjStatisAlone.length >= dwSum && -1 == mapStatisInfo['今日抓拍']) { // getAllSum('today', listZptjStatisAlone).then((value) { // //mapStatisInfo['今日抓拍'] = value[1]; // listTodayZpjl = value[2]; // //try_setState(); // }); // } // // if (listTodayShtj.length >= dwSum && -1 == mapStatisInfo['今日初审']) { // getAllSum('csnum', listTodayShtj).then((value) { // //mapStatisInfo['今日初审'] = value[1]; // listTodayChjl = value[2]; // //try_setState(); // }); // getAllSum('fsnum', listTodayShtj).then((value) { // //mapStatisInfo['今日复审'] = value[1]; // listTodayFhjl = value[2]; // //try_setState(); // }); // getAllSum('sends', listTodayShtj).then((value) { // //mapStatisInfo['今日推送'] = value[1]; // listTodayTsjl = value[2]; // //try_setState(); // }); // } //车流量统计数据用 getAllSumCll() 单独处理 // if (listClltjStatisAlone.length >= dwSum && -1 == mapStatisInfo['今日车流']) { // getAllSumCll('today', listClltjStatisAlone).then((value) { // mapStatisInfo['今日车流'] = value[1] ~/ 10000; // try_setState(); // }); // } } Future sysPop() async { await SystemChannels.platform.invokeMethod('SystemNavigator.pop'); } _Page1_WorksState(); @override void dispose() { super.dispose(); } // double getHeight() { // double _height = 0; // for (double h in listHeight) { // _height += h; // } // print("_height1 = $_height"); // 767 // _height += ScreenUtil().statusBarHeight * ScreenUtil().pixelRatio; // 系统顶部状态栏高度 // _height += ScreenUtil().bottomBarHeight * ScreenUtil().pixelRatio; // 系统底部工具栏高度 // //R:\FlutterProject\FlutterProject33\hyzp_ybqx\lib\pages\tabs\Tabs.dart中,iconSize: ScreenUtil().setSp(70), // _height += (kBottomNavigationBarHeight * 3 + 8); // 底部导航栏的高度,this.elevation = 8.0,高度 默认8.0 // //_height += (68 * 3); // 底部导航栏的高度 // print("_height2 = $_height"); // 1015 // // _height = ScreenUtil().screenHeight * ScreenUtil().pixelRatio - _height; // // print("ScreenUtil().screenHeight = ${ScreenUtil().screenHeight}"); //640.0 // // print("ScreenUtil().pixelRatio = ${ScreenUtil().pixelRatio}"); // 3.0 // print("_height3 = $_height"); // S7:905 / 3 = 301 OK; // // S7 OK: // // I/flutter (22790): _height1 = 767.0 // // I/flutter (22790): _height2 = 1015.0 // // I/flutter (22790): _height3 = 905.0 // // // S10 OK: // // I/flutter (23478): _height1 = 767.0 // // I/flutter (23478): _height2 = 1055.0 // // I/flutter (23478): _height3 = 1081.0 // // // ARS AL00 OK: // // I/flutter ( 9979): _height1 = 767.0 // // I/flutter ( 9979): _height2 = 1039.0 // // I/flutter ( 9979): _height3 = 1101.0 // // // AS ADV OK: // // I/flutter ( 5464): _height1 = 767.0 // // I/flutter ( 5464): _height2 = 1006.0 // // I/flutter ( 5464): _height3 = 788.0 // // return _height; // } List listHeight = [ 484, 46, 168, 69, ]; @override Widget build(BuildContext context) { // double btnHeight1 = 80; //第一按钮行高度 // double btnHeight2 = 160; //第二按钮行高度 // double btnHeight3 = 302; //350、303 S7越界。第二按钮行高度,370越界,365 ARS AL00不越界 // int btnCount = 4; //每行按钮个数 // var mediaSize = MediaQuery.of(context).size; // double ratio2 = (mediaSize.width / btnCount) / (btnHeight2 / 2); //注意:必须在返回Widget的覆盖构造函数中初始化,在其他地方初始化会报错失败 //在使用之前请设置好设计稿的宽度和高度,传入设计稿的宽度和高度(单位px) //一定在MaterialApp的home中的页面设置(即入口文件,只需设置一次),以保证在每次使用之前设置好了适配尺寸: //默认 width : 1080px , height:1920px , allowFontScaling:false //ScreenUtil.init(context); // double myWidth = mediaSize.width; // double myHeight = mediaSize.width * 9 / 16; // print('My_viewSize: Width-$myWidth, Height-$myHeight'); // double ratio = 1.0; //getHeight(); return WillPopScope( child: Container( decoration: new BoxDecoration( color: Color.fromRGBO(244, 244, 244, 1), //设置背景色 ), child: Column( children: [ Container( height: ScreenUtil().setHeight(listHeight[0]), //484, 530 - 46 child: Stack( children: [ //1、第1行文字 Positioned( child: Container( height: ScreenUtil().setHeight(324), //181 alignment: Alignment.topCenter, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ Color.fromRGBO(12, 186, 156, 1), Color.fromRGBO(39, 127, 235, 1), ], ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, //crossAxisAlignment: CrossAxisAlignment.start, //用的比较少 children: [ FlatButton( child: Container( child: Row( children: [ Padding( padding: EdgeInsets.only(top: ScreenUtil().setHeight(10)), child: 0 == service_tel.length ? Text("") : Image.asset( 'assets/images/形状 2.png', height: ScreenUtil().setHeight(45), ), ), Text(0 == service_tel.length ? " " : " 客服热线", style: TextStyle(fontSize: 16, color: Colors.white)), ], ), ), onPressed: () => launch("tel://18784678300"), ), SizedBox( width: ScreenUtil().setWidth(45), ), Expanded( child: Text(widget.title, style: TextStyle(fontSize: 20.0, color: Colors.white)), ), Container( child: InkWell( child: Image.asset( 'assets/images/刷新.png', height: ScreenUtil().setHeight(45), color: Colors.white, ), onTap: () { //刷新统计数据 mapStatisInfo.forEach((key, value) { mapStatisInfo[key] = -1; }); cllRStatisDataGeting = true; //正在获取车流量日统计数据,禁止重入 try_setState(); listDwinfoGetList2.clear(); startGetStatisDataNew(); Fluttertoast.showToast( msg: '正在刷新统计数据...', toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.BOTTOM, ); try_setState(); }, ), ), SizedBox( width: ScreenUtil().setWidth(60), ), ], ), ), ), //2、第2行装饰 Align( alignment: Alignment.bottomLeft, child: Container( alignment: Alignment(0, 1), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, //crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(18)), height: ScreenUtil().setHeight(310), decoration: BoxDecoration( color: Color.fromRGBO(62, 88, 231, 1), borderRadius: BorderRadius.horizontal(right: Radius.circular(20)), ), //color: Colors.pinkAccent, width: ScreenUtil().setWidth(34), alignment: Alignment.centerRight, ), getImageWidget(), Container( height: ScreenUtil().setHeight(310), decoration: BoxDecoration( color: Color.fromRGBO(113, 39, 203, 1), borderRadius: BorderRadius.horizontal(left: Radius.circular(20)), ), //color: Colors.pinkAccent, width: ScreenUtil().setWidth(34), alignment: Alignment.centerRight, ), ], ), ), ), ], ), ), //3、第3行统计信息 SizedBox(height: ScreenUtil().setHeight(listHeight[1])), // 46 Container( padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(18)), alignment: Alignment.center, width: ScreenUtil().setWidth(1022), height: ScreenUtil().setHeight(listHeight[2]), //168 decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(10)), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.end, children: [ getStatisInfo( '今日抓拍', listAllStatisData.length < dwSum ? -1 : mapStatisInfo['今日抓拍']), getVerticalDivider(), getStatisInfo( '今日初审', listAllStatisData.length < dwSum ? -1 : mapStatisInfo['今日初审']), getVerticalDivider(), getStatisInfo( '今日复审', listAllStatisData.length < dwSum ? -1 : mapStatisInfo['今日复审']), getVerticalDivider(), getStatisInfo( '今日推送', listAllStatisData.length < dwSum ? -1 : mapStatisInfo['今日推送']), getVerticalDivider(), getStatisInfo( '今日车流', listAllStatisData.length < dwSum ? -1 : mapStatisInfo['今日车流']), // getStatisInfo( // '今日抓拍', listZptjStatisAlone.length < dwSum ? -1 : mapStatisInfo['今日抓拍']), // getVerticalDivider(), // getStatisInfo('今日初审', listTodayShtj.length < dwSum ? -1 : mapStatisInfo['今日初审']), // getVerticalDivider(), // getStatisInfo('今日复审', listTodayShtj.length < dwSum ? -1 : mapStatisInfo['今日复审']), // getVerticalDivider(), // getStatisInfo('今日推送', listTodayShtj.length < dwSum ? -1 : mapStatisInfo['今日推送']), // getVerticalDivider(), // getStatisInfo( // '今日车流', listClltjStatisAlone.length < dwSum ? -1 : mapStatisInfo['今日车流']), ], ), ), SizedBox(height: ScreenUtil().setHeight(listHeight[3])), // 69 //4、第4行圆角按钮 Expanded( //color: Colors.black, //height: ScreenUtil().setHeight(getHeight()), // S7:905 //height: ScreenUtil().setHeight(908), //btnHeight3, // 302 //padding: EdgeInsets.all(10), //padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(76), 0, ScreenUtil().setWidth(76), 0), //padding: EdgeInsets.fromLTRB(0, 0, 0, 0), //color: Color.fromRGBO(224, 224, 224, 1), //alignment: const Alignment(0, -1), // GridView 控制太麻烦,动态生成必须用 GridView ,静态组件可以不用 GridView // child: GridView.custom( // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( // crossAxisCount: btnCount, // mainAxisSpacing: ScreenUtil().setWidth(0), // crossAxisSpacing: ScreenUtil().setHeight(0), // childAspectRatio: 1, // ), // childrenDelegate: SliverChildBuilderDelegate((context, position) { // //圆角按钮 155 * 155 px // return getItemContainer(listData4[position]); // //listData4[position]; // }, childCount: listData4.length), // ), child: getBtnGroup(), ), ], ), ), onWillPop: () { // if (player.state == FijkState.started) { // player.pause(); // } //解决在Page1_Work.dart页面,按系统返回键总是报错flutter keeps stopping的问题 //player.stop(); sysPop(); }, ); } double _left = 30; double _intervalHor = 75; double _intervalVer = 58; //Size _itemSize = Size(211, 230); Size _itemSize = Size(211, 230); List _listBtnItems = []; Widget getBtnGroup() { return GridView.count( mainAxisSpacing: ScreenUtil().setWidth(_intervalVer), //垂直间距 //crossAxisSpacing: ScreenUtil().setHeight(_intervalHor), //水平间距 //childAspectRatio: _itemSize.width / _itemSize.height, padding: EdgeInsets.only(left: ScreenUtil().setWidth(_left), right: ScreenUtil().setWidth(_left)), crossAxisCount: 4, //一行的 Widget 数量 children: getDataListFun(), ); } Future getBtnGroup0() async { List listData4 = getDataListFun(); return Column( children: [ Row( //mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox(width: ScreenUtil().setWidth(_left)), listData4[0], //SizedBox(width: ScreenUtil().setWidth(101)), SizedBox(width: ScreenUtil().setWidth(_intervalHor)), listData4[1], SizedBox(width: ScreenUtil().setWidth(_intervalHor)), listData4[2], SizedBox(width: ScreenUtil().setWidth(_intervalHor)), listData4[3], ], ), SizedBox(height: ScreenUtil().setHeight(78)), Row( //mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox(width: ScreenUtil().setWidth(_left)), listData4[4], SizedBox(width: ScreenUtil().setWidth(_intervalHor)), listData4[5], SizedBox(width: ScreenUtil().setWidth(_intervalHor)), listData4[6], SizedBox(width: ScreenUtil().setWidth(_intervalHor)), listData4[7], ], ), ], ); } Widget getVerticalDivider() { return SizedBox( width: 1, height: ScreenUtil().setHeight(125), child: DecoratedBox( decoration: BoxDecoration(color: Colors.black26), ), ); } Widget getStatisInfo(String name, double data) { return InkWell( child: Container( alignment: Alignment(0, 0), //padding: EdgeInsets.only(top: ScreenUtil().setHeight(15)), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: ScreenUtil().setHeight(10)), Text(name, style: TextStyle(fontSize: 12, color: Colors.black), textAlign: TextAlign.center), SizedBox(height: ScreenUtil().setHeight(4)), Row( children: [ Text( data < 0 ? '...' : '${data.toStringAsFixed('今日车流' == name ? 2 : 0)}', style: TextStyle( fontSize: 20, color: Color.fromRGBO(48, 135, 255, 1), fontWeight: FontWeight.bold), ), '今日车流' == name ? Container( padding: EdgeInsets.only(top: ScreenUtil().setHeight(8)), child: Text(' 万', style: TextStyle(fontSize: 10, color: Colors.black)), ) : SizedBox.shrink(), ], ), ], ), ), onTap: data < 0 ? null : () { switch (name) { case '今日抓拍': // Navigator.of(context) // .push(MaterialPageRoute(builder: (context) => ZptjBarChart(statisType: 'zptj'))); Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'jrzp'))); break; case '今日初审': Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'hycs'))); break; case '今日复审': Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'hyfh'))); break; case '今日推送': Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'tsjj'))); break; case "今日车流": Navigator.of(context).push(MaterialPageRoute( builder: (context) => ZptjBarChartOne(statisType: 'clltj'))); break; default: break; } }, onLongPress: data < 0 ? null : () { switch (name) { case '今日抓拍': Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjPage(statisType: 'zptj'))); break; case '今日初审': case '今日复审': case '今日推送': Navigator.of(context).push( MaterialPageRoute(builder: (context) => ZptjPage(statisType: 'sh_hyc_tj'))); break; case "今日车流": Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjPage(statisType: 'clltj'))); break; default: break; } }, ); } //自定义带说明图标按钮函数。点击说明文字有反应 Widget _getIconAndTextButton( {String text, IconData icon, Color iconColor = Colors.blueAccent, var onPress = null}) { return Container( width: 60, height: 60, alignment: const Alignment(0, 1), child: FlatButton( padding: EdgeInsets.all(0), onPressed: onPress, color: Colors.transparent, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: 2), Container( alignment: Alignment(0, -1), height: 36, width: 36, decoration: BoxDecoration( color: Colors.white, ), child: Icon( icon, size: 32, color: iconColor, ), ), //SizedBox(height: 2), Text(text, //textAlign: TextAlign.center, style: TextStyle( fontSize: 12.0, )), ], ), ), ); } //自定义带说明图片按钮函数。点击说明文字有反应 //Flutter按钮添加背景图片及文字的一种方法,记录下,上代码 //原文链接:https://blog.csdn.net/WC270607563/article/details/103148574 Widget _getPicAndTextButton(String text, String imgpath, var onPress, {Size imageSize, IconData icon, Color iconColor = Colors.white}) { if (null == imageSize) { imageSize = Size(ScreenUtil().setWidth(75), ScreenUtil().setHeight(75)); } Color _bkgColor; switch (text) { case "黑烟复审": case "视频播放": case "审核图表": case "审核统计": case "今日抓拍": case "点位喊话": _bkgColor = Color.fromRGBO(36, 206, 192, 1); //绿色 break; case "抓拍图表": case "抓拍统计": case "推送交警": case "报警信息": case "今日推送": case "LED字幕": _bkgColor = Color.fromRGBO(79, 118, 230, 1); //深蓝 break; case "点位视频": case "车流量图表": case "今日初审": _bkgColor = Color.fromRGBO(116, 139, 161, 1); //深灰 break; default: _bkgColor = Color.fromRGBO(80, 159, 245, 1); //亮蓝 break; } //155 + 35 + 12 + 6 = 208 return InkWell( child: Container( width: ScreenUtil().setWidth(_itemSize.width), height: ScreenUtil().setHeight(_itemSize.height), alignment: Alignment.center, //color: Colors.red, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( width: ScreenUtil().setWidth(155), //S10 2280*1080,在S10正方形变长,是正常的。因为在 ScreenUtilInit 是按 1080, 1920 //ScreenUtilInit(designSize: Size(1080, 1920), //安卓手机宽高尺寸 //通过 sizeWindowPhysicalSize = window.physicalSize; 自动适应安卓手机系统分辨率,解决 S10 手机正方形变形问题 height: ScreenUtil().setHeight(155), //color: Colors.blue, decoration: BoxDecoration( color: '车流量日统计' == text && cllRStatisDataGeting ? Colors.grey : _bkgColor, borderRadius: BorderRadius.all(Radius.circular(15)), ), alignment: Alignment.center, child: imgpath.isNotEmpty ? Image.asset(imgpath, fit: BoxFit.scaleDown, color: Colors.white, width: imageSize.width, height: imageSize.height) : Icon( icon, size: imageSize.width, color: iconColor, ), ), SizedBox(height: ScreenUtil().setWidth(0)), Text(text, style: TextStyle(fontSize: 14)), ], ), ), //cllRStatisDataGeting = true; //正在获取车流量日统计数据,禁止重入 onTap: '车流量日统计' == text && cllRStatisDataGeting ? null : onPress, ); } Widget _getPicAndTextButtonTest(String text, String imgpath, var onPress, {Size imageSize}) { if (null == imageSize) { imageSize = Size(ScreenUtil().setWidth(75), ScreenUtil().setHeight(75)); } //155 + 35 + 12 = 202 return InkWell( child: Container( width: ScreenUtil().setWidth(155), height: ScreenUtil().setHeight(155), alignment: Alignment.center, color: Colors.red, ), onTap: onPress, ); } //该美工优化的页面 Page1_Works,是供多个页面共享的代码框架。不同的页面以 PageType 字段进行区分 //String pageType = ''; //'home_page'、'statis_page'、'device_page' //生成功能区按钮List List getDataListFun() { switch (widget.pageType) { case 'home_page': return getDataListFun_home_page(); break; case 'statis_page': return getDataListFun_statis_page(); break; case 'device_page': return getDataListFun_device_page(); break; } } //生成功能区按钮List List getDataListFun_device_page() { List list = []; list.add( _getPicAndTextButton("点位信息", "assets/images/1 (194).png", () { Navigator.of(context).push(MaterialPageRoute(builder: (context) => DwxxGetList())); }), ); list.add( _getPicAndTextButton("报警信息", "assets/images/1 (219).png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => SbbjGetList(hyshlx: 'sbbj'))); }), ); list.add( _getPicAndTextButton("点位视频", "assets/images/monitor2.png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => DwspGetList(hyshlx: 'dwsp'))); }), ); return list; } //生成功能区按钮List List getDataListFun_statis_page() { List list = []; list.add( _getPicAndTextButton("抓拍图表", "assets/images/statis_blue.png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjBarChart(statisType: 'zptj'))); }), ); list.add( _getPicAndTextButton("审核图表", "assets/images/statis_red.png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjBarChart(statisType: 'sh_hyc_tj'))); }), ); list.add( _getPicAndTextButton("车流量图表", "assets/images/statis_green.png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjBarChartOne(statisType: 'clltj'))); }), ); list.add( _getPicAndTextButton("抓拍统计", "assets/images/图层 11.png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjPage(statisType: 'zptj'))); }), ); list.add( _getPicAndTextButton("审核统计", "assets/images/1 (15).png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjPage(statisType: 'sh_hyc_tj'))); }), ); list.add( _getPicAndTextButton("车流量统计", "assets/images/1 (84).png", () { Navigator.of(context) .push(MaterialPageRoute(builder: (context) => ZptjPage(statisType: 'clltj'))); }), ); list.add( _getPicAndTextButton( "今日抓拍", '', listZptjStatisAlone.length < dwSum ? null : () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'jrzp'))); }, icon: Icons.camera_alt_outlined), ); list.add( _getPicAndTextButton( "今日初审", '', listTodayShtj.length < dwSum ? null : () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'hycs'))); }, icon: Icons.preview_outlined), ); list.add( _getPicAndTextButton( "今日复审", '', listTodayShtj.length < dwSum ? null : () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'hyfh'))); }, icon: Icons.rate_review_outlined), ); list.add( _getPicAndTextButton( "今日推送", '', listTodayShtj.length < dwSum ? null : () { Navigator.of(context).push( MaterialPageRoute(builder: (context) => TodayList(todayListLx: 'tsjj'))); }, icon: Icons.format_list_numbered_outlined), ); //// 仅宜宾市提供 // list.add( // _getPicAndTextButton("车流量日统计", "assets/images/车流量日统计.png", () { // Navigator.of(context).push(MaterialPageRoute( // builder: (context) => ZptjBarEchartsTrinityNew(statisType: 'cllrtj'))); // }), // ); return list; } //生成功能区按钮List List getDataListFun_home_page() { List list = []; list.add( _getPicAndTextButton("黑烟初审", "assets/images/聚焦.png", () { print('Icons.videocam'); //hyshlx为黑烟审核类型,用于在同一套代码中,处理'hycs'黑烟初审、'hyfh'黑烟复审 Navigator.of(context).push( MaterialPageRoute(builder: (context) => HyshGetListNew(hyshlx: 'hycs', title: '黑烟初审'))); }), ); list.add( _getPicAndTextButton("黑烟复审", "assets/images/盾 密码 安全.png", () { print('Icons.videocam'); //hyshlx为黑烟审核类型,用于在同一套代码中,处理'hycs'黑烟初审、'hyfh'黑烟复审 Navigator.of(context).push( MaterialPageRoute(builder: (context) => HyshGetListNew(hyshlx: 'hyfh', title: '黑烟复审'))); }), ); list.add( _getPicAndTextButton("推送交警", "assets/images/警察.png", () { print('Icons.videocam'); // Navigator.of(context).push(MaterialPageRoute( // builder: (context) => TsjjGetList( // tsjjlx: 'tsjj', // ))); Navigator.of(context).push(MaterialPageRoute( builder: (context) => HyshGetListFliter(hyshlx: 'tsjj', title: '推送交警'))); }), ); // list.add( // _getPicAndTextButton("复审查询", "assets/fun_icons/fun_icon_4.png", () { // print('Icons.videocam'); // Navigator.of(context).push(MaterialPageRoute(builder: (context) => TsjjGetList(tsjjlx: 'fhcx',))); // }), // ); list.add( _getPicAndTextButton("非黑烟查询", "assets/images/1 (104).png", () { print('Icons.videocam'); //Navigator.of(context).push(MaterialPageRoute(builder: (context) => FhycxGetList())); Navigator.of(context).push(MaterialPageRoute( //builder: (context) => WzxxGetList(hyshlx: 'fhycx'))); builder: (context) => HyshGetListFliter(hyshlx: 'fhycx', title: '非黑烟查询'))); }), ); // list.add( // _getPicAndTextButton("违章信息", "assets/fun_icons/fun_icon_5.png", () { // //Navigator.of(context).push(MaterialPageRoute(builder: (context) => WzxxGetList())); // Navigator.of(context) // .push(MaterialPageRoute(builder: (context) => WzxxGetList(hyshlx: 'wzxx'))); // }), // ); int defauld_led_id = 1; switch (qx_code) { case 511528: // 兴文县 break; default: break; } list.add( _getPicAndTextButton("LED字幕", "assets/images/LED.png", () { print('LED显示信息'); // Navigator.of(context) // .push(MaterialPageRoute(builder: (context) => LedXsxxGetList(hyshlx: 'led_xsxx'))); //应公司要求改为:打开LED字幕后,直接显示点位选择那个界面,用户可以手动切换进行设置 //区县的点位信息不全,无法显示LED信息,暂时屏蔽LED信息显示功能,等建设完成后逐步恢复 // Fluttertoast.showToast( // msg: '区县点位信息不全,无法显示LED信息,暂时屏蔽LED信息显示功能,等建设完成后逐步恢复...', // toastLength: Toast.LENGTH_LONG, // gravity: ToastGravity.CENTER, // ); Navigator.of(context).push(MaterialPageRoute( builder: (context) => LedXsxxContent( title: 'LED显示信息', sbgllx: 'led_xsxx', //设备管理类型:LED显示信息 id: defauld_led_id, ))); }), ); list.add( _getPicAndTextButton("点位地图", 'assets/images/1 (177).png', () { print('点位地图'); Navigator.of(context) .push(MaterialPageRoute(builder: (context) => BasicMap(hyshlx: 'dwdt', title: "点位地图"))); }), ); list.add( _getPicAndTextButton("点位视频", "assets/images/monitor2.png", () { print('点位视频'); Navigator.of(context) .push(MaterialPageRoute(builder: (context) => DwspGetList(hyshlx: 'dwsp'))); }), ); // list.add( // _getPicAndTextButton("点位喊话", "assets/images/点位喊话.png", () { // print('点位喊话'); // Navigator.of(context).push(MaterialPageRoute(builder: (context) => DwListSound())); // }), // ); // list.add( // _getPicAndTextButton("视频播放", 'assets/images/播放 (1).png', () { // print('视频播放'); // urlnew = // "http://www.yibinu.edu.cn/__local/5/35/DF/264049B7E978EEE2F5849688986_05D4A6FE_152CDB8C.mp4?e=.mp4"; // Navigator.of(context).push(MaterialPageRoute(builder: (context) => PlayerProNew())); // }), // ); //填充空白 //list.add(null); // list.add( // _getPicAndTextButton("X5视频", "assets/images/monitor2.png", () { // print('X5视频'); // Navigator.of(context) // .push(MaterialPageRoute(builder: (context) => X5WebviewPage())); // }), // ); return list; } //生成容器部件 Widget getItemContainer0(Widget item) { return Container( width: 5.0, height: 5.0, alignment: Alignment.center, child: item, color: Colors.white, ); } //生成容器部件 Widget getItemContainer(Widget item) { return Container( decoration: BoxDecoration( //color: Colors.blue, borderRadius: BorderRadius.all(Radius.circular(20)), ), // width: 3.0, // height: 3.0, alignment: Alignment.center, child: item, //color: Colors.blue, ); } }