|
|
|
@ -7,13 +7,17 @@ import 'package:flutter/gestures.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:project_telephony/ui/login/login_psd_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/user/set_password_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import '../../base/base_style.dart';
|
|
|
|
|
import '../../constants/api.dart';
|
|
|
|
|
|
|
|
|
|
import '../../constants/environment/environment.dart';
|
|
|
|
|
import '../../model/network/api_client.dart';
|
|
|
|
|
import '../../model/network/base_model.dart';
|
|
|
|
|
import '../../providers/user_provider.dart';
|
|
|
|
|
import '../../utils/toast/cloud_toast.dart';
|
|
|
|
|
import '../../utils/user_tool.dart';
|
|
|
|
|
import '../tab_navigator.dart';
|
|
|
|
@ -40,8 +44,8 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
int _countDownNum = 59;
|
|
|
|
|
late TextEditingController _phoneController;
|
|
|
|
|
late TextEditingController _smsCodeController;
|
|
|
|
|
late TextEditingController _pwdCodeController;
|
|
|
|
|
late FocusNode _phoneFocusNode;
|
|
|
|
|
|
|
|
|
|
late FocusNode _smsCodeFocusNode;
|
|
|
|
|
bool _cantSelected = false;
|
|
|
|
|
DateTime? _lastTap;
|
|
|
|
@ -53,7 +57,7 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
_smsCodeFocusNode = FocusNode();
|
|
|
|
|
_phoneController = TextEditingController();
|
|
|
|
|
_smsCodeController = TextEditingController();
|
|
|
|
|
// final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
|
_pwdCodeController = TextEditingController();
|
|
|
|
|
var env = const String.fromEnvironment('ENV', defaultValue: 'dev');
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
print('env :$env');
|
|
|
|
@ -70,11 +74,13 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
_smsCodeFocusNode.unfocus();
|
|
|
|
|
_phoneController.dispose();
|
|
|
|
|
_smsCodeController.dispose();
|
|
|
|
|
_pwdCodeController.dispose();
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
return CloudScaffold(
|
|
|
|
|
systemStyle: const SystemUiOverlayStyle(
|
|
|
|
|
statusBarIconBrightness: Brightness.dark,
|
|
|
|
@ -162,6 +168,9 @@ class _LoginPageState extends State<LoginPage> {
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
await UserTool.userProvider.setToken(base.data['token']);
|
|
|
|
|
Get.offAll(const TabNavigator());
|
|
|
|
|
if (UserTool.userProvider.userInfo.havePwd == 0) {
|
|
|
|
|
Get.to(()=>const SetPasswordPage());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
@ -355,7 +364,13 @@ class LoginBoxWidget extends StatelessWidget {
|
|
|
|
|
final String text;
|
|
|
|
|
final int fontSize;
|
|
|
|
|
final Widget plone;
|
|
|
|
|
const LoginBoxWidget({Key? key, required this.text, required this.fontSize, required this.plone}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
const LoginBoxWidget(
|
|
|
|
|
{Key? key,
|
|
|
|
|
required this.text,
|
|
|
|
|
required this.fontSize,
|
|
|
|
|
required this.plone})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -391,4 +406,3 @@ class LoginBoxWidget extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|