|
|
@ -1,10 +1,16 @@
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:akuCommunity/pages/sign/user_authentication_page.dart';
|
|
|
|
import 'package:akuCommunity/pages/sign/user_authentication_page.dart';
|
|
|
|
|
|
|
|
import 'package:akuCommunity/routers/page_routers.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:akuCommunity/utils/screenutil.dart';
|
|
|
|
import 'package:akuCommunity/utils/screenutil.dart';
|
|
|
|
import 'package:akuCommunity/base/base_style.dart';
|
|
|
|
import 'package:akuCommunity/base/base_style.dart';
|
|
|
|
import 'package:akuCommunity/base/assets_image.dart';
|
|
|
|
import 'package:akuCommunity/base/assets_image.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class SignInPage extends StatefulWidget {
|
|
|
|
class SignInPage extends StatefulWidget {
|
|
|
|
SignInPage({Key key}) : super(key: key);
|
|
|
|
SignInPage({Key key}) : super(key: key);
|
|
|
@ -17,6 +23,8 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
TextEditingController _phone = new TextEditingController();
|
|
|
|
TextEditingController _phone = new TextEditingController();
|
|
|
|
TextEditingController _code = new TextEditingController();
|
|
|
|
TextEditingController _code = new TextEditingController();
|
|
|
|
String _verifyStr = '获取验证码';
|
|
|
|
String _verifyStr = '获取验证码';
|
|
|
|
|
|
|
|
String pathPDF = "";
|
|
|
|
|
|
|
|
bool _agreementvalue = false;
|
|
|
|
|
|
|
|
|
|
|
|
AppBar _appBar() {
|
|
|
|
AppBar _appBar() {
|
|
|
|
return AppBar(
|
|
|
|
return AppBar(
|
|
|
@ -149,15 +157,43 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<File> fromAsset(String asset, String filename) async {
|
|
|
|
|
|
|
|
// To open from assets, you can copy them to the app storage folder, and the access them "locally"
|
|
|
|
|
|
|
|
Completer<File> completer = Completer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
var dir = await getApplicationDocumentsDirectory();
|
|
|
|
|
|
|
|
File file = File("${dir.path}/$filename");
|
|
|
|
|
|
|
|
var data = await rootBundle.load(asset);
|
|
|
|
|
|
|
|
var bytes = data.buffer.asUint8List();
|
|
|
|
|
|
|
|
await file.writeAsBytes(bytes, flush: true);
|
|
|
|
|
|
|
|
completer.complete(file);
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
throw Exception('Error parsing asset file!');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return completer.future;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
fromAsset('assets/agreement.pdf', 'demo.pdf').then((f) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
pathPDF = f.path;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
double _statusHeight = MediaQuery.of(context).padding.top;
|
|
|
|
double _statusHeight = MediaQuery.of(context).padding.top;
|
|
|
|
ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true);
|
|
|
|
ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true);
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
appBar: _appBar(),
|
|
|
|
appBar: _appBar(),
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
child: GestureDetector(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
@ -190,7 +226,20 @@ class _SignInPageState extends State<SignInPage> {
|
|
|
|
_containerTextField(
|
|
|
|
_containerTextField(
|
|
|
|
AssetsImage.CODELOGO, _code, '请输入验证码', true),
|
|
|
|
AssetsImage.CODELOGO, _code, '请输入验证码', true),
|
|
|
|
SizedBox(height: Screenutil.length(59)),
|
|
|
|
SizedBox(height: Screenutil.length(59)),
|
|
|
|
_inkWellLogin()
|
|
|
|
_inkWellLogin(),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
FlatButton(
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Navigator.pushNamed(
|
|
|
|
|
|
|
|
context, PageName.agreement_page.toString(),
|
|
|
|
|
|
|
|
arguments: Bundle()..putString('path', pathPDF));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: SizedBox(child: Text('用户协议和隐私政策')),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|