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
+280
View File
@@ -0,0 +1,280 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import '../../model/ProductModel.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import '../../config/Config.dart';
import 'package:dio/dio.dart';
// import '../../services/SignServices.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
//轮播图类模型
import '../../model/FocusModel.dart';
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage>
with AutomaticKeepAliveClientMixin {
List _focusData = [];
List _hotProductList = [];
List _bestProductList = [];
@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
@override
void initState() {
super.initState();
_getFocusData();
_getHotProductData();
_getBestProductData();
// SignServices.getSign();
}
//获取轮播图数据
_getFocusData() async {
var api = '${Config.domain}api/focus';
var result = await Dio().get(api);
var focusList = FocusModel.fromJson(result.data);
setState(() {
this._focusData = focusList.result;
});
}
//获取猜你喜欢的数据
_getHotProductData() async {
var api = '${Config.domain}api/plist?is_hot=1';
var result = await Dio().get(api);
var hotProductList = ProductModel.fromJson(result.data);
setState(() {
this._hotProductList = hotProductList.result;
});
}
//获取热门推荐的数据
_getBestProductData() async {
var api = '${Config.domain}api/plist?is_best=1';
var result = await Dio().get(api);
var bestProductList = ProductModel.fromJson(result.data);
setState(() {
this._bestProductList = bestProductList.result;
});
}
//轮播图
Widget _swiperWidget() {
if (this._focusData.length > 0) {
return Container(
child: AspectRatio(
aspectRatio: 2 / 1,
child: Swiper(
itemBuilder: (BuildContext context, int index) {
String pic = this._focusData[index].pic;
pic = Config.domain + pic.replaceAll('\\', '/');
return new Image.network(
"${pic}",
fit: BoxFit.fill,
);
},
itemCount: this._focusData.length,
pagination: new SwiperPagination(),
autoplay: true),
),
);
} else {
return Text('加载中...');
}
}
Widget _titleWidget(value) {
return Container(
height: ScreenUtil().setHeight(60),
margin: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
border: Border(
left: BorderSide(
color: Colors.red,
width: ScreenUtil().setWidth(10),
))),
child: Text(
value,
style: TextStyle(color: Colors.black54),
),
);
}
//热门商品
Widget _hotProductListWidget() {
if (this._hotProductList.length > 0) {
return Container(
height: ScreenUtil().setHeight(234),
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (contxt, index) {
//处理图片
String sPic = this._hotProductList[index].sPic;
sPic = Config.domain + sPic.replaceAll('\\', '/');
return Column(
children: <Widget>[
Container(
height: ScreenUtil().setHeight(140),
width: ScreenUtil().setWidth(140),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(21)),
child: Image.network(sPic, fit: BoxFit.cover),
),
Container(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(10)),
height: ScreenUtil().setHeight(50),
child: Text(
"¥${this._hotProductList[index].price}",
style: TextStyle(color: Colors.red),
),
)
],
);
},
itemCount: this._hotProductList.length,
),
);
} else {
return Text("");
}
}
//推荐商品
Widget _recProductListWidget() {
var itemWidth = (ScreenUtil().screenWidth - 30) / 2;
return Container(
padding: EdgeInsets.all(10),
child: Wrap(
runSpacing: 10,
spacing: 10,
children: this._bestProductList.map((value) {
//图片
String sPic = value.sPic;
sPic = Config.domain + sPic.replaceAll('\\', '/');
return InkWell(
onTap: () {
Navigator.pushNamed(context, '/productContent',
arguments: {"id": value.sId});
},
child: Container(
padding: EdgeInsets.all(10),
width: itemWidth,
decoration: BoxDecoration(
border: Border.all(
color: Color.fromRGBO(233, 233, 233, 0.9), width: 1)),
child: Column(
children: <Widget>[
Container(
width: double.infinity,
child: AspectRatio(
//防止服务器返回的图片大小不一致导致高度不一致问题
aspectRatio: 1 / 1,
child: Image.network(
"${sPic}",
fit: BoxFit.cover,
),
),
),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(20)),
child: Text(
"${value.num}",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: Colors.black54),
),
),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(20)),
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.centerLeft,
child: Text(
"¥${value.price}",
style: TextStyle(color: Colors.red, fontSize: 16),
),
),
Align(
alignment: Alignment.centerRight,
child: Text("¥${value.oldPrice}",
style: TextStyle(
color: Colors.black54,
fontSize: 14,
decoration: TextDecoration.lineThrough)),
)
],
),
)
],
),
),
);
}).toList(),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.center_focus_weak, size: 28, color: Colors.black87),
onPressed: null,
),
title: InkWell(
child: Container(
height: ScreenUtil().setHeight(68),
decoration: BoxDecoration(
color: Color.fromRGBO(233, 233, 233, 0.8),
borderRadius: BorderRadius.circular(30)),
padding: EdgeInsets.only(left: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(Icons.search),
Text("笔记本", style: TextStyle(fontSize: ScreenUtil().setSp(28)))
],
),
),
onTap: () {
Navigator.pushNamed(context, '/search');
},
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.message, size: 28, color: Colors.black87),
onPressed: null,
)
],
),
body: ListView(
children: <Widget>[
_swiperWidget(),
SizedBox(height: ScreenUtil().setHeight(20)),
_titleWidget("猜你喜欢"),
SizedBox(height: ScreenUtil().setHeight(20)),
_hotProductListWidget(),
_titleWidget("热门推荐"),
_recProductListWidget()
],
),
);
}
}
+186
View File
@@ -0,0 +1,186 @@
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hyzp_ybqx/pages/tabs/page4_myMsics_new.dart';
//import '../../widget/player_pro.dart';
import '../../components/commonFun.dart';
//import 'package:fijkplayer/fijkplayer.dart';
import '../../services/ServiceLocator.dart';
import '../../services/Storage.dart';
import 'page1_work.dart';
class Tabs extends StatefulWidget {
Tabs({Key key, this.arguments = 0}) : super(key: key);
int arguments;
_TabsState createState() => _TabsState();
}
class _TabsState extends State<Tabs> {
//try_setState(); //避免如下异常报错
try_setState() {
try {
setState(() {});
} catch (e) {
print('setState(() {})异常:${e}');
}
}
int _currentIndex = 0;
String sAppBar0 = 'Flutter Demo';
String sAppBar = 'Flutter Demo';
PageController _pageController;
@override
void initState() {
getlistItems().then((value) => try_setState());
print('widget.arguments = ${widget.arguments}');
//_currentIndex = 3 == widget.arguments ? 0 : widget.arguments; //解决"我的"页面根据用户所属组及时刷新问题
_currentIndex = widget.arguments;
this._pageController = PageController(initialPage: _currentIndex);
// 注册服务
setupLocator();
// 解决登录按钮再次变换文字的问题
Future.delayed(const Duration(milliseconds: 1000), () {
//重新初始化处理延时登录的变量
//bMayLogin = false; //这句必须注释掉,否则“退出登录”后,无法再次进行用户名登录
bPreLoading = false;
bLoginVerify = false; //处理延时登录,判断用户名登录是否验证通过
});
super.initState();
}
double _activeIconWidth = 68;
Future getlistItems() async {
listItems.addAll([
BottomNavigationBarItem(
icon: getImageItem('assets/images/矢量智能对象.png'),
label: "首页",
activeIcon: getImageItem('assets/images/矢量智能对象.png',
width: _activeIconWidth, color: Colors.blue)),
BottomNavigationBarItem(
icon: getImageItem('assets/images/矢量智能对象(1).png'),
label: "统计",
activeIcon: getImageItem('assets/images/矢量智能对象(1).png',
width: _activeIconWidth, color: Colors.blue)),
BottomNavigationBarItem(
icon: getImageItem('assets/images/矩形 1 拷贝 39.png'),
label: "设备",
activeIcon: getImageItem('assets/images/矩形 1 拷贝 39.png',
width: _activeIconWidth, color: Colors.blue)),
//bNewVer:是否发现新版本
BottomNavigationBarItem(
icon: getImageItem('assets/images/我的.png', bBadge: bNewVer),
label: "我的",
activeIcon: getImageItem('assets/images/我的.png',
width: _activeIconWidth, color: Colors.blue, bBadge: bNewVer)),
]);
}
// 添加底部导航栏图标的小红点
Widget getImageItem(String imagePath,
{double width = 56,
Color color = const Color.fromRGBO(131, 131, 131, 1),
bool bBadge = false}) {
return bBadge
? Badge(
position: BadgePosition.topEnd(top: -4, end: -9),
badgeContent: null,
child: Image.asset(imagePath,
width: ScreenUtil().setWidth(width), fit: BoxFit.cover, color: color))
: Image.asset(imagePath,
width: ScreenUtil().setWidth(width), fit: BoxFit.cover, color: color);
}
List<BottomNavigationBarItem> listItems = [];
//该美工优化的页面 Page1_Works,是供多个页面共享的代码框架。不同的页面以 PageType 字段进行区分
//String pageType = ''; //'home_page'、'statis_page'、'device_page'
List<Widget> _pageList = [
Page1_Works(pageType: 'home_page', title: '黑烟车抓拍系统'),
Page1_Works(pageType: 'statis_page', title: ' 统计信息'),
Page1_Works(pageType: 'device_page', title: ' 设备管理'),
//Page2_StatisticsNew(),
//Page3_Device(),
//Page4_MyMsics(),
Page4_MyMsicsNew(pageType: 'my_page', title: ' 我的'),
];
Text _getName(index) {
return Text(this.sAppBar0 + ' - ' + this.listItems[_currentIndex].label);
}
@override
Widget build(BuildContext context) {
sizeWindowPhysicalSize = MediaQuery.of(context).size;
return Scaffold(
// appBar: _currentIndex!=3?:AppBar(
// title: Text("用户中心"),
// ),
resizeToAvoidBottomPadding: false, //解决输入法键盘弹出越界问题-OK
appBar: PreferredSize(
child: AppBar(
//title: Text("Flutter Demo"),
title: listItems.isEmpty ? Text('') : _getName(this._currentIndex),
),
preferredSize: Size.fromHeight(0) //Flutter——设置appBar的高度
),
//底部导航栏,使用PageView方式,在App启动时只加载显示页面,启动时没有警告报错。可以配置每个页面的是否保持状态,更为灵活,也更复杂一些
body: PageView(
controller: this._pageController,
children: this._pageList,
onPageChanged: (index) {
setState(() {
this._currentIndex = index;
//label: "我的"
//eventBus.fire(GroupIdUpdateEvent('g_userInfo.userGroupIDlist 数据已更新')); //这样刷新有效
// if (3 == index) {
// }
});
},
physics: NeverScrollableScrollPhysics(), //禁止pageView滑动
),
//底部导航栏,使用IndexedStack方式,是在App启动时便一次性加载所有页面,启动时有警告报错。所有页面的状态都会保持
// body: IndexedStack(
// index: _currentIndex,
// children: this._pageList,
// ),
bottomNavigationBar: listItems.isEmpty
? Text('')
: BottomNavigationBar(
currentIndex: _currentIndex,
onTap: (index) {
//eventBus.fire(GroupIdUpdateEvent('g_userInfo.userGroupIDlist 数据已更新')); //这样刷新有效
g_iIndex = index;
Storage.setString('tabs_index', g_iIndex.toString());
setState(() {
this._currentIndex = index;
this._pageController.jumpToPage(index);
// if (1 == index && bPlaying) {
// if (player.value.videoRenderStart && player.state == FijkState.paused) {
// player.start();
// }
// } else {
// //若player并未初始化播放,调用会报错:The method 'changePlayerState' was called on null.
// if (player.value.videoRenderStart && player.state == FijkState.started) {
// bPlaying = true;
// player.pause();
// }
// }
});
},
iconSize: ScreenUtil().setSp(70),
//icon的大小
fixedColor: Colors.blueAccent,
type: BottomNavigationBarType.fixed,
items: listItems,
),
);
}
}
+144
View File
@@ -0,0 +1,144 @@
//https://material.io/tools/icons/?icon=favorite&style=baseline
import 'package:flutter/material.dart';
import '../../widget/JdButton.dart';
import '../../services/UserServices.dart';
import '../../services/EventBus.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class UserPage extends StatefulWidget {
UserPage({Key key}) : super(key: key);
_UserPageState createState() => _UserPageState();
}
class _UserPageState extends State<UserPage> {
bool isLogin = false;
List userInfo = [];
@override
void initState() {
// TODO: implement initState
super.initState();
this._getUserinfo();
//监听登录页面改变的事件
eventBus.on<UserEvent>().listen((event) {
print(event.str);
this._getUserinfo();
});
}
_getUserinfo() async {
var isLogin = await UserServices.getUserLoginState();
var userInfo = await UserServices.getUserInfo();
setState(() {
this.userInfo = userInfo;
this.isLogin = isLogin;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
// appBar: AppBar(
// title: Text("用户中心"),
// ),
body: ListView(
children: <Widget>[
Container(
height: ScreenUtil().setHeight(220),
width: double.infinity,
decoration:
BoxDecoration(image: DecorationImage(image: AssetImage('assets/images/user_bg.jpg'), fit: BoxFit.cover)),
child: Row(
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(10, 0, 10, 0),
child: ClipOval(
child: Image.asset(
'assets/images/user.png',
fit: BoxFit.cover,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(100),
),
),
),
!this.isLogin
? Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.pushNamed(context, '/login');
},
child: Text("登录/注册", style: TextStyle(color: Colors.white)),
),
)
: Expanded(
flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("用户名:${this.userInfo[0]["username"]}",
style: TextStyle(color: Colors.white, fontSize: ScreenUtil().setSp(32))),
Text("普通会员", style: TextStyle(color: Colors.white, fontSize: ScreenUtil().setSp(24))),
],
),
)
],
),
),
ListTile(
leading: Icon(Icons.assignment, color: Colors.red),
title: Text("全部订单"),
onTap: () {
Navigator.pushNamed(context, '/order');
},
),
Divider(),
ListTile(
leading: Icon(Icons.payment, color: Colors.green),
title: Text("待付款"),
),
Divider(),
ListTile(
leading: Icon(Icons.local_car_wash, color: Colors.orange),
title: Text("待收货"),
),
Container(width: double.infinity, height: 10, color: Color.fromRGBO(242, 242, 242, 0.9)),
ListTile(
leading: Icon(Icons.favorite, color: Colors.lightGreen),
title: Text("我的收藏"),
),
Divider(),
ListTile(
leading: Icon(Icons.people, color: Colors.black54),
title: Text("在线客服"),
),
Divider(),
this.isLogin
? Container(
padding: EdgeInsets.all(20),
child: JdButton(
height: ScreenUtil().setSp(300),
color: Colors.red,
text: "退出登录",
onTop: () {
UserServices.loginOut();
this._getUserinfo();
},
),
)
: Text("")
],
));
}
}
+990
View File
@@ -0,0 +1,990 @@
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/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';
import '../Works/LED_XSXX/led_xsxx_content.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<MyFijkPanelWidgetBuilderState> _myFijkPanelWidgetBuilderStateKey = new GlobalKey<MyFijkPanelWidgetBuilderState>();
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<Page1Work> with WidgetsBindingObserver, AutomaticKeepAliveClientMixin {
class _Page1_WorksState extends State<Page1_Works>
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<StatisDataUpdate>().listen((event) {
print(event.str);
updateStatisData();
});
//监听 选择LED点位 更新事件
eventBus.on<SelectLedDwUpdateEvent>().listen((event) async {
print(event.str);
try_setState();
});
super.initState();
}
// 更新工作页面的今日统计数据
Future updateStatisData() async {
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<void> 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<double> listHeight = <double>[
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: <Widget>[
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: <Widget>[
FlatButton(
child: Container(
child: Row(
children: [
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(10)),
child: Image.asset(
'assets/images/形状 2.png',
height: ScreenUtil().setHeight(45),
),
),
Text(" 客服热线",
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;
});
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<Widget> _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<Widget> 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: <Widget>[
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: <Widget>[
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<Widget> 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<Widget> getDataListFun_device_page() {
List<Widget> 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<Widget> getDataListFun_statis_page() {
List<Widget> 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<Widget> getDataListFun_home_page() {
List<Widget> 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')));
// }),
// );
list.add(
_getPicAndTextButton("LED字幕", "assets/images/LED.png", () {
print('LED显示信息');
// Navigator.of(context)
// .push(MaterialPageRoute(builder: (context) => LedXsxxGetList(hyshlx: 'led_xsxx')));
//应公司要求改为:打开LED字幕后,直接显示点位选择那个界面,用户可以手动切换进行设置
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => LedXsxxContent(
title: 'LED显示信息',
sbgllx: 'led_xsxx', //设备管理类型:LED显示信息
id: 1,
)));
}),
);
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,
);
}
}
+744
View File
@@ -0,0 +1,744 @@
import 'dart:convert';
import 'dart:io';
import 'package:badges/badges.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.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:fluttertoast/fluttertoast.dart';
import 'package:hyzp_ybqx/components/commonFun.dart';
import 'package:hyzp_ybqx/pages/Login/FaceLogin.dart';
import 'package:hyzp_ybqx/pages/Login/FaceReg.dart';
import 'package:hyzp_ybqx/pages/MyMsics/05_updated/MyUpdatedNew.dart';
import 'package:hyzp_ybqx/pages/Works/TJXX/tj_data.dart';
import 'package:hyzp_ybqx/services/EventBus.dart';
import 'package:hyzp_ybqx/services/EventBus.dart';
import 'package:hyzp_ybqx/widget/JdButton.dart';
import 'package:package_info/package_info.dart';
import 'package:package_info/package_info.dart';
import 'package:path_provider/path_provider.dart';
//import 'package:hyzp_ybqx/widget/player_pro.dart';
import 'package:scroll_to_index/util.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../components/commonFun.dart';
import '../../components/commonFun.dart';
import '../../components/customDialogF.dart';
import '../../services/Storage.dart';
//import 'package:hyzp_ybqx/widget/player_pro.dart';
import '../Login/ModifyPassword.dart';
import '../MyMsics/03_personal/PersonalData.dart';
import '../MyMsics/04_MyFeedback/MyFeedback.dart';
import '../MyMsics/05_updated/MyUpdated.dart';
import '../MyMsics/07_myAbout/MyAbout.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<MyFijkPanelWidgetBuilderState> _myFijkPanelWidgetBuilderStateKey = new GlobalKey<MyFijkPanelWidgetBuilderState>();
class Page4_MyMsicsNew extends StatefulWidget {
Page4_MyMsicsNew({@required this.pageType, this.title, Key key}) : super(key: key);
//该美工优化的页面 Page4_MyMsicsNew,是供多个页面共享的代码框架。不同的页面以 PageType 字段进行区分
String pageType = ''; //'my_page'
String title = '';
@override
_Page4_MyMsicsNewState createState() => _Page4_MyMsicsNewState();
}
//class _Page1WorkState extends State<Page1Work> with WidgetsBindingObserver, AutomaticKeepAliveClientMixin {
class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
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() {
//监听 g_userInfo.userGroupIDlist 更新事件
// eventBus.on<GroupIdUpdateEvent>().listen((event) async {
// print(event.str);
// getAdminItem();
// });
getListView().then((value) {
Future.delayed(Duration(milliseconds: 500), () {
getAdminItem();
});
});
super.initState();
}
Future updateStatisData() async {
if (listZptjStatisAlone.length >= dwSum && -1 == mapStatisInfo['今日抓拍']) {
getAllSum('today', listZptjStatisAlone).then((value) {
mapStatisInfo['今日抓拍'] = value[1];
try_setState();
});
}
if (listShtjStatisAlone.length >= dwSum && -1 == mapStatisInfo['今日初审']) {
getAllSum('total', listShtjStatisAlone).then((value) {
mapStatisInfo['今日初审'] = value[1];
mapStatisInfo['今日复审'] = value[1];
try_setState();
});
getAllSum('sends', listShtjStatisAlone).then((value) {
mapStatisInfo['今日推送'] = value[1];
try_setState();
});
}
if (listClltjStatisAlone.length >= dwSum && -1 == mapStatisInfo['今日车流']) {
getAllSum('today', listClltjStatisAlone).then((value) {
mapStatisInfo['今日车流'] = value[1] ~/ 10000;
try_setState();
});
}
}
Future<void> sysPop() async {
await SystemChannels.platform.invokeMethod('SystemNavigator.pop');
}
_Page4_MyMsicsNewState();
@override
void dispose() {
super.dispose();
}
//自定义方法
static onNullFun() {}
Widget _getListTile(title,
{String leadPath = '',
Color leadColor,
onTapFun = onNullFun,
onLongPressFun = onNullFun,
size = 16.0,
bool bBadge = false}) {
return Column(
children: <Widget>[
ListTile(
leading: bBadge
? Badge(
position: BadgePosition.topEnd(top: -7, end: -12),
badgeContent: null,
child: Image.asset(
leadPath,
height: ScreenUtil().setHeight(78),
fit: BoxFit.fitHeight,
),
)
: Image.asset(
leadPath,
height: ScreenUtil().setHeight(78),
fit: BoxFit.fitHeight,
),
title: new Text(title, style: TextStyle(fontSize: size)),
trailing: new Icon(Icons.arrow_forward_ios),
contentPadding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0),
enabled: true,
onTap: onTapFun,
onLongPress: onLongPressFun,
),
Divider(
height: 1.0,
),
],
);
}
List<Widget> _listViewUser = [];
List<Widget> _listViewUser_user = [];
Color _greenColor = Color.fromRGBO(36, 206, 192, 1); //绿色
Color _deepBlueColor = Color.fromRGBO(79, 118, 230, 1); //深蓝
Color _deepGreyColor = Color.fromRGBO(116, 139, 161, 1); //深灰
Color _ligthBlueColor = Color.fromRGBO(80, 159, 245, 1); //亮蓝
Future getListView() async {
_listViewUser_user.clear();
// _listViewUser.add(_getListTile('个人资料',
// leadPath: 'assets/images/我的.png',
// leadColor: _ligthBlueColor,
// onTapFun: OnTap_personal_data));
// _listViewUser.add(_getListTile('意见反馈',
// leadPath: 'assets/images/意见反馈.png',
// leadColor: _ligthBlueColor,
// onTapFun: OnTap_MyFeedback));
// _listViewUser.add(_getListTile('版本更新',
// leadPath: 'assets/images/版本更新.png', leadColor: _greenColor, onTapFun: OnTap_MyUpdate));
// _listViewUser.add(_getListTile('清除缓存',
// leadPath: 'assets/images/清除缓存.png',
// leadColor: _deepBlueColor,
// onTapFun: OnTap_ClearCache));
// _listViewUser.add(_getListTile('关于',
// leadPath: 'assets/images/关于.png', leadColor: _deepBlueColor, onTapFun: OnTap_MyAbout));
_listViewUser_user = [
_getListTile('清除缓存',
leadPath: 'assets/images/清除缓存.png',
leadColor: _deepBlueColor,
onTapFun: OnTap_ClearCache),
//用户资料修改、版本更新、意见反馈都需要后台支持才行,现在后台都没有提供支持,标书里面也没有要求,建议先去掉
// _getListTile('个人资料',
// leadPath: 'assets/images/我的.png',
// leadColor: _ligthBlueColor,
// onTapFun: OnTap_personal_data),
// _getListTile('意见反馈',
// leadPath: 'assets/images/意见反馈.png',
// leadColor: _ligthBlueColor,
// onTapFun: OnTap_MyFeedback),
_getListTile('修改密码',
leadPath: 'assets/images/修改密码.png',
leadColor: _deepBlueColor,
onTapFun: OnTap_modify_password),
//bNewVer:是否发现新版本
_getListTile('版本更新',
leadPath: 'assets/images/版本更新.png',
leadColor: _greenColor,
onTapFun: OnTap_MyUpdate,
bBadge: bNewVer),
// _getListTile('关于',
// leadPath: 'assets/images/关于.png', leadColor: _deepBlueColor, onTapFun: OnTap_MyAbout),
// _getListTile('权限测试',
// leadPath: 'assets/images/权限.png',
// leadColor: _deepGreyColor,
// onTapFun: OnTap_UserAuthority),
];
}
//已添加管理员记录的标志,0 未添加, 1 已添加 1 次
//该标志也作为是否是管理员的标志,若为 0 便不是、只是当前还不是, 1 则是管理员
//int alreadyFlag = 0;
Future getAdminItem() async {
_listViewUser.addAll(_listViewUser_user);
for (int group_id in g_userInfo.userGroupIDlist) {
print('group_id = $group_id');
if (26 == group_id || 31 == group_id) {
Widget _item = _getListTile('人脸注册',
leadPath: 'assets/images/人脸注册.png',
leadColor: _ligthBlueColor,
onTapFun: OnTap_FaceReg);
print('_listViewUser.length = ${_listViewUser.length}');
_listViewUser.add(_item);
break; //添加后便跳出循环,避免重复添加
}
}
_listViewUser.add(_getListTile('关于',
leadPath: 'assets/images/关于.png', leadColor: _deepBlueColor, onTapFun: OnTap_MyAbout));
print('_listViewUser.length = ${_listViewUser.length}');
Future.delayed(Duration(milliseconds: 500), () {
try_setState();
});
}
@override
Widget build(BuildContext context) {
return WillPopScope(
child: Container(
decoration: new BoxDecoration(
color: Color.fromRGBO(244, 244, 244, 1), //设置背景色
),
child: Column(
children: <Widget>[
Container(
height: ScreenUtil().setHeight(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: <Widget>[
FlatButton(
child: Container(
child: Row(
children: [
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(10)),
child: Image.asset(
'assets/images/形状 2.png',
height: ScreenUtil().setHeight(45),
),
),
Text(" 客服热线",
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)),
),
],
),
),
),
//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(
// alignment: Alignment(0, 0),
// height: ScreenUtil().setHeight(346),
// width: ScreenUtil().setWidth(942),
// child: Image.asset(
// 'assets/images/装饰图片10.png',
// fit: BoxFit.cover,
// ),
// ),
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(46)),
Expanded(
//Flutter Column套ListView不显示,可将ListView用Expanded包裹起来。
//用 ListView.builder 不好区别处理响应函数的动态参数传递,所以使用基本 ListView
// child: ListView.builder(
// itemCount: listContacts.length,
// itemBuilder: this._getlistContacts),
child: _listViewUser.isEmpty
? getMoreWidget(color: Colors.black26)
: ListView(
padding: EdgeInsets.all(10),
children: _listViewUser,
),
),
Divider(
height: 20.0,
indent: 0.0,
thickness: 1.0,
color: Color.fromRGBO(80, 159, 245, 1),
),
// Center(
// child: RaisedButton(
// //padding: EdgeInsets.all(0),
// onPressed: () {
// Navigator.pushNamed(context, '/', arguments: 0);
// },
// //color: Colors.transparent,
// child: Text('退出登录'),
// ),
// ),
JdButton(
height: 126,
//JdText中已经使用ScreenUtil().setHeight(126),此处不能传 ScreenUtil().setHeight(126) ,否则严重错位
width: 350,
text: "退出登录",
color: Color.fromRGBO(80, 159, 245, 1),
onTop: () {
Navigator.pushNamed(context, '/', arguments: 0);
},
),
SizedBox(
height: 20.0, //防止误触,所以设大一些
),
],
),
),
onWillPop: () {
sysPop();
},
);
}
OnTap_MyAbout() {
PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
String buildDate =
'${buildNumber.substring(0, 4)}.${buildNumber.substring(4, 6)}.${buildNumber.substring(6, 8)}';
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => MyAbout(ver: version, date: buildDate)));
});
}
OnTap_MyUpdate() {
PackageInfo.fromPlatform().then((PackageInfo packageInfo) async {
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
String buildDate =
'${buildNumber.substring(0, 4)}.${buildNumber.substring(4, 6)}.${buildNumber.substring(6, 8)}';
print('appName = $appName');
print('packageName = $packageName');
print('version = $version');
print('buildNumber = $buildNumber');
print('buildDate = $buildDate');
// I/flutter (30820): appName = 宜宾黑烟抓拍
// I/flutter (30820): packageName = com.flutter.hyzp_ybqx
// I/flutter (30820): version = 1.3.1
// I/flutter (30820): buildNumber = 20210508
// I/flutter (30820): buildDate = 2021.05.08
//Fluttertoast.showToast(msg: '当前版本 v$version。暂无更新', gravity: ToastGravity.CENTER);
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) => MyUpdated(ver: version, date: buildDate, theContext: context)));
MyUpdatedNew m = await MyUpdatedNew(
ver: version,
date: buildDate,
theContext: context,
bStartUpdated: true,
bShowNoNewVersion: true);
});
}
Future _getTotalSizeOfFilesInDir(final FileSystemEntity file) async {
if (file is File) {
int length = await file.length();
return double.parse(length.toString());
}
if (file is Directory) {
final List children = file.listSync();
double total = 0;
if (children != null)
for (final FileSystemEntity child in children)
total += await _getTotalSizeOfFilesInDir(child);
return total;
}
return 0;
}
OnTap_FaceLogin() async {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => FaceLogin()));
}
OnTap_FaceReg() async {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => FaceReg()));
}
OnTap_modify_password() {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ModifyPassword()));
}
OnTap_personal_data() {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => PersonalData()));
}
OnTap_MyFeedback() {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => MyFeedback()));
}
OnTap_UserAuthority() async {
//1、根据用户ID获取用户所属角色(用户组)
//getUserAccess(user_id: 136);
//2.2、获取后台用户全部角色分组数据
//I/flutter (15540): g_userInfo.userGroupIDlist = [32, 33]
// g_userInfo.userRulesMap.clear();
// //getUserGroup(group_id: 27);
// getUserGroupAll(user_id: 136);
//
// Future.delayed(const Duration(milliseconds: 3500), () {
// print('g_userInfo.userRulesMap = ${g_userInfo.userRulesMap.toString()}');
// });
//I/flutter (15540): g_userInfo.userRulesMap = {32: [1968, 1972, 1973, 1969, 1976, 1977, 2008, 2009, 2011, 2014, 2015, 2018, 2029, 2030, 2031, 2054, 2055, 2035, 2036, 2037, 204
// 1, 2042, 2043, 2047, 2048, 2049, 2053, 1970, 1980, 1981, 1971, 1984, 1985, 1992, 1993, 2000, 2001, 2020, 2022], 33: [1968, 1972, 1973, 1969, 1976, 1977, 2008, 2009, 2011, 201
// 4, 2015, 2018, 2029, 2030, 2031, 2054, 2055, 2035, 2036, 2037, 2041, 2042, 2043, 2047, 2048, 2049, 2053, 1970, 1980, 1981, 1971, 1984, 1985, 1992, 1993, 2000, 2001, 2019, 202
// 0, 2022]}
// getUserGroup(group_id: g_userInfo.userGroupIDlist[0]);
// print('g_userInfo.userRulesMap = ${g_userInfo.userRulesMap.toString()}');
//I/flutter (15540): g_userInfo.userRulesMap = {32: [1968, 1972, 1973, 1969, 1976, 1977, 2008, 2009, 2011,
// 2014, 2015, 2018, 2029, 2030, 2031, 2054, 2055, 2035, 2036, 2037, 2041, 2042, 2043, 2047,
// 2048, 2049, 2053, 1970, 1980, 1981, 1971, 1984, 1985, 1992, 1993, 2000, 2001, 2020, 2022]}
// g_userInfo.userRulesMap.clear();
// getUserGroupAll();
// print('g_userInfo.userGroupIDlist = ${g_userInfo.userGroupIDlist}');
// print('g_userInfo.userGroupIDlist[0] = ${g_userInfo.userGroupIDlist[0]}');
// getUserGroup(group_id: g_userInfo.userGroupIDlist[0]);
//I/flutter (15540): g_userInfo.userGroupIDlist = [31, 27]
//getUserGroup(group_id: g_userInfo.userGroupIDlist[1]);
///3、获取后台全部 (All) 用户角色分组分页列表数据
// getRecordList(api: ServicePath.getUserGroupListUrl).then((map) {
// mapUserGroupList = map;
// });
//I/flutter ( 1422): http://125.64.218.67:9904/?s=App.User_User.GetGroupList
// I/flutter ( 1422): 开始处理登录请求...
// I/flutter ( 1422): response = {"ret":200,"data":{"items":[{"id":35,"jgid":2,"type":0,"title":"局领导","level":0,"pid":0,"sort":1,"status":1,"rules":""},{"id":34,"jgid":2,"typ
// e":0,"title":"系统管理","level":0,"pid":0,"sort":1,"status":1,"rules":""},{"id":33,"jgid":2,"type":1,"title":"参观者","level":0,"pid":0,"sort":4,"status":1,"rules":"1968,1972
// ,1973,1969,1976,1977,2008,2009,2011,2014,2015,2018,2029,2030,2031,2054,2055,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,200
// 1,2019,2020,2022"},{"id":32,"jgid":2,"type":0,"title":"演示账户","level":0,"pid":0,"sort":3,"status":1,"rules":"1968,1972,1973,1969,1976,1977,2008,2009,2011,2014,2015,2018,20
// 29,2030,2031,2054,2055,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,2001,2020,2022"},{"id":31,"jgid":2,"type":0,"title":"监
// 控室","level":0,"pid":0,"sort":2,"status":1,"rules":""},{"id":30,"jgid":2,"type":0,"title":"中心领导","level":0,"pid":0,"sort":1,"status":1,"rules":"196
// I/flutter ( 1422): mapRecordList['mapRecordListRet'] = {ret: 200, data: {items: [{id: 35, jgid: 2, type: 0, title: 局领导, level: 0, pid: 0, sort: 1, status: 1, rules: }, {id
// : 34, jgid: 2, type: 0, title: 系统管理, level: 0, pid: 0, sort: 1, status: 1, rules: }, {id: 33, jgid: 2, type: 1, title: 参观者, level: 0, pid: 0, sort: 4, status: 1, rules
// : 1968,1972,1973,1969,1976,1977,2008,2009,2011,2014,2015,2018,2029,2030,2031,2054,2055,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,19
// 93,2000,2001,2019,2020,2022}, {id: 32, jgid: 2, type: 0, title: 演示账户, level: 0, pid: 0, sort: 3, status: 1, rules: 1968,1972,1973,1969,1976,1977,2008,2009,2011,2014,2015,
// 2018,2029,2030,2031,2054,2055,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,2001,2020,2022}, {id: 31, jgid: 2, type: 0, title
// : 监控室, level: 0, pid: 0, sort: 2, status: 1, rules: }, {id: 30, jgid: 2, type: 0, title: 中心领导, level: 0, pid: 0, sort: 1, status: 1, rules: 1968
// I/flutter ( 1422): mapRecordList['listRecordList'] = []
// I/flutter ( 1422): _list1 = [{id: 35, jgid: 2, type: 0, title: 局领导, level: 0, pid: 0, sort: 1, status: 1, rules: }, {id: 34, jgid: 2, type: 0, title: 系统管理, level: 0, p
// id: 0, sort: 1, status: 1, rules: }, {id: 33, jgid: 2, type: 1, title: 参观者, level: 0, pid: 0, sort: 4, status: 1, rules: 1968,1972,1973,1969,1976,1977,2008,2009,2011,2014,
// 2015,2018,2029,2030,2031,2054,2055,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,2001,2019,2020,2022}, {id: 32, jgid: 2, type
// : 0, title: 演示账户, level: 0, pid: 0, sort: 3, status: 1, rules: 1968,1972,1973,1969,1976,1977,2008,2009,2011,2014,2015,2018,2029,2030,2031,2054,2055,2035,2036,2037,2041,20
// 42,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,2001,2020,2022}, {id: 31, jgid: 2, type: 0, title: 监控室, level: 0, pid: 0, sort: 2, status: 1, rule
// s: }, {id: 30, jgid: 2, type: 0, title: 中心领导, level: 0, pid: 0, sort: 1, status: 1, rules: 1968,1972,1973,1974,1975,1969,1976,1977,1978,1979,1970,1
// I/flutter ( 1422): mapRecordList['listRecordList'] = [{id: 35, jgid: 2, type: 0, title: 局领导, level: 0, pid: 0, sort: 1, status: 1, rules: }, {id: 34, jgid: 2, type: 0, tit
// le: 系统管理, level: 0, pid: 0, sort: 1, status: 1, rules: }, {id: 33, jgid: 2, type: 1, title: 参观者, level: 0, pid: 0, sort: 4, status: 1, rules: 1968,1972,1973,1969,1976,
// 1977,2008,2009,2011,2014,2015,2018,2029,2030,2031,2054,2055,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,2001,2019,2020,2022
// }, {id: 32, jgid: 2, type: 0, title: 演示账户, level: 0, pid: 0, sort: 3, status: 1, rules: 1968,1972,1973,1969,1976,1977,2008,2009,2011,2014,2015,2018,2029,2030,2031,2054,20
// 55,2035,2036,2037,2041,2042,2043,2047,2048,2049,2053,1970,1980,1981,1971,1984,1985,1992,1993,2000,2001,2020,2022}, {id: 31, jgid: 2, type: 0, title: 监控室, level: 0, pid: 0,
// sort: 2, status: 1, rules: }, {id: 30, jgid: 2, type: 0, title: 中心领导, level: 0, pid: 0, sort: 1, status: 1, rules: 1968,1972,1973,1974,1975,1969,1
// I/flutter ( 1422): map['page'] = 1
// I/flutter ( 1422): _counter = 8
// I/flutter ( 1422): _total = 8
///5、获取后台功能分类分页列表数据
// getRecordList(api: ServicePath.getUserAuthListUrl).then((map) {
// mapUserAuthList = map;
// });
//I/flutter ( 3512): http://125.64.218.67:9904/?s=App.User_User.GetAuthList
// I/flutter ( 3512): 开始处理登录请求...
// I/flutter ( 3512): response = {"ret":200,"data":{"items":[{"id":2069,"jgid":2,"level":2,"pid":2067,"name":"blacksmoke2/b2tj/fenxicll/fenxi","title":"分析","type":1,"status":1
// ,"condition":"","sort":9},{"id":2068,"jgid":2,"level":2,"pid":2067,"name":"blacksmoke2/b2tj/fenxicll/view","title":"查看","type":1,"status":1,"condition":"","sort":0},{"id":2
// 067,"jgid":2,"level":1,"pid":2029,"name":"blacksmoke2/b2tj/fenxicll","title":"车流量统计","type":1,"status":1,"condition":"","sort":7},{"id":2066,"jgid":2,"level":2,"pid":206
// 4,"name":"blacksmoke2/b2tj/dwinfoview/fenxi","title":"分析","type":1,"status":1,"condition":"","sort":9},{"id":2065,"jgid":2,"level":2,"pid":2064,"name":"blacksmoke2/b2tj/dwi
// nfoview/view","title":"查看","type":1,"status":1,"condition":"","sort":0},{"id":2064,"jgid":2,"level":1,"pid":2029,"name":"blacksmoke2/b2tj/dwinfoview","title":"监测点位状态
// 详情","type":1,"status":1,"condition":"","sort":6},{"id":2063,"jgid":2,"level":2,"pid":2061,"name":"blacksmoke2/b2tj/dwinfo/fenxi","title":"分析","typ
// I/flutter ( 3512): mapRecordList['mapRecordListRet'] = {ret: 200, data: {items: [{id: 2069, jgid: 2, level: 2, pid: 2067, name: blacksmoke2/b2tj/fenxicll/fenxi, title: 分析,
// type: 1, status: 1, condition: , sort: 9}, {id: 2068, jgid: 2, level: 2, pid: 2067, name: blacksmoke2/b2tj/fenxicll/view, title: 查看, type: 1, status: 1, condition: , sort:
// 0}, {id: 2067, jgid: 2, level: 1, pid: 2029, name: blacksmoke2/b2tj/fenxicll, title: 车流量统计, type: 1, status: 1, condition: , sort: 7}, {id: 2066, jgid: 2, level: 2, pid:
// 2064, name: blacksmoke2/b2tj/dwinfoview/fenxi, title: 分析, type: 1, status: 1, condition: , sort: 9}, {id: 2065, jgid: 2, level: 2, pid: 2064, name: blacksmoke2/b2tj/dwinfo
// view/view, title: 查看, type: 1, status: 1, condition: , sort: 0}, {id: 2064, jgid: 2, level: 1, pid: 2029, name: blacksmoke2/b2tj/dwinfoview, title: 监测点位状态详情, type:
// 1, status: 1, condition: , sort: 6}, {id: 2063, jgid: 2, level: 2, pid: 2061, name: blacksmoke2/b2tj/dwinfo/fenxi, title: 分析, type: 1, status: 1, c
// I/flutter ( 3512): map['page'] = 1
// I/flutter ( 3512): _counter = 20
// I/flutter ( 3512): _total = 78
// I/flutter ( 3512): 第 1 次网络请求过程正常完成
// I/flutter ( 3512): response = {"ret":200,"data":{"items":[{"id":2042,"jgid":2,"level":1,"pid":2029,"name":"blacksmoke2/b2tj/fenxicartime","title":"车辆轨迹查询","type":1,"sta
// tus":1,"condition":"","sort":3},{"id":2041,"jgid":2,"level":2,"pid":2036,"name":"blacksmoke2/b2tj/fenxicar/fenxi","title":"分析","type":1,"status":1,"condition":"","sort":9},
// {"id":2037,"jgid":2,"level":2,"pid":2036,"name":"blacksmoke2/b2tj/fenxicar/view","title":"查看","type":1,"status":1,"condition":"","sort":0},{"id":2036,"jgid":2,"level":1,"pi
// d":2029,"name":"blacksmoke2/b2tj/fenxicar","title":"车辆点位频率分析","type":1,"status":1,"condition":"","sort":2},{"id":2035,"jgid":2,"level":2,"pid":2030,"name":"blacksmoke
// 2/b2tj/fenxi","title":"分析","type":1,"status":1,"condition":"","sort":9},{"id":2034,"jgid":2,"level":2,"pid":2030,"name":"blacksmoke2/b2tj/outxls","title":"导出","type":1,"s
// tatus":1,"condition":"","sort":7},{"id":2031,"jgid":2,"level":2,"pid":2030,"name":"blacksmoke2/b2tj/view","title":"查看","type":1,"status":1,"condit
// I/flutter ( 3512): mapRecordList['mapRecordListRet'] = {ret: 200, data: {items: [{id: 2042, jgid: 2, level: 1, pid: 2029, name: blacksmoke2/b2tj/fenxicartime, title: 车辆轨迹
// 查询, type: 1, status: 1, condition: , sort: 3}, {id: 2041, jgid: 2, level: 2, pid: 2036, name: blacksmoke2/b2tj/fenxicar/fenxi, title: 分析, type: 1, status: 1, condition: ,
// sort: 9}, {id: 2037, jgid: 2, level: 2, pid: 2036, name: blacksmoke2/b2tj/fenxicar/view, title: 查看, type: 1, status: 1, condition: , sort: 0}, {id: 2036, jgid: 2, level: 1
// , pid: 2029, name: blacksmoke2/b2tj/fenxicar, title: 车辆点位频率分析, type: 1, status: 1, condition: , sort: 2}, {id: 2035, jgid: 2, level: 2, pid: 2030, name: blacksmoke2/b
// 2tj/fenxi, title: 分析, type: 1, status: 1, condition: , sort: 9}, {id: 2034, jgid: 2, level: 2, pid: 2030, name: blacksmoke2/b2tj/outxls, title: 导出, type: 1, status: 1, co
// ndition: , sort: 7}, {id: 2031, jgid: 2, level: 2, pid: 2030, name: blacksmoke2/b2tj/view, title: 查看, type: 1, status: 1, condition: , sort: 0}, {
// I/flutter ( 3512): map['page'] = 2
// I/flutter ( 3512): _counter = 40
// I/flutter ( 3512): _total = 78
// I/flutter ( 3512): 第 2 次网络请求过程正常完成
// I/flutter ( 3512): response = {"ret":200,"data":{"items":[{"id":2008,"jgid":2,"level":1,"pid":1969,"name":"blacksmoke2/b2yjfsls/index","title":"历史数据","type":1,"status":1,
// "condition":"","sort":2},{"id":2007,"jgid":2,"level":2,"pid":2000,"name":"blacksmoke2/b2dwinfo/inxls","title":"导入","type":1,"status":1,"condition":"","sort":8},{"id":2006,"
// jgid":2,"level":2,"pid":2000,"name":"blacksmoke2/b2dwinfo/outxls","title":"导出","type":1,"status":1,"condition":"","sort":7},{"id":2005,"jgid":2,"level":2,"pid":2000,"name":
// "blacksmoke2/b2dwinfo/del","title":"删除","type":1,"status":1,"condition":"","sort":4},{"id":2004,"jgid":2,"level":2,"pid":2000,"name":"blacksmoke2/b2dwinfo/lock","title":"锁
// 定","type":1,"status":1,"condition":"","sort":3},{"id":2003,"jgid":2,"level":2,"pid":2000,"name":"blacksmoke2/b2dwinfo/edit","title":"编辑","type":1,"status":1,"condition":""
// ,"sort":2},{"id":2002,"jgid":2,"level":2,"pid":2000,"name":"blacksmoke2/b2dwinfo/add","title":"新增","type":1,"status":1,"condition":"","sort":1},{"id":2001
// I/flutter ( 3512): mapRecordList['mapRecordListRet'] = {ret: 200, data: {items: [{id: 2008, jgid: 2, level: 1, pid: 1969, name: blacksmoke2/b2yjfsls/index, title: 历史数据, t
// ype: 1, status: 1, condition: , sort: 2}, {id: 2007, jgid: 2, level: 2, pid: 2000, name: blacksmoke2/b2dwinfo/inxls, title: 导入, type: 1, status: 1, condition: , sort: 8}, {
// id: 2006, jgid: 2, level: 2, pid: 2000, name: blacksmoke2/b2dwinfo/outxls, title: 导出, type: 1, status: 1, condition: , sort: 7}, {id: 2005, jgid: 2, level: 2, pid: 2000, na
// me: blacksmoke2/b2dwinfo/del, title: 删除, type: 1, status: 1, condition: , sort: 4}, {id: 2004, jgid: 2, level: 2, pid: 2000, name: blacksmoke2/b2dwinfo/lock, title: 锁定, t
// ype: 1, status: 1, condition: , sort: 3}, {id: 2003, jgid: 2, level: 2, pid: 2000, name: blacksmoke2/b2dwinfo/edit, title: 编辑, type: 1, status: 1, condition: , sort: 2}, {i
// d: 2002, jgid: 2, level: 2, pid: 2000, name: blacksmoke2/b2dwinfo/add, title: 新增, type: 1, status: 1, condition: , sort: 1}, {id: 2001, jgid: 2, level: 2,
// I/flutter ( 3512): map['page'] = 3
// I/flutter ( 3512): _counter = 60
// I/flutter ( 3512): _total = 78
// I/flutter ( 3512): 第 3 次网络请求过程正常完成
// I/flutter ( 3512): response = {"ret":200,"data":{"items":[{"id":1988,"jgid":2,"level":2,"pid":1984,"name":"blacksmoke2/b2ledxs/lock","title":"锁定","type":1,"status":1,"condi
// tion":"","sort":3},{"id":1987,"jgid":2,"level":2,"pid":1984,"name":"blacksmoke2/b2ledxs/edit","title":"编辑","type":1,"status":1,"condition":"","sort":2},{"id":1986,"jgid":2,
// "level":2,"pid":1984,"name":"blacksmoke2/b2ledxs/add","title":"新增","type":1,"status":1,"condition":"","sort":1},{"id":1985,"jgid":2,"level":2,"pid":1984,"name":"blacksmoke2
// /b2ledxs/view","title":"查看","type":1,"status":1,"condition":"","sort":0},{"id":1984,"jgid":2,"level":1,"pid":1971,"name":"blacksmoke2/b2ledxs/index","title":"LED显示设置","
// type":1,"status":1,"condition":"","sort":1},{"id":1983,"jgid":2,"level":2,"pid":1980,"name":"blacksmoke2/b2ts/shenhe","title":"审核","type":1,"status":1,"condition":"","sort"
// :5},{"id":1981,"jgid":2,"level":2,"pid":1980,"name":"blacksmoke2/b2ts/view","title":"查看","type":1,"status":1,"condition":"","sort":0},{"id":1980,"jgid":2,
// I/flutter ( 3512): mapRecordList['mapRecordListRet'] = {ret: 200, data: {items: [{id: 1988, jgid: 2, level: 2, pid: 1984, name: blacksmoke2/b2ledxs/lock, title: 锁定, type: 1
// , status: 1, condition: , sort: 3}, {id: 1987, jgid: 2, level: 2, pid: 1984, name: blacksmoke2/b2ledxs/edit, title: 编辑, type: 1, status: 1, condition: , sort: 2}, {id: 1986
// , jgid: 2, level: 2, pid: 1984, name: blacksmoke2/b2ledxs/add, title: 新增, type: 1, status: 1, condition: , sort: 1}, {id: 1985, jgid: 2, level: 2, pid: 1984, name: blacksmo
// ke2/b2ledxs/view, title: 查看, type: 1, status: 1, condition: , sort: 0}, {id: 1984, jgid: 2, level: 1, pid: 1971, name: blacksmoke2/b2ledxs/index, title: LED显示设置, type:
// 1, status: 1, condition: , sort: 1}, {id: 1983, jgid: 2, level: 2, pid: 1980, name: blacksmoke2/b2ts/shenhe, title: 审核, type: 1, status: 1, condition: , sort: 5}, {id: 1981
// , jgid: 2, level: 2, pid: 1980, name: blacksmoke2/b2ts/view, title: 查看, type: 1, status: 1, condition: , sort: 0}, {id: 1980, jgid: 2, level: 1, pid: 1970
// I/flutter ( 3512): map['page'] = 4
// I/flutter ( 3512): _counter = 78
// I/flutter ( 3512): _total = 78
///6、获取后台功能分类分页列表数据,然后获取用户功能权限索引map,便于直观理解和处理
// getRecordList(api: ServicePath.getUserAuthListUrl).then((map) {
// mapUserAuthList = map;
// getUserAuth();
// });
///7、获取后台功能分类分页列表数据,然后获取用户功能路径索引map,便于直观理解和处理
// getRecordList(api: ServicePath.getUserAuthListUrl).then((map) {
// mapUserAuthList = map;
// getUserAuthMap(value: 'name');
// });
///8、测试新的视频地址 rtsp://125.64.218.67:9901/rtp/gb_play_34020000001320013016_34020000001320013016
// urlnew = 'rtsp://125.64.218.67:9901/rtp/gb_play_34020000001320013016_34020000001320013016';
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) => PlayerPro(
// url: urlnew,
// title: '点位视频测试',
// )));
///9、测试新的视频地址 rtmp://125.64.218.67:9901/rtp/gb_play_34020000001320013016_34020000001320013016
// urlnew = 'rtmp://125.64.218.67:9901/rtp/gb_play_34020000001320013016_34020000001320013016';
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) => PlayerPro(
// url: urlnew,
// title: '点位视频测试',
// )));
// getRecordList(api: ServicePath.getUserAuthListUrl).then((map) {
// mapUserAuthList = map;
// // var _jsonStr = json.encode(getUserAuthMap(value: 'name'));
// // List _list = json.decode(_jsonStr);
//
// Map<String, dynamic> map1 = {"name": "AllenSu", "area": "郑州", "sex": "男", "age": 18};
// String _jsonStr = json.encode(map1);
// //print('_jsonStr = $_jsonStr');
// //List _list = json.decode(_jsonStr);
// // Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>'
// Map map2 = json.decode(_jsonStr);
// //print('_list = ${_list}');
//
// String str = json_print(map2, 1);
// List list = ['test', 'dsaf', 'swer'];
// //segmentPrint(str);
// //print('_jsonStr = ${json_print(map2, 1)}');
//
// print('str = ${str}');
// my_segmentPrint(str);
//
// });
}
Future<Null> loadCache() async {
Directory tempDir = await getTemporaryDirectory();
double value = await _getTotalSizeOfFilesInDir(tempDir);
print('临时目录大小: ' + value.toString());
//清除缓存
delDir(tempDir);
}
//递归方式删除目录
Future<Null> delDir(FileSystemEntity file) async {
if (file is Directory) {
final List<FileSystemEntity> children = file.listSync();
for (final FileSystemEntity child in children) {
await delDir(child);
}
}
await file.delete();
}
OnTap_ClearCache() async {
Directory tempDir = await getTemporaryDirectory();
print('tempDir: ' + tempDir.path);
double SizeOfFiles = await _getTotalSizeOfFilesInDir(tempDir) / 1000000;
print('临时目录大小: ${SizeOfFiles.toString()} MB');
bool ret = await showDialog(
context: context,
builder: (context) {
myController.text = '';
return CustomDialogF(
title: "选择操作",
content: '缓存大小:${SizeOfFiles.toString()} MB,是否清除',
);
});
print('ret: $ret');
if (ret) {
print('清除缓存...');
//清除内存
PaintingBinding.instance.imageCache.clear();
//清除缓存
delDir(tempDir);
//清空SharedPreferences
Storage.clear();
}
}
}
+66
View File
@@ -0,0 +1,66 @@
import 'package:flutter/material.dart';
import '../../custom_icons/icons_data.dart';
import '../../custom_icons/icons_name.dart';
class DetailsPage extends StatelessWidget {
final String arguments; //id of icon
DetailsPage({Key key, this.arguments = 'text'}) : super(key: key);
@override
Widget build(BuildContext context) {
String s = '图标ID :$arguments' + '\n图标名称:' + iconNameList[int.parse(arguments)];
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
print('返回上一页');
Navigator.pop(context);
},
),
title: Text('联系人详情页'),
),
body: FutureBuilder(
future: null,
builder: (context, snapshot) {
if (snapshot.hasData) {
return Stack(
children: <Widget>[
ListView(
children: <Widget>[
Text(arguments),
],
),
Positioned(
bottom: 0,
left: 0,
child: null,
)
],
);
} else {
//return Text('加载中........');
return Container(
alignment: Alignment(0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
iconList[int.parse(arguments)],
size: 200,
color: Colors.black,
),
SizedBox(height: 10,),
Text(s),
],
),
);
}
},
),
);
}
}