Fix For iOS

iOS
mlch911 4 years ago
parent a95036f8cf
commit bb932e34cb

@ -176,7 +176,7 @@ class UserInfo {
}; };
//list[i]''aes decode error:RangeError: Value not in range: -16 //list[i]''aes decode error:RangeError: Value not in range: -16
String thisAndroidId = ''; // String thisDeviceId = ''; //
String username = ''; String username = '';
String password = ''; String password = '';
String userLoginInfo = ''; String userLoginInfo = '';
@ -184,7 +184,7 @@ class UserInfo {
Map userRulesMap = {}; // Map userRulesMap = {}; //
String getUserinfoEncrypted2() { String getUserinfoEncrypted2() {
String userinfoEncrypted1 = EncryptUtil.aesEncode(thisAndroidId) + String userinfoEncrypted1 = EncryptUtil.aesEncode(thisDeviceId) +
'\n' + '\n' +
EncryptUtil.aesEncode(username) + EncryptUtil.aesEncode(username) +
'\n' + '\n' +

@ -273,12 +273,16 @@ Future<Map> getMapFromJson(var response) async {
// ); // );
// } // }
Future<String> getAndroidId() async { Future<String> getDeviceId() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; if (Platform.isAndroid) {
//print('每个手机唯一的设备号:${androidInfo.androidId}'); // e.g. "Moto G (4)" AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
g_userInfo.thisAndroidId = androidInfo.androidId; return androidInfo.androidId;
return g_userInfo.thisAndroidId; } else if (Platform.isIOS) {
return (await deviceInfo.iosInfo).identifierForVendor;
}
assert(false, 'Unsupported Platform');
return '';
} }
// void playOrPause() { // void playOrPause() {

@ -19,22 +19,24 @@ checkPermission() {
//Flutter App03 //Flutter App03
bool ret = await getPermission(); bool ret = await getPermission();
if (ret) { if (ret) {
//Flutter App04 var app = runApp(MaterialApp(
getSDCardDir().then((value) { debugShowCheckedModeBanner: false,
//Flutter App05 theme: new ThemeData(
//runApp(MyApp()); brightness: Brightness.light,
runApp(MaterialApp( backgroundColor: Colors.white,
//title: '启动图demo', platform: TargetPlatform.android),
debugShowCheckedModeBanner: false, home: new SplashScreen(),
theme: new ThemeData( routes: <String, WidgetBuilder>{
brightness: Brightness.light, '/home': (BuildContext context) => MyApp()
backgroundColor: Colors.white, },
platform: TargetPlatform.android), ));
home: new SplashScreen(), //Flutter App06 if (Platform.isAndroid) {
//Flutter App07 getSDCardDir().then((value) {
routes: <String, WidgetBuilder>{'/home': (BuildContext context) => MyApp()}, app;
)); });
}); } else if (Platform.isIOS) {
app;
}
} else { } else {
Fluttertoast.showToast(msg: '用户未授权,程序无法正常运行!', gravity: ToastGravity.CENTER); Fluttertoast.showToast(msg: '用户未授权,程序无法正常运行!', gravity: ToastGravity.CENTER);
SystemChannels.platform.invokeMethod('SystemNavigator.pop'); SystemChannels.platform.invokeMethod('SystemNavigator.pop');

@ -29,32 +29,13 @@ void main() {
WidgetsFlutterBinding.ensureInitialized(); // WidgetsFlutterBinding.ensureInitialized(); //
//Flutter //Flutter
SystemChrome.setPreferredOrientations([ SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp, // portrait DeviceOrientation.portraitUp,
// DeviceOrientation.portraitDown, // 180
// DeviceOrientation.landscapeLeft, //90
// DeviceOrientation.landscapeRight, //90
]).then((_) { ]).then((_) {
//Flutter App02 //Flutter App02
checkPermission(); // checkPermission(); //
}); });
} }
// class LoadMyApp extends StatefulWidget {
// LoadMyApp({Key key}) : super(key: key);
//
// _LoadMyAppState createState() => _LoadMyAppState();
// }
//
// class _LoadMyAppState extends State<LoadMyApp> {
// @override
// Widget build(BuildContext context) {
// return new MaterialApp(
// //title: "LoadActivity",
// home: MyApp(),
// );
// }
// }
//Flutter App07Flutter App //Flutter App07Flutter App
class MyApp extends StatefulWidget { class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key); MyApp({Key key}) : super(key: key);
@ -81,28 +62,19 @@ class _MyAppState extends State<MyApp> {
print('version = $version'); print('version = $version');
print('buildNumber = $buildNumber'); print('buildNumber = $buildNumber');
print('buildDate = $buildDate'); 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( await MyUpdatedNew(
ver: version, date: buildDate, theContext: context, bStartUpdated: true); ver: version,
date: buildDate,
theContext: context,
bStartUpdated: true);
}); });
super.initState(); super.initState();
} }
void initApp() async { void initApp() async {
// await getFileName2().then((value) { getDeviceId().then((value) {
// readUrlFile2().then((value) => writeUrlFile2()); g_userInfo.thisDeviceId = value;
// });
getAndroidId().then((value) {
g_userInfo.thisAndroidId = value;
// sdk // sdk
if (Platform.isIOS) { if (Platform.isIOS) {
@ -122,22 +94,6 @@ class _MyAppState extends State<MyApp> {
eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新')); eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
} }
//@override
// Widget build(BuildContext context) {
// return ScreenUtilInit(
// designSize: Size(360, 690),
// allowFontScaling: false,
// builder: () => MaterialApp(
// debugShowCheckedModeBanner: false,
// title: 'Flutter_ScreenUtil',
// theme: ThemeData(
// primarySwatch: Colors.blue,
// ),
// home: HomePage(title: 'FlutterScreenUtil Demo'),
// ),
// );
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
//ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); //ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context);
@ -184,28 +140,6 @@ class _MyAppState extends State<MyApp> {
), ),
), ),
); );
// return MultiProvider(
// providers: [
// // ChangeNotifierProvider(builder: (_) => Counter()),
// // ChangeNotifierProvider(builder: (_) => Cart()),
// // ChangeNotifierProvider(builder: (_) => CheckOut()),
// // ChangeNotifierProvider(builder: (_) => PlayerRegionProvide()),
// // ChangeNotifierProvider(builder: (_) => PlayerRatioProvide()),
// ChangeNotifierProvider<PlayerRegionProvide>(create: (context) => PlayerRegionProvide()),
// ChangeNotifierProvider<PlayerRatioProvide>(create: (context) => PlayerRatioProvide()),
// ],
//
// child: MaterialApp(
// home: LoginTabs(),
// debugShowCheckedModeBanner: false,
// initialRoute: '/',
// onGenerateRoute: onGenerateRoute,
// theme: ThemeData(
// // primaryColor: Colors.yellow
// primaryColor: Colors.white),
// ),
// );
} }
} }
@ -235,18 +169,6 @@ class _SplashScreenState extends State<SplashScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// return new Scaffold(
// body: new Center(
// child: new Image.asset('assets/images/hyzp_yibin_launche.png', fit: BoxFit.fill),
// // child: new Image.asset('assets/images/hyzp_ybqx01_cuiping_launche.png'),
// ),
// );
// return Container(
// width: MediaQuery.of(context).size.width, //
// height: MediaQuery.of(context).size.height, //
// child: Image.asset('assets/images/hyzp_yibin_launche.png', fit: BoxFit.cover),
// );
//final double statusBarHeight = MediaQuery.of(context).padding.top;
return Scaffold( return Scaffold(
body: Column( body: Column(
children: <Widget>[ children: <Widget>[

@ -129,12 +129,7 @@ class _LoginPageState extends State<FaceLogin2> {
), ),
), ),
), ),
onTap: () { onTap: faceLogin,
if (!bMayLogin) {
return;
}
Navigator.pushNamed(context, '/faceLogin_take_pictuer', arguments: 'FaceLogin');
},
), ),
SizedBox(height: ScreenUtil().setHeight(40)), SizedBox(height: ScreenUtil().setHeight(40)),
Container( Container(
@ -150,12 +145,7 @@ class _LoginPageState extends State<FaceLogin2> {
), ),
SizedBox(height: ScreenUtil().setHeight(20)), SizedBox(height: ScreenUtil().setHeight(20)),
InkWell( InkWell(
onTap: () { onTap: faceLogin,
if (!bMayLogin) {
return;
}
Navigator.pushNamed(context, '/faceLogin_take_pictuer', arguments: 'FaceLogin');
},
child: Container( child: Container(
alignment: Alignment(0, 0), alignment: Alignment(0, 0),
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
@ -170,19 +160,6 @@ class _LoginPageState extends State<FaceLogin2> {
), ),
), ),
), ),
// JdButton(
// height: 126,
// //JdText使ScreenUtil().setHeight(126) ScreenUtil().setHeight(126)
// width: 999,
// text: "开始检测",
// color: Color.fromRGBO(23, 176, 91, 1),
// onTop: () {
// if (!bMayLogin) {
// return;
// }
// Navigator.pushNamed(context, '/faceLogin_take_pictuer', arguments: 'FaceLogin');
// },
// ),
], ],
), ),
), ),
@ -237,4 +214,11 @@ class _LoginPageState extends State<FaceLogin2> {
], ],
); );
} }
faceLogin() async {
if (!bMayLogin) {
return;
}
Navigator.pushNamed(context, '/faceLogin_take_pictuer', arguments: 'FaceLogin');
}
} }

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -37,7 +39,7 @@ class LoginTabs2State extends State<LoginTabs2> {
Container( Container(
height: ScreenUtil().screenHeight - height: ScreenUtil().screenHeight -
ScreenUtil().statusBarHeight - ScreenUtil().statusBarHeight -
ScreenUtil().bottomBarHeight, (Platform.isAndroid ? ScreenUtil().bottomBarHeight : 0),
width: ScreenUtil().screenWidth, width: ScreenUtil().screenWidth,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
@ -54,15 +56,21 @@ class LoginTabs2State extends State<LoginTabs2> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: (() {
IconButton( if (Platform.isAndroid) {
onPressed: () { return [
//Navigator.pop(context); IconButton(
SystemNavigator.pop(); //退App onPressed: () {
}, //Navigator.pop(context);
icon: const Icon(Icons.close, color: Colors.white), SystemNavigator.pop(); //退App
) },
], icon:
const Icon(Icons.close, color: Colors.white),
)
];
}
return <Widget>[];
})(),
), ),
), ),
Center( Center(
@ -113,10 +121,6 @@ class LoginTabs2State extends State<LoginTabs2> {
color: Colors.transparent, color: Colors.transparent,
height: ScreenUtil().setHeight(130), //133 height: ScreenUtil().setHeight(130), //133
child: Text( child: Text(
//'© 宜宾市翠屏生态环境局\n© 四川省踏石科技有限公司 版权所有 \n服务热线187-8467-8300',
//'© 宜宾市翠屏生态环境局\n© 四川省踏石科技有限公司',
//'© 宜宾市翠屏生态环境局 四川省踏石科技 版权所有\n服务热线187-8467-8300',
//'© 宜宾市翠屏生态环境局 版权所有',
copyright_info, copyright_info,
maxLines: 2, maxLines: 2,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -126,48 +130,6 @@ class LoginTabs2State extends State<LoginTabs2> {
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
), ),
//144
// 384
// 36
// 166
// 17
// 1026
// 1573
// 1768
//S75.1Super AMOLED,2560 ×1440(Quad HD)1920*1080
// Wrap(
// runSpacing: 9.0,
// alignment: WrapAlignment.center,
// children: <Widget>[
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Text('${pageData['title']}',
// style: TextStyle(fontSize: 38.0, color: Color.fromRGBO(234, 200, 134, 1)))
// ],
// ),
// //
// ClipRRect(
// borderRadius: BorderRadius.circular(12.5),
// child: Container(
// height: 25.0,
// width: 190.0,
// color: Color.fromRGBO(234, 200, 134, 1),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Text(
// '${pageData['subTitle']}',
// textAlign: TextAlign.center,
// style: TextStyle(color: Color.fromRGBO(113, 80, 24, 1)),
// )
// ])))
// ],
// )
], ],
), ),
), ),

@ -59,25 +59,6 @@ class MyUpdatedNew {
registerCallback({bool first = false}) { registerCallback({bool first = false}) {
//3initState //3initState
/*
D/DownloadWorker( 4745): Update too frequently!!!!, this should be dropped
E/flutter ( 4745): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: NoSuchMethodError: The method 'update' was called on null.
E/flutter ( 4745): Receiver: null
E/flutter ( 4745): Tried calling: update(message: "下载中,请稍后…", progress: 0.0)
E/flutter ( 4745): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
E/flutter ( 4745): #1 MyUpdatedNew._updateDownLoadInfo (package:hyzp_ybqx/pages/MyMsics/05_updated/MyUpdatedNew.dart:251:10)
E/flutter ( 4745): #2 _rootRunUnary (dart:async/zone.dart:1206:13)
E/flutter ( 4745): #3 _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/flutter ( 4745): #4 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7)
E/flutter ( 4745): #5 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
E/flutter ( 4745): #6 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
E/flutter ( 4745): #7 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
E/flutter ( 4745): #8 _StreamController._add (dart:async/stream_controller.dart:682:7)
E/flutter ( 4745): #9 _StreamController.add (dart:async/stream_controller.dart:624:5)
E/flutter ( 4745): #10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter ( 4745):
*/
if (!first) { if (!first) {
// 2-OK // 2-OK
// DownloadWorker( 4745): Update too frequently!!!!, this should be dropped // DownloadWorker( 4745): Update too frequently!!!!, this should be dropped
@ -128,6 +109,8 @@ class MyUpdatedNew {
_showNoNewVersionAppDialog(); _showNoNewVersionAppDialog();
} }
}); });
} else if (Platform.isIOS) {
// TODO: iOS
} }
} }

@ -207,10 +207,6 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
leadColor: _greenColor, leadColor: _greenColor,
onTapFun: OnTap_MyUpdate, onTapFun: OnTap_MyUpdate,
bBadge: bNewVer), bBadge: bNewVer),
_getListTile('软件下载',
leadPath: 'assets/images/download.png',
leadColor: _deepBlueColor,
onTapFun: OnTap_download),
_getListTile('待审提醒', _getListTile('待审提醒',
leadPath: 'assets/images/语音提醒.png', leadPath: 'assets/images/语音提醒.png',
leadColor: _deepGreyColor, leadColor: _deepGreyColor,
@ -229,6 +225,14 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
// leadColor: _deepGreyColor, // leadColor: _deepGreyColor,
// onTapFun: OnTap_UserAuthority), // onTapFun: OnTap_UserAuthority),
]; ];
if (Platform.isAndroid) {
_listViewUser.insert(
3,
_getListTile('软件下载',
leadPath: 'assets/images/download.png',
leadColor: _deepBlueColor,
onTapFun: OnTap_download));
}
} }
//0 1 1 //0 1 1

@ -323,13 +323,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.0" version: "1.5.0"
flutter_inappbrowser:
dependency: "direct main"
description:
name: flutter_inappbrowser
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.2"
flutter_page_indicator: flutter_page_indicator:
dependency: transitive dependency: transitive
description: description:
@ -480,13 +473,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.3"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.7"
nested: nested:
dependency: transitive dependency: transitive
description: description:

@ -89,7 +89,6 @@ dependencies:
flutter_screenutil: ^4.0.3+1 flutter_screenutil: ^4.0.3+1
dio: ^3.0.10 dio: ^3.0.10
shared_preferences: ^0.5.12+4 shared_preferences: ^0.5.12+4
flutter_inappbrowser: ^1.2.1
provider: ^4.3.1 provider: ^4.3.1
event_bus: ^1.1.1 event_bus: ^1.1.1
fluttertoast: ^4.0.1 fluttertoast: ^4.0.1
@ -180,7 +179,7 @@ dependencies:
flutter_echarts: ^1.5.0 flutter_echarts: ^1.5.0
flutter_superplayer: flutter_superplayer:
path: .\lib\my_flutter_superplayer path: ./lib/my_flutter_superplayer
# 二维码生成 https://pub.dev/packages/qr_flutter # 二维码生成 https://pub.dev/packages/qr_flutter
qr_flutter: ^3.2.0 qr_flutter: ^3.2.0

Loading…
Cancel
Save