Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  首次登录隐私政策和用户协议分开,移除pdf依赖,用户设置页面添加隐私政策和用户协议
  dadwad
hmxc
小赖 4 years ago
commit b17347666e

@ -1,106 +1,234 @@
import 'dart:async';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:flutter/material.dart';
import 'package:flutter_pdfview/flutter_pdfview.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/widget/common_app_bar.dart';
class AgreementPage extends StatefulWidget {
final Bundle bundle;
AgreementPage({this.bundle});
@override
_AgreementPageState createState() => _AgreementPageState();
}
class _AgreementPageState extends State<AgreementPage> {
final Completer<PDFViewController> _controller =
Completer<PDFViewController>();
int pages = 0;
int currentPage = 0;
int totalPage = 0;
bool isReady = false;
String errorMessage = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
child: CommonAppBar(
title: '用户协议和隐私政策',
),
preferredSize: Size.fromHeight(kToolbarHeight),
appBar: AppBar(
title: Text('用户协议'),
),
body: Stack(
children: <Widget>[
Positioned(
top: Screenutil.length(16),
left: Screenutil.length(32),
child: Text(
'页面:$currentPage/$totalPage',
body: SingleChildScrollView(
padding: EdgeInsets.all(Screenutil.length(16)),
child: Column(
children: [
Text(
'《用户协议》',
style: TextStyle(
fontSize: Screenutil.size(32),
fontWeight: FontWeight.w600,
color: Color(0xff333333),
),
fontWeight: FontWeight.w600, fontSize: Screenutil.length(35)),
),
),
Container(
margin: EdgeInsets.only(
top: Screenutil.length(64),
left: Screenutil.length(32),
right: Screenutil.length(32),
bottom: Screenutil.length(32),
),
child: PDFView(
filePath: widget.bundle.getString('path'),
enableSwipe: true,
autoSpacing: false,
defaultPage: currentPage,
// fitPolicy: FitPolicy.HEIGHT,
onRender: (_pages) {
setState(() {
pages = _pages;
isReady = true;
});
},
onError: (error) {
setState(() {
errorMessage = error.toString();
});
print(error.toString());
},
onPageError: (page, error) {
setState(() {
errorMessage = '$page: ${error.toString()}';
});
print('$page: ${error.toString()}');
},
onViewCreated: (PDFViewController pdfViewController) {
_controller.complete(pdfViewController);
},
onLinkHandler: (String uri) {
print('goto uri: $uri');
},
onPageChanged: (int page, int total) {
print('page change: $page/$total');
setState(() {
currentPage = page;
totalPage = total;
});
},
Text(
'''
使APP
使APP使
使使
//()
1.1
使使
2.1
APP线
2.2
2.2.1 使
2.2.2 iOSandroid
2.3
2.3.1 使使
2.3.2 使使
3.1
3.2 使
4.1
4.2
4.3
4.4 使
5.1
5.2
5.3 使
6.1
6.2 使使使
6.3
6.4 访使
6.5
7.1 使
7.1.1 使使
7.1.2 使使使使
7.1.3 怀使
7.2
7.2.1 使
7.2.2
7.2.2.1
7.2.2.2
7.2.2.3 使
7.2.3 使
7.2.3.1
7.2.3.2
7.2.3.3 使访
7.2.3.4
7.2.3.5 线线
7.2.4 14
7.2.5 ;
7.3
7.3.1 使
8.1
8.1.1
8.1.1.1
8.1.1.2
8.1.1.3
8.1.1.4 广
8.1.1.5
8.2 使
使
8.2.1
8.2.2
8.2.3 使
8.2.4 使/
8.2.5
8.2.6 使
8.2.7
8.2.8
8.3
使
8.3.1
8.3.2
8.3.3
8.3.4
8.3.5 广广
8.3.6
8.3.7
8.3.8
8.4
使
8.5
8.5.1 使
8.5.2
8.5.3
9.1
9.2
10.1 访使
10.2 使
10.3 使
10.4
10.5
11.1 使使使
11.2 使使
11.3 使
12.1
APP---APP
1APP
2/
使访使
12.20574-87760023
20201021
''',
style: TextStyle(
fontSize: Screenutil.length(30),
),
),
errorMessage.isEmpty
? !isReady
? Center(
child: CircularProgressIndicator(),
)
: Container()
: Center(
child: Text(errorMessage),
)
],
),
),
);
}
}

@ -0,0 +1,136 @@
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:flutter/material.dart';
class PrivacyPage extends StatefulWidget {
PrivacyPage({Key key}) : super(key: key);
@override
_PrivacyPageState createState() => _PrivacyPageState();
}
class _PrivacyPageState extends State<PrivacyPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('隐私政策'),
),
body: SingleChildScrollView(
padding: EdgeInsets.all(Screenutil.size(16)),
child: Column(
children: [Text(
'小蜜蜂智慧社区隐私政策',
style: TextStyle(
fontWeight: FontWeight.w600, fontSize: Screenutil.length(35)),
),
Text(
'''
APPAPP便使使
1.
2.使
3.
4.
5.
6.
7.
8.
1.
1.1
APP使APP便访
1.2
APPAPP使APP使
APP使使APPAPP使APP
使使
使
/ 使使
使使
使使使
访 使访访访访访访访访访访
使使使
使
使使使
/ 使
使
使
/ 使
使
使
使
使使
使
使使
/ 使使使
使,
使,
使,
访使
访使
使访
使访
使访
使访
使访
使访
使访
使访
使访
使访
使访
访
访
访
访
访
(iOS) 访
/ 使访
1.3
APPAPP
使访
1.4
1.5
便使APPID访
2.使
2.1 
2.2 APP使使使APPAPP使
3.
3.1 
3.2 
4.
便
app
5.
访使APP
APP
使
线APP
6.
6.1 APP访
6.2 
7.
APP18使APPAPP使8
8.
johnson.yang@akuhome.com
20201020
''',
style: TextStyle(
fontSize: Screenutil.length(30),
),
),
],
),
),
);
}
}

@ -1,17 +1,18 @@
import 'dart:async';
import 'dart:io';
import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';
import 'package:akuCommunity/utils/screenutil.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/widget/common_app_bar.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/widget/custom_action_sheet.dart';
import 'agreement_page/privacy_page.dart';
class SettingPage extends StatefulWidget {
SettingPage({Key key}) : super(key: key);
@ -21,7 +22,6 @@ class SettingPage extends StatefulWidget {
class _SettingPageState extends State<SettingPage> {
bool isNotice = false;
String pathPDF = "";
List<Map<String, dynamic>> _listView = [
{
@ -46,37 +46,14 @@ class _SettingPageState extends State<SettingPage> {
'isSwitch': false,
},
{
'title': '用户协议和隐私政策',
'title': '用户协议',
'isSwitch': false,
},
];
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;
});
});
{
'title':'隐私政策',
'isSwitch': false,
}
];
void _showDialog(String url) {
showCupertinoDialog(
@ -198,9 +175,11 @@ class _SettingPageState extends State<SettingPage> {
},
);
break;
case '用户协议和隐私政策':
Navigator.pushNamed(context, PageName.agreement_page.toString(),
arguments: Bundle()..putString('path', pathPDF));
case '用户协议':
ARoute.push(context, AgreementPage());
break;
case '隐私政策':
ARoute.push(context,PrivacyPage());
break;
default:
}
@ -335,7 +314,7 @@ class _SettingPageState extends State<SettingPage> {
SizedBox(height: Screenutil.length(24)),
Column(
children: _listView
.take(7)
.take(8)
.skip(3)
.toList()
.map((item) => _inkWellListTile(

@ -1,17 +1,13 @@
import 'dart:async';
import 'dart:io';
import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:akuCommunity/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:akuCommunity/pages/sign/user_authentication_page.dart';
import 'package:akuCommunity/routers/page_routers.dart';
import 'package:ani_route/ani_route.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);
@ -24,9 +20,6 @@ class _SignInPageState extends State<SignInPage> {
TextEditingController _phone = new TextEditingController();
TextEditingController _code = new TextEditingController();
String _verifyStr = '获取验证码';
String pathPDF = "";
bool _agreementvalue = false;
AppBar _appBar() {
return AppBar(
elevation: 0,
@ -155,34 +148,6 @@ 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
Widget build(BuildContext context) {
double _statusHeight = MediaQuery.of(context).padding.top;
@ -230,12 +195,16 @@ class _SignInPageState extends State<SignInPage> {
children: [
FlatButton(
onPressed: () {
Navigator.pushNamed(
context, PageName.agreement_page.toString(),
arguments: Bundle()..putString('path', pathPDF));
ARoute.push(context, AgreementPage());
},
child: SizedBox(child: Text('用户协议和隐私政策')),
child: Text('用户协议'),
),
SizedBox(width: Screenutil.length(15)),
FlatButton(
onPressed: () {
ARoute.push(context, PrivacyPage());
},
child: Text('隐私政策'))
],
)
],

@ -1,3 +1,4 @@
import 'package:akuCommunity/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -166,6 +167,7 @@ enum PageName {
things_create_page,
things_evaluate_page,
agreement_page,
privacy_page,
}
class Bundle {
@ -257,7 +259,8 @@ final Map<PageName, PageBuilder> pageRoutes = {
PageBuilder(builder: (bundle) => UserAuthenticationPage()),
PageName.common_page:
PageBuilder(builder: (bundle) => CommonPage(bundle: bundle)),
PageName.privacy_page:
PageBuilder(builder:(bundle)=>PrivacyPage()),
PageName.confirm_order_page:
PageBuilder(builder: (bundle) => ConfirmOrderPage(bundle: bundle)),
@ -356,7 +359,7 @@ final Map<PageName, PageBuilder> pageRoutes = {
PageName.feedback_page:
PageBuilder(builder: (bundle) => FeedBackPage()),
PageName.agreement_page:
PageBuilder(builder: (bundle) => AgreementPage(bundle: bundle)),
PageBuilder(builder: (bundle) => AgreementPage()),
PageName.things_page:
PageBuilder(builder: (bundle) => ThingsPage(bundle: bundle)),
PageName.things_detail_page:

@ -412,13 +412,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.3"
flutter_pdfview:
dependency: "direct main"
description:
name: flutter_pdfview
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3+5"
flutter_picker:
dependency: "direct main"
description:

@ -112,8 +112,7 @@ dependencies:
flutter_picker: ^1.1.5
#加载动画
loading_animations: ^2.1.0
#读取pdf
flutter_pdfview: ^1.0.3+5
#用户存储路径
path_provider: ^1.6.18
ani_route: ^0.0.2

Loading…
Cancel
Save