From 8c8ea6fbba9ed6648c9c00a557baa63955030d95 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 20 Oct 2020 11:20:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=B8=BA1.0.3=20=E6=B7=BB=E5=8A=A0=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=9A=90=E7=A7=81=E5=8D=8F=E8=AE=AE=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/sign/sign_in_page.dart | 53 ++++++++++++++++++++++++++++++-- pubspec.yaml | 2 +- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/lib/pages/sign/sign_in_page.dart b/lib/pages/sign/sign_in_page.dart index f430c50e..cd9cf989 100644 --- a/lib/pages/sign/sign_in_page.dart +++ b/lib/pages/sign/sign_in_page.dart @@ -1,10 +1,16 @@ +import 'dart:async'; +import 'dart:io'; + import 'package:akuCommunity/pages/sign/user_authentication_page.dart'; +import 'package:akuCommunity/routers/page_routers.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/assets_image.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_screenutil/screenutil.dart'; +import 'package:path_provider/path_provider.dart'; class SignInPage extends StatefulWidget { SignInPage({Key key}) : super(key: key); @@ -17,6 +23,8 @@ class _SignInPageState extends State { TextEditingController _phone = new TextEditingController(); TextEditingController _code = new TextEditingController(); String _verifyStr = '获取验证码'; + String pathPDF = ""; + bool _agreementvalue = false; AppBar _appBar() { return AppBar( @@ -149,15 +157,43 @@ class _SignInPageState extends State { ); } + Future 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 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 Widget build(BuildContext context) { double _statusHeight = MediaQuery.of(context).padding.top; ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true); return Scaffold( + backgroundColor: Colors.white, appBar: _appBar(), body: SingleChildScrollView( child: Container( - color: Colors.white, child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -190,7 +226,20 @@ class _SignInPageState extends State { _containerTextField( AssetsImage.CODELOGO, _code, '请输入验证码', true), 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('用户协议和隐私政策')), + ), + ], + ) ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index baa6f813..cbb6e45c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.1+2 +version: 1.0.2+3 environment: sdk: ">=2.7.0 <3.0.0" From 383cee32a73242248fedcdd0c98838c3080560c3 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 21 Oct 2020 08:45:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E6=8F=90=E4=BA=A4=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting_page/feedback_page/feedback_page.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/pages/setting_page/feedback_page/feedback_page.dart b/lib/pages/setting_page/feedback_page/feedback_page.dart index 22b83c89..ad68ae9e 100644 --- a/lib/pages/setting_page/feedback_page/feedback_page.dart +++ b/lib/pages/setting_page/feedback_page/feedback_page.dart @@ -1,9 +1,12 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/base/assets_image.dart'; import 'package:akuCommunity/widget/common_app_bar.dart'; import 'package:akuCommunity/widget/common_image_picker.dart'; +import 'package:oktoast/oktoast.dart'; class FeedBackPage extends StatefulWidget { FeedBackPage({Key key}) : super(key: key); @@ -71,6 +74,12 @@ class _FeedBackPageState extends State { Widget _inkWellSubmit() { return InkWell( + onTap: () { + Navigator.pop(context); + Future.delayed(Duration(milliseconds:1000+ Random().nextInt(1000)), () { + showToast('提交成功!'); + }); + }, child: Container( alignment: Alignment.center, height: Screenutil.length(85),