You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
5.8 KiB

4 years ago
import 'dart:ui';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
4 years ago
import 'package:aku_community_manager/ui/agreements/agreement_page.dart';
import 'package:aku_community_manager/ui/agreements/privacy_page.dart';
import 'package:aku_community_manager/ui/login/login_sms_page.dart';
4 years ago
import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:extended_text/extended_text.dart';
import 'package:flutter/cupertino.dart';
4 years ago
import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:get/route_manager.dart';
4 years ago
class LoginPage extends StatefulWidget {
LoginPage({Key key}) : super(key: key);
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
TextEditingController _textController = TextEditingController();
bool get phoneValid {
return RegexUtil.isMobileSimple(_textController.text);
}
bool get emptyText {
return TextUtil.isEmpty(_textController.text);
}
@override
void dispose() {
_textController?.dispose();
super.dispose();
}
4 years ago
@override
Widget build(BuildContext context) {
return AkuScaffold(
backgroundColor: Colors.white,
leading: AkuBackButton.close(),
body: ListView(
padding: EdgeInsets.symmetric(
vertical: 40.w,
horizontal: 32.w,
),
4 years ago
children: [
Text(
'欢迎登录小蜜蜂',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold,
fontSize: 48.sp,
4 years ago
),
),
AkuBox.h(184),
Text(
'手机号码',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 24.sp,
4 years ago
),
),
Container(
width: double.infinity,
child: TextField(
controller: _textController,
onChanged: (text) {
setState(() {});
},
4 years ago
maxLength: 11,
4 years ago
keyboardType: TextInputType.phone,
decoration: InputDecoration(
4 years ago
counterText: '',
suffixIconConstraints: BoxConstraints(
minHeight: 0,
minWidth: 0,
),
suffixIcon: emptyText
? SizedBox()
: GestureDetector(
onTap: () {
_textController.clear();
setState(() {});
},
child: Icon(
CupertinoIcons.clear_circled_solid,
size: 30.w,
color: Color(0xFF999999),
),
),
4 years ago
border: UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xFFE8E8E8),
width: 1.w,
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xFFE8E8E8),
width: 2.w,
),
),
),
),
),
AkuBox.h(80),
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: AkuMaterialButton(
color: AppStyle.primaryColor,
onPressed: phoneValid
? () => Get.off(LoginSMSPage(phone: _textController.text))
: null,
nullColor: Color(0xFFFFE67D),
4 years ago
radius: 8.w,
child: Text(
'获取验证码',
style: TextStyle(
color: phoneValid
? AppStyle.primaryTextColor
: AppStyle.minorTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
4 years ago
),
),
],
),
bottom: Container(
height: 110.w,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 40.w),
child: ExtendedText.rich(
TextSpan(
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.sp,
),
children: [
TextSpan(
text: '登录即代表您已同意我们的',
),
ExtendedWidgetSpan(
child: GestureDetector(
4 years ago
onTap: () {
Get.to(AgreementPage());
},
child: Text(
'《服务协议》',
style: TextStyle(
color: AppStyle.secondaryColor,
fontSize: 22.sp,
),
),
),
),
TextSpan(
text: '',
),
ExtendedWidgetSpan(
child: GestureDetector(
4 years ago
onTap: () {
Get.to(PrivacyPage());
},
child: Text(
'《隐私政策》',
style: TextStyle(
color: AppStyle.secondaryColor,
fontSize: 22.sp,
),
),
),
),
TextSpan(
text: '',
),
],
),
),
4 years ago
),
);
}
}