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), 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 673b6ae5..9770898a 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"