|
|
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
|
import 'package:zhiying_comm/pages/login_page/account/login_account_page.dart'; |
|
|
|
import 'package:zhiying_comm/util/empty_util.dart'; |
|
|
|
import 'package:zhiying_comm/util/mob_util/mob_util.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
|
|
|
|
import 'bloc/bloc.dart'; |
|
|
@@ -16,7 +17,6 @@ import 'model/login_model.dart'; |
|
|
|
/// 登陆页面 |
|
|
|
/// |
|
|
|
class LoginPage extends StatelessWidget { |
|
|
|
|
|
|
|
const LoginPage({Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
@@ -37,21 +37,23 @@ class LoginPageContainer extends StatefulWidget { |
|
|
|
} |
|
|
|
|
|
|
|
class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
|
|
|
|
/// 微信登陆 |
|
|
|
void _loginClick(String type) { |
|
|
|
/// 微信or手机登陆 |
|
|
|
void _loginClick(String type, LoginModel model) { |
|
|
|
print('登陆$type'); |
|
|
|
if(type == 'mobile'){ |
|
|
|
RouterUtil.hideKeyboard(context); |
|
|
|
Navigator.push(context, CupertinoPageRoute( |
|
|
|
builder: (_) => LoginAccountPage(null) |
|
|
|
)); |
|
|
|
RouterUtil.hideKeyboard(context); |
|
|
|
if (type == 'mobile') { |
|
|
|
if (model?.flashLoginEnable == '1') { |
|
|
|
// QuickLoginUtil.getInstance().openQuickLogin(context, model?.quick); |
|
|
|
MobUtil.openQuickLoginPage(context, model?.quick); |
|
|
|
} else { |
|
|
|
Navigator.push(context, CupertinoPageRoute(builder: (_) => LoginAccountPage(null))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 返回上一页 |
|
|
|
void _openPop(){ |
|
|
|
if(Navigator.canPop(context)){ |
|
|
|
void _openPop() { |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
} |
|
|
@@ -63,7 +65,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
|
|
|
|
/// 跳到用户协议 |
|
|
|
void _jumpUserAgreement(String url) { |
|
|
|
if(!EmptyUtil.isEmpty(url)) { |
|
|
|
if (!EmptyUtil.isEmpty(url)) { |
|
|
|
print('协议'); |
|
|
|
RouterUtil.openWebview(url, context); |
|
|
|
} |
|
|
@@ -110,7 +112,6 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
Widget _getMainWidget(LoginModel model) { |
|
|
|
return Column( |
|
|
|
children: <Widget>[ |
|
|
|
|
|
|
|
/// 头部 |
|
|
|
_headWidget(model), |
|
|
|
_sizedHeight50, |
|
|
@@ -151,14 +152,13 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
size: 22, |
|
|
|
color: HexColor.fromHex('#333333'), |
|
|
|
), |
|
|
|
onPressed: ()=> _openPop(), |
|
|
|
onPressed: () => _openPop(), |
|
|
|
), |
|
|
|
), |
|
|
|
Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: <Widget>[ |
|
|
|
|
|
|
|
/// logo |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(bottom: 12, top: MediaQuery.of(context).padding.top), |
|
|
@@ -175,8 +175,10 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
), |
|
|
|
|
|
|
|
/// logo 名字 |
|
|
|
CachedNetworkImage( imageUrl: model?.main?.appNameImg ?? '', width: 90,), |
|
|
|
|
|
|
|
CachedNetworkImage( |
|
|
|
imageUrl: model?.main?.appNameImg ?? '', |
|
|
|
width: 90, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
], |
|
|
@@ -199,7 +201,7 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
textColor: item?.btnTextColor, |
|
|
|
bgColor: item?.btnBgColor, |
|
|
|
borderColor: item?.btnBorderColor, |
|
|
|
onTap: () => _loginClick(item?.type)), |
|
|
|
onTap: () => _loginClick(item?.type, model)), |
|
|
|
); |
|
|
|
}).toList(), |
|
|
|
), |
|
|
@@ -209,11 +211,17 @@ class _LoginPageContainerState extends State<LoginPageContainer> { |
|
|
|
/// 协议 |
|
|
|
Widget _protocolWidget(LoginModel model) { |
|
|
|
return RichText( |
|
|
|
text: TextSpan(text: '', children: model.main.agreements.map((item){ |
|
|
|
return TextSpan(text: item?.text, style: TextStyle(color: HexColor.fromHex(item?.textColor), fontSize: 10),recognizer: TapGestureRecognizer()..onTap = (){ |
|
|
|
_jumpUserAgreement(item?.url); |
|
|
|
}); |
|
|
|
}).toList()), |
|
|
|
text: TextSpan( |
|
|
|
text: '', |
|
|
|
children: model.main.agreements.map((item) { |
|
|
|
return TextSpan( |
|
|
|
text: item?.text, |
|
|
|
style: TextStyle(color: HexColor.fromHex(item?.textColor), fontSize: 10), |
|
|
|
recognizer: TapGestureRecognizer() |
|
|
|
..onTap = () { |
|
|
|
_jumpUserAgreement(item?.url); |
|
|
|
}); |
|
|
|
}).toList()), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|