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