Commit 5be2fea0b6bffafe2ea439d1ce771a18f9d256c2

Authored by wdn127929
1 parent 7ce04b7a

f

... ... @@ -12,14 +12,14 @@ if (flutterRoot == null) {
}
def flutterVersionCode = "356"
def flutterVersionCode = "358"
if (flutterVersionCode == null) {
flutterVersionCode = '356'
flutterVersionCode = '358'
}
def flutterVersionName = "3.5.6"
def flutterVersionName = "3.5.8"
if (flutterVersionName == null) {
flutterVersionName = '3.5.6'
flutterVersionName = '3.5.8'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
... ... @@ -89,11 +89,11 @@ android {
signingConfig signingConfigs.release
}
debug{
minifyEnabled true
minifyEnabled false
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
// signingConfig signingConfigs.release
}
}
}
... ...
... ... @@ -60,12 +60,13 @@ Future<void> main() async {
// FlutterBugly.postCatchedException(() async {
WidgetsFlutterBinding.ensureInitialized();
// _requestPermissions();
Utils.changeStatusColor();
await App.initSp();
// Utils.changeStatusColor();
// await App.initSp();
// App.setupLocator();
FluroRouter router = FluroRouter();
Routes.configureRoutes(router);
App.router = router;
await App.initSp();
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]).then((_) {
... ... @@ -134,10 +135,7 @@ class MyAppState extends State<MyApp> {
super.initState();
_isFirst();
Utils.changeStatusColor();
// 设置EasyRefresh的默认样式
EasyRefresh.defaultHeader = MaterialHeader();
EasyRefresh.defaultFooter = BallPulseFooter();
// Utils.changeStatusColor();
}
//初始化微信SDK
... ... @@ -156,6 +154,20 @@ class MyAppState extends State<MyApp> {
LogUtil.v("is installed $result");
}
_ontherInit() async {
initDio();
await _initFluwx();
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
// 设置EasyRefresh的默认样式
EasyRefresh.defaultHeader = MaterialHeader();
EasyRefresh.defaultFooter = BallPulseFooter();
_isLogin();
// FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
}
//初始化dio
initDio() {
DioUtil.openDebug();
... ... @@ -164,14 +176,15 @@ class MyAppState extends State<MyApp> {
HttpConfig config = new HttpConfig(
options: options, status: "ret", code: "ret", msg: "msg", data: "data");
DioUtil().setConfig(config);
_initAmap();
}
//第一次打开应用
_isFirst() async {
isFirst = App.sp.getBool("isFirst") ?? true;
if (!isFirst) {
_isLogin();
initDio();
await _ontherInit();
}
}
... ... @@ -180,13 +193,12 @@ class MyAppState extends State<MyApp> {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
userModel.initUser();
isLogin = App.sp.getBool("isLogin") ?? false;
if (isLogin) {
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
}
_initFluwx();
}
_initAmap() async {
await AmapService.instance.init(
iosKey: 'e373581528f8fd901c01dfbda236159e',
androidKey: 'dbced781d0acd36184d5b4b54da7188d');
}
@override
... ...
... ... @@ -68,9 +68,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
// TODO: implement initState
super.initState();
LogUtil.v("home_initState");
// FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
_initAmap();
AzhonAppUpdate.listener(
// () {
// needUpdate = false;
... ... @@ -157,12 +155,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
});
}
_initAmap() async {
await AmapService.instance.init(
iosKey: 'e373581528f8fd901c01dfbda236159e',
androidKey: 'dbced781d0acd36184d5b4b54da7188d');
}
_endTimerSeller() {
if (timerSeller != null) {
timerSeller.cancel();
... ...
... ... @@ -53,7 +53,7 @@ class AccountLoginPageState extends State<AccountLoginPage>
StreamSubscription<BaseWeChatResponse> streamSubscription;
OtherLoginProvider otherLoginProvider;
CreateStoreModel createStoreModel;
@override
void initState() {
... ... @@ -125,8 +125,7 @@ class AccountLoginPageState extends State<AccountLoginPage>
Widget build(BuildContext context) {
otherLoginProvider =
Provider.of<OtherLoginProvider>(context, listen: false);
createStoreModel = Provider.of<CreateStoreModel>(context, listen: false);
final double prefixIconWidth = ScreenUtil().setWidth(24);
return Scaffold(
... ...
import 'dart:io';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bugly/flutter_bugly.dart';
import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/app.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/dialog_util.dart';
... ... @@ -10,6 +20,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class FirstPage extends StatefulWidget {
FirstPage({Key key}) : super(key: key);
... ... @@ -23,7 +34,56 @@ class _FirstPageState extends State<FirstPage> {
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_199095);
// Utils.changeStatusColor(color: MyColours.color_199095);
}
_ontherInit() async {
initDio();
await _initFluwx();
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
// 设置EasyRefresh的默认样式
EasyRefresh.defaultHeader = MaterialHeader();
EasyRefresh.defaultFooter = BallPulseFooter();
App.sp.setBool("isFirst", false);
//进入应用
NavigatorUtil.goLoginPage(context);
FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
}
//初始化微信SDK
_initFluwx() async {
await registerWxApi(
appId: "wx85aa3cdd0f791e65",
doOnAndroid: true,
doOnIOS: true,
universalLink: "https://xt04.colorcun.com/link/OneKey/");
var result = await isWeChatInstalled;
if (result != null && result) {
App.isInstallWx = true;
} else {
App.isInstallWx = false;
}
LogUtil.v("is installed $result");
}
//初始化dio
initDio() {
DioUtil.openDebug();
BaseOptions options = DioUtil.getDefOptions();
options.baseUrl = HttpUrl.server_address;
HttpConfig config = new HttpConfig(
options: options, status: "ret", code: "ret", msg: "msg", data: "data");
DioUtil().setConfig(config);
_initAmap();
}
_initAmap() async {
await AmapService.instance.init(
iosKey: 'e373581528f8fd901c01dfbda236159e',
androidKey: 'dbced781d0acd36184d5b4b54da7188d');
}
@override
... ... @@ -224,10 +284,8 @@ class _FirstPageState extends State<FirstPage> {
textColor: MyColours.color_ffffff,
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
onPressed: () {
App.sp.setBool("isFirst", false);
//进入应用
NavigatorUtil.goLoginPage(context);
onPressed: () async {
_ontherInit();
}),
],
),
... ...
... ... @@ -16,8 +16,16 @@ import 'package:one_key/models/checkbind_phone_model.dart';
import 'package:one_key/models/store_info.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/create_store_model.dart';
import 'package:one_key/provider/customer_making_provider.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/order_food_provider.dart';
import 'package:one_key/provider/other_login_provider.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/provider/upload_img_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigate_service.dart';
... ... @@ -67,8 +75,6 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
// TODO: implement initState
super.initState();
_initFluwx();
// _initFluwx();
isLogin();
... ... @@ -167,18 +173,15 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
NavigatorUtil.goHomePage(context);
});
} else {
_getWxCode();
_checkWechat();
_getWxCode();
}
}
///微信登陆
_wxLogin() async {
await initializeDateFormatting();
sendWeChatAuth(scope: "snsapi_userinfo");
await AmapService.instance.init(
iosKey: 'e373581528f8fd901c01dfbda236159e',
androidKey: 'dbced781d0acd36184d5b4b54da7188d');
}
///获取微信登录code
... ... @@ -264,16 +267,6 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
// }
// }
initDio() {
_checkWechat();
DioUtil.openDebug();
BaseOptions options = DioUtil.getDefOptions();
options.baseUrl = HttpUrl.server_address;
HttpConfig config = new HttpConfig(
options: options, status: "ret", code: "ret", msg: "msg", data: "data");
DioUtil().setConfig(config);
}
/*
苹果登录获取用户信息
*/
... ... @@ -420,510 +413,510 @@ class LoginState extends State<LoginPage> with WidgetsBindingObserver {
final double prefixIconWidth = ScreenUtil().setWidth(24);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
body: Container(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// VEmptyView(218 - App.statusBarHeight),
VEmptyView(80 + App.statusBarHeight),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(
"assets/logo.png",
width: ScreenUtil().setWidth(40 * 2),
height: ScreenUtil().setWidth(40 * 2),
)
],
)),
VEmptyView(120),
Image.asset(
Utils.getImgPath('login_bg'),
),
// Container(
// height: ScreenUtil().setHeight(84),
// width: ScreenUtil().setWidth(611),
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(8))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Image.asset(
// "assets/icon_sellercode.png",
// width: prefixIconWidth,
// ),
// HEmptyView(26),
// Center(
// child: Text(
// "商户编号",
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// )),
// Expanded(
// child: Container(
// height: ScreenUtil().setHeight(84),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(8)),
// child: TextField(
// controller: _sellerCodeController,
// focusNode: _sellerCodeFocusNode,
// // autofocus: _sellerCodeController.text.isEmpty,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28),
// textBaseline: TextBaseline.alphabetic),
// // textAlignVertical: TextAlignVertical.center,
// decoration: InputDecoration(
// hintText: "请输入6位商户编码",
// hintStyle: TextStyle(
// color: MyColours.color_c1c1c1,
// fontSize: ScreenUtil().setSp(28),
// ),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// onChanged: (_) {
// setActivate();
// },
// keyboardType: TextInputType.number,
// )),
// )
// ],
// )),
// Container(
// height: ScreenUtil().setHeight(84),
// width: ScreenUtil().setWidth(611),
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(8))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Image.asset(
// "assets/icon_account.png",
// width: prefixIconWidth,
// ),
// HEmptyView(26),
// Text(
// "工 号",
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// ),
// Expanded(
// child: Container(
// height: ScreenUtil().setHeight(84),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(8)),
// child: TextField(
// controller: _accountController,
// focusNode: _accountFocusNode,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// decoration: InputDecoration(
// hintText: "请输入4位工号",
// hintStyle: TextStyle(
// color: MyColours.color_c1c1c1,
// fontSize: ScreenUtil().setSp(28)),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// onChanged: (_) {
// setActivate();
// },
// keyboardType: TextInputType.number,
// ),
// ))
// ],
// )),
// Container(
// height: ScreenUtil().setHeight(84),
// width: ScreenUtil().setWidth(611),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(27)),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(8))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Image.asset(
// "assets/icon_pwd.png",
// width: prefixIconWidth,
// ),
// HEmptyView(26),
// Text(
// "密 码",
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// ),
// Expanded(
// child: Container(
// height: ScreenUtil().setHeight(84),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(8)),
// child: TextField(
// controller: _pwdController,
// focusNode: _pwdFocusNode,
// // autofocus: _sellerCodeController.text.isNotEmpty &&
// // _accountController.text.isNotEmpty &&
// // _pwdController.text.isEmpty,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// decoration: InputDecoration(
// hintText: "请输入密码",
// hintStyle: TextStyle(
// color: MyColours.color_c1c1c1,
// fontSize: ScreenUtil().setSp(28)),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// onChanged: (_) {
// setActivate();
// },
// obscureText: obscureText,
// keyboardType: TextInputType.text,
// )),
// ),
// GestureDetector(
// child: Padding(
// padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
// child: Image.asset(
// obscureText
// ? "assets/icon_pwd_show.png"
// : "assets/icon_pwd_hide.png",
// width: ScreenUtil().setWidth(35),
// height: ScreenUtil().setHeight(24),
// ),
// ),
// onTap: () {
// setState(() {
// obscureText = !obscureText;
// });
// },
// )
// ],
// )),
// Container(
// width: ScreenUtil().setWidth(611),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)),
// alignment: Alignment.centerLeft,
// child: Text(
// errorText,
// // 'hfhfhf',
// style: TextStyle(
// color: MyColours.color_d93535,
// fontSize: ScreenUtil().setSp(16)),
// ),
// ),
VEmptyView(60),
// Consumer<UserModel>(
// builder:
// (BuildContext context, UserModel value, Widget child) {
// return GestureDetector(
// onTap: () {
// if (!isActivate) return;
// if (!_check) {
// Utils.showToast('请先仔细阅读并同意协议');
// return;
// }
// if (App.sp.containsKey('unionid')) {
// //微信登陆的时候,退出清空数据
// App.sp.remove('openid');
// App.sp.remove("unionid");
// }
// Map<String, String> params = {
// "seller_code": "${_sellerCodeController.text}",
// "alias": "ssahdahgdafgahjkhakjgh",
// "account": "${_accountController.text}",
// "password": "${_pwdController.text}"
// };
// value.login(context, params).then((value) {
// setState(() {
// errorText = value ?? "";
// });
// });
// },
// child: Container(
// height: ScreenUtil().setWidth(84),
// width: ScreenUtil().setWidth(611),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// color: isActivate
// ? MyColours.color_2bb5b7
// : MyColours.color_2bb5b7,
// boxShadow: [
// BoxShadow(
// color: MyColours.color_26000000,
// offset: Offset(0, ScreenUtil().setWidth(4)),
// )
// ],
// borderRadius: BorderRadius.all(
// Radius.circular(ScreenUtil().setWidth(8)))),
// child: Text(
// "登录",
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(34)),
// ),
// ),
// );
// },
// ),
Row(
// mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
backgroundColor: MyColours.color_ffffff,
body: Container(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () {
setState(() {
_check = !_check;
});
if (_check) {
initDio();
}
},
child: Container(
alignment: Alignment.topCenter,
// color: Colors.red,
height: ScreenUtil().setWidth(110),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(30),
left: ScreenUtil().setWidth(102),
bottom: ScreenUtil().setWidth(10)),
child: Image.asset(
_check
? "assets/mine_radio_sel.png"
: "assets/mine_radio_nor.png",
width: ScreenUtil().setWidth(26),
height: ScreenUtil().setWidth(26)),
)),
// HEmptyView(30),
// VEmptyView(218 - App.statusBarHeight),
VEmptyView(80 + App.statusBarHeight),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setWidth(2)),
child: Text(
'已阅读并同意',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_999999),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(
"assets/logo.png",
width: ScreenUtil().setWidth(40 * 2),
height: ScreenUtil().setWidth(40 * 2),
)
],
)),
VEmptyView(120),
Image.asset(
Utils.getImgPath('login_bg'),
),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '软件服务协议', "xy");
},
child: Padding(
// Container(
// height: ScreenUtil().setHeight(84),
// width: ScreenUtil().setWidth(611),
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(8))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Image.asset(
// "assets/icon_sellercode.png",
// width: prefixIconWidth,
// ),
// HEmptyView(26),
// Center(
// child: Text(
// "商户编号",
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// )),
// Expanded(
// child: Container(
// height: ScreenUtil().setHeight(84),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(8)),
// child: TextField(
// controller: _sellerCodeController,
// focusNode: _sellerCodeFocusNode,
// // autofocus: _sellerCodeController.text.isEmpty,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28),
// textBaseline: TextBaseline.alphabetic),
// // textAlignVertical: TextAlignVertical.center,
// decoration: InputDecoration(
// hintText: "请输入6位商户编码",
// hintStyle: TextStyle(
// color: MyColours.color_c1c1c1,
// fontSize: ScreenUtil().setSp(28),
// ),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// onChanged: (_) {
// setActivate();
// },
// keyboardType: TextInputType.number,
// )),
// )
// ],
// )),
// Container(
// height: ScreenUtil().setHeight(84),
// width: ScreenUtil().setWidth(611),
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(8))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Image.asset(
// "assets/icon_account.png",
// width: prefixIconWidth,
// ),
// HEmptyView(26),
// Text(
// "工 号",
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// ),
// Expanded(
// child: Container(
// height: ScreenUtil().setHeight(84),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(8)),
// child: TextField(
// controller: _accountController,
// focusNode: _accountFocusNode,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// decoration: InputDecoration(
// hintText: "请输入4位工号",
// hintStyle: TextStyle(
// color: MyColours.color_c1c1c1,
// fontSize: ScreenUtil().setSp(28)),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// onChanged: (_) {
// setActivate();
// },
// keyboardType: TextInputType.number,
// ),
// ))
// ],
// )),
// Container(
// height: ScreenUtil().setHeight(84),
// width: ScreenUtil().setWidth(611),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(27)),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_bff6f7,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(8))),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Image.asset(
// "assets/icon_pwd.png",
// width: prefixIconWidth,
// ),
// HEmptyView(26),
// Text(
// "密 码",
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// ),
// Expanded(
// child: Container(
// height: ScreenUtil().setHeight(84),
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20),
// right: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(8)),
// child: TextField(
// controller: _pwdController,
// focusNode: _pwdFocusNode,
// // autofocus: _sellerCodeController.text.isNotEmpty &&
// // _accountController.text.isNotEmpty &&
// // _pwdController.text.isEmpty,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(28)),
// decoration: InputDecoration(
// hintText: "请输入密码",
// hintStyle: TextStyle(
// color: MyColours.color_c1c1c1,
// fontSize: ScreenUtil().setSp(28)),
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// onChanged: (_) {
// setActivate();
// },
// obscureText: obscureText,
// keyboardType: TextInputType.text,
// )),
// ),
// GestureDetector(
// child: Padding(
// padding: EdgeInsets.all(ScreenUtil().setWidth(10)),
// child: Image.asset(
// obscureText
// ? "assets/icon_pwd_show.png"
// : "assets/icon_pwd_hide.png",
// width: ScreenUtil().setWidth(35),
// height: ScreenUtil().setHeight(24),
// ),
// ),
// onTap: () {
// setState(() {
// obscureText = !obscureText;
// });
// },
// )
// ],
// )),
// Container(
// width: ScreenUtil().setWidth(611),
// margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)),
// alignment: Alignment.centerLeft,
// child: Text(
// errorText,
// // 'hfhfhf',
// style: TextStyle(
// color: MyColours.color_d93535,
// fontSize: ScreenUtil().setSp(16)),
// ),
// ),
VEmptyView(60),
// Consumer<UserModel>(
// builder:
// (BuildContext context, UserModel value, Widget child) {
// return GestureDetector(
// onTap: () {
// if (!isActivate) return;
// if (!_check) {
// Utils.showToast('请先仔细阅读并同意协议');
// return;
// }
// if (App.sp.containsKey('unionid')) {
// //微信登陆的时候,退出清空数据
// App.sp.remove('openid');
// App.sp.remove("unionid");
// }
// Map<String, String> params = {
// "seller_code": "${_sellerCodeController.text}",
// "alias": "ssahdahgdafgahjkhakjgh",
// "account": "${_accountController.text}",
// "password": "${_pwdController.text}"
// };
// value.login(context, params).then((value) {
// setState(() {
// errorText = value ?? "";
// });
// });
// },
// child: Container(
// height: ScreenUtil().setWidth(84),
// width: ScreenUtil().setWidth(611),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// color: isActivate
// ? MyColours.color_2bb5b7
// : MyColours.color_2bb5b7,
// boxShadow: [
// BoxShadow(
// color: MyColours.color_26000000,
// offset: Offset(0, ScreenUtil().setWidth(4)),
// )
// ],
// borderRadius: BorderRadius.all(
// Radius.circular(ScreenUtil().setWidth(8)))),
// child: Text(
// "登录",
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(34)),
// ),
// ),
// );
// },
// ),
Row(
// mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: () {
setState(() {
_check = !_check;
});
},
child: Container(
alignment: Alignment.topCenter,
// color: Colors.red,
height: ScreenUtil().setWidth(110),
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(30),
left: ScreenUtil().setWidth(102),
bottom: ScreenUtil().setWidth(10)),
child: Image.asset(
_check
? "assets/mine_radio_sel.png"
: "assets/mine_radio_nor.png",
width: ScreenUtil().setWidth(26),
height: ScreenUtil().setWidth(26)),
)),
// HEmptyView(30),
Padding(
padding:
EdgeInsets.only(top: ScreenUtil().setWidth(2)),
child: Text(
'《软件服务协议》',
'已阅读并同意',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333),
)),
color: MyColours.color_999999),
),
),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '软件服务协议', "xy");
},
child: Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(2)),
child: Text(
'《软件服务协议》',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333),
)),
),
Padding(
padding:
EdgeInsets.only(top: ScreenUtil().setWidth(2)),
child: Text('及',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_999999))),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '隐私政策', "zc");
},
child: Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(2)),
child: Text('《隐私政策》',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333))),
)
],
),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setWidth(2)),
child: Text('及',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_999999))),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(context, '隐私政策', "zc");
},
child: Padding(
padding:
EdgeInsets.only(top: ScreenUtil().setWidth(2)),
child: Text('《隐私政策》',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333))),
)
],
),
//微信登录
Offstage(
offstage: !App.isInstallWx,
child: InkWell(
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(90),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(80),
left: ScreenUtil().setWidth(80)),
decoration: BoxDecoration(
color: MyColours.color_55AA67,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(Utils.getImgPath('icon_wechat_login'),
width: ScreenUtil().setWidth(46)),
HEmptyView(20),
Text('微信登录',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold)),
],
)),
onTap: () {
if (!_check) {
DialogUtil.openAlertDialogLogin(context, 500,
onTap: () {
initDio();
Navigator.pop(context);
//微信登录
Offstage(
offstage: !App.isInstallWx,
child: InkWell(
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(90),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(80),
left: ScreenUtil().setWidth(80)),
decoration: BoxDecoration(
color: MyColours.color_55AA67,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath('icon_wechat_login'),
width: ScreenUtil().setWidth(46)),
HEmptyView(20),
Text('微信登录',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold)),
],
)),
onTap: () {
if (!_check) {
DialogUtil.openAlertDialogLogin(context, 500,
onTap: () {
Navigator.pop(context);
_wxLogin();
});
return;
}
_wxLogin();
});
return;
}
_wxLogin();
},
)),
//账号登录
Consumer<UserModel>(builder:
(BuildContext context, UserModel value, Widget child) {
return InkWell(
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(90),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(80),
left: ScreenUtil().setWidth(80)),
decoration: BoxDecoration(
color: MyColours.color_41444B,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('一键订账号登录',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold)),
],
)),
onTap: () {
if (!_check) {
DialogUtil.openAlertDialogLogin(context, 500,
onTap: () {
initDio();
Navigator.pop(context);
},
)),
//账号登录
Consumer<UserModel>(builder:
(BuildContext context, UserModel value, Widget child) {
return InkWell(
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(90),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(80),
left: ScreenUtil().setWidth(80)),
decoration: BoxDecoration(
color: MyColours.color_41444B,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('一键订账号登录',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold)),
],
)),
onTap: () {
if (!_check) {
DialogUtil.openAlertDialogLogin(context, 500,
onTap: () {
Navigator.pop(context);
NavigatorUtil.goAccountLoginPage(context);
});
return;
}
NavigatorUtil.goAccountLoginPage(context);
});
return;
}
NavigatorUtil.goAccountLoginPage(context);
});
}),
// ios登录
Platform.isAndroid
? Text('')
: Consumer<UserModel>(builder:
(BuildContext context, UserModel value, Widget child) {
return InkWell(
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(90),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(80),
left: ScreenUtil().setWidth(80)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_E4E4E4,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath('icon_apple_login'),
width: ScreenUtil().setWidth(46)),
HEmptyView(20),
Text('通过 Apple 登录',
style: TextStyle(
color: MyColours.color_41444B,
fontSize: ScreenUtil().setSp(28),
fontWeight: FontWeight.bold)),
],
)),
onTap: () {
if (!_check) {
DialogUtil.openAlertDialogLogin(context, 500,
onTap: () {
initDio();
Navigator.pop(context);
}),
// ios登录
Platform.isAndroid
? Text('')
: Consumer<UserModel>(builder: (BuildContext context,
UserModel value, Widget child) {
return InkWell(
child: Container(
width: double.infinity,
height: ScreenUtil().setWidth(90),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(30),
right: ScreenUtil().setWidth(80),
left: ScreenUtil().setWidth(80)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_E4E4E4,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath(
'icon_apple_login'),
width: ScreenUtil().setWidth(46)),
HEmptyView(20),
Text('通过 Apple 登录',
style: TextStyle(
color: MyColours.color_41444B,
fontSize:
ScreenUtil().setSp(28),
fontWeight: FontWeight.bold)),
],
)),
onTap: () {
if (!_check) {
DialogUtil.openAlertDialogLogin(
context, 500, onTap: () {
Navigator.pop(context);
_iosLogin(value);
});
return;
}
_iosLogin(value);
});
return;
}
_iosLogin(value);
});
}),
InkWell(
onTap: () {
Utils.goPhone("400-000-9690");
},
child: Text('联系客服',
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.underline))),
],
),
),
));
}),
InkWell(
onTap: () {
Utils.goPhone("400-000-9690");
},
child: Text('联系客服',
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.underline))),
],
),
),
));
}
}
... ...
... ... @@ -177,16 +177,16 @@ class _WebPageState extends State<WebPage> {
webViewController = controller;
},
onLoadStart: (controller, url) {
setState(() {
this.url = url.toString();
urlController.text = this.url;
});
// setState(() {
// this.url = url.toString();
// urlController.text = this.url;
// });
},
androidOnPermissionRequest:
(controller, origin, resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT);
// return PermissionRequestResponse(
// resources: resources,
// action: PermissionRequestResponseAction.GRANT);
},
shouldOverrideUrlLoading:
(controller, navigationAction) async {
... ... @@ -214,84 +214,84 @@ class _WebPageState extends State<WebPage> {
return NavigationActionPolicy.ALLOW;
},
onLoadStop: (controller, url) async {
pullToRefreshController.endRefreshing();
setState(() {
this.url = url.toString();
urlController.text = this.url;
});
// pullToRefreshController.endRefreshing();
// setState(() {
// this.url = url.toString();
// urlController.text = this.url;
// });
},
onLoadError: (controller, url, code, message) {
pullToRefreshController.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
// if (progress == 100) {
pullToRefreshController.endRefreshing();
}
setState(() {
this.progress = progress / 100;
urlController.text = this.url;
});
// }
// setState(() {
// this.progress = progress / 100;
// urlController.text = this.url;
// });
},
onUpdateVisitedHistory: (controller, url, androidIsReload) {
setState(() {
this.url = url.toString();
urlController.text = this.url;
});
// setState(() {
// this.url = url.toString();
// urlController.text = this.url;
// });
},
onConsoleMessage: (controller, consoleMessage) {
print(consoleMessage);
},
onDownloadStart: (controller, url) async {
print("onDownloadStart $url");
Utils.showToast('开始下载...');
// final taskId = await FlutterDownloader.enqueue(
// url: url.toString(),
// savedDir: (await getExternalStorageDirectory()).path,
// showNotification:
// true, // show download progress in status bar (for Android)
// openFileFromNotification:
// true, // click on notification to open downloaded file (for Android)
// );
final dir = await getExternalStorageDirectory();
String savePath = dir.path + "/one_key";
// print("onDownloadStart $url");
// Utils.showToast('开始下载...');
// // final taskId = await FlutterDownloader.enqueue(
// // url: url.toString(),
// // savedDir: (await getExternalStorageDirectory()).path,
// // showNotification:
// // true, // show download progress in status bar (for Android)
// // openFileFromNotification:
// // true, // click on notification to open downloaded file (for Android)
// // );
// final dir = await getExternalStorageDirectory();
// String savePath = dir.path + "/one_key";
Directory directory = new Directory(savePath);
if (directory.existsSync()) {
//删除历史apk
final List<FileSystemEntity> files = directory.listSync();
for (FileSystemEntity file in files) {
file.deleteSync();
}
}
DioUtil().download(url.toString(), savePath,
onProgress: (received, total) {
// if (_progress != 100) {
// int progress = ((received / total) * 100).round();
// _progress = progress;
// _setState(() {});
// }
if (received == total) {
print('object');
Utils.showToast('文件已保存在${savePath}');
// openFile(savePath);
//下载完成
// InstallPlugin.installApk(savePath, "com.naji.one_key");
}
});
// },
// DioUtil().download(url.toString(),
// (await getExternalStorageDirectory()).path,
// onProgress: (received, total) {
// // if (_progress != 100) {
// // int progress = ((received / total) * 100).round();
// // _progress = progress;
// // _setState(() {});
// // }
// if (received == total) {
// //下载完成
// // InstallPlugin.installApk(savePath, "com.naji.one_key");
// }
// });
// Directory directory = new Directory(savePath);
// if (directory.existsSync()) {
// //删除历史apk
// final List<FileSystemEntity> files = directory.listSync();
// for (FileSystemEntity file in files) {
// file.deleteSync();
// }
// }
// DioUtil().download(url.toString(), savePath,
// onProgress: (received, total) {
// // if (_progress != 100) {
// // int progress = ((received / total) * 100).round();
// // _progress = progress;
// // _setState(() {});
// // }
// if (received == total) {
// print('object');
// Utils.showToast('文件已保存在${savePath}');
// // openFile(savePath);
// //下载完成
// // InstallPlugin.installApk(savePath, "com.naji.one_key");
// }
// });
// // },
// // DioUtil().download(url.toString(),
// // (await getExternalStorageDirectory()).path,
// // onProgress: (received, total) {
// // // if (_progress != 100) {
// // // int progress = ((received / total) * 100).round();
// // // _progress = progress;
// // // _setState(() {});
// // // }
// // if (received == total) {
// // //下载完成
// // // InstallPlugin.installApk(savePath, "com.naji.one_key");
// // }
// // });
},
))
],
... ...
... ... @@ -820,7 +820,7 @@ packages:
name: provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.3"
version: "6.0.3"
pub_semver:
dependency: transitive
description:
... ...
... ... @@ -29,7 +29,8 @@ dependencies:
json_annotation: ^3.1.0
# 状态管理
provider: ^4.0.4
provider: ^6.0.3
# provider: ^4.0.4
# Sp存储
shared_preferences: ^0.5.6+3
# 网络
... ...