首次登录隐私政策和用户协议分开,移除pdf依赖,用户设置页面添加隐私政策和用户协议

hmxc
张萌 4 years ago
parent 49c35fde64
commit fa20d19b4c

@ -1,106 +1,234 @@
import 'dart:async';
import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/utils/screenutil.dart';
import 'package:flutter/material.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 { class AgreementPage extends StatefulWidget {
final Bundle bundle;
AgreementPage({this.bundle});
@override @override
_AgreementPageState createState() => _AgreementPageState(); _AgreementPageState createState() => _AgreementPageState();
} }
class _AgreementPageState extends State<AgreementPage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: PreferredSize( appBar: AppBar(
child: CommonAppBar( title: Text('用户协议'),
title: '用户协议和隐私政策',
),
preferredSize: Size.fromHeight(kToolbarHeight),
), ),
body: Stack( body: SingleChildScrollView(
children: <Widget>[ padding: EdgeInsets.all(Screenutil.length(16)),
Positioned( child: Column(
top: Screenutil.length(16), children: [
left: Screenutil.length(32), Text(
child: Text( '《用户协议》',
'页面:$currentPage/$totalPage',
style: TextStyle( style: TextStyle(
fontSize: Screenutil.size(32), fontWeight: FontWeight.w600, fontSize: Screenutil.length(35)),
fontWeight: FontWeight.w600,
color: Color(0xff333333),
),
), ),
), Text(
Container( '''
margin: EdgeInsets.only( 使APP
top: Screenutil.length(64), 使APP使
left: Screenutil.length(32),
right: Screenutil.length(32), 使使
bottom: Screenutil.length(32),
), //()
child: PDFView(
filePath: widget.bundle.getString('path'),
enableSwipe: true,
autoSpacing: false, 1.1
defaultPage: currentPage, 使使
// fitPolicy: FitPolicy.HEIGHT,
onRender: (_pages) {
setState(() { 2.1
pages = _pages; APP线
isReady = true;
}); 2.2
}, 2.2.1 使
onError: (error) {
setState(() { 2.2.2 iOSandroid
errorMessage = error.toString();
}); 2.3
print(error.toString()); 2.3.1 使使
},
onPageError: (page, error) { 2.3.2 使使
setState(() {
errorMessage = '$page: ${error.toString()}';
}); 3.1
print('$page: ${error.toString()}');
}, 3.2 使
onViewCreated: (PDFViewController pdfViewController) {
_controller.complete(pdfViewController);
}, 4.1
onLinkHandler: (String uri) {
print('goto uri: $uri'); 4.2
},
onPageChanged: (int page, int total) { 4.3
print('page change: $page/$total');
setState(() { 4.4 使
currentPage = page;
totalPage = total;
}); 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: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:akuCommunity/pages/sign/sign_in_page.dart';
import 'package:ani_route/ani_route.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_icons/flutter_icons.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/utils/screenutil.dart';
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/widget/common_app_bar.dart'; import 'package:akuCommunity/widget/common_app_bar.dart';
import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/widget/custom_action_sheet.dart'; import 'package:akuCommunity/widget/custom_action_sheet.dart';
import 'agreement_page/privacy_page.dart';
class SettingPage extends StatefulWidget { class SettingPage extends StatefulWidget {
SettingPage({Key key}) : super(key: key); SettingPage({Key key}) : super(key: key);
@ -21,7 +22,6 @@ class SettingPage extends StatefulWidget {
class _SettingPageState extends State<SettingPage> { class _SettingPageState extends State<SettingPage> {
bool isNotice = false; bool isNotice = false;
String pathPDF = "";
List<Map<String, dynamic>> _listView = [ List<Map<String, dynamic>> _listView = [
{ {
@ -46,37 +46,14 @@ class _SettingPageState extends State<SettingPage> {
'isSwitch': false, 'isSwitch': false,
}, },
{ {
'title': '用户协议和隐私政策', 'title': '用户协议',
'isSwitch': false, 'isSwitch': false,
}, },
]; {
Future<File> fromAsset(String asset, String filename) async { 'title':'隐私政策',
// To open from assets, you can copy them to the app storage folder, and the access them "locally" 'isSwitch': false,
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;
});
});
} }
];
void _showDialog(String url) { void _showDialog(String url) {
showCupertinoDialog( showCupertinoDialog(
@ -198,9 +175,11 @@ class _SettingPageState extends State<SettingPage> {
}, },
); );
break; break;
case '用户协议和隐私政策': case '用户协议':
Navigator.pushNamed(context, PageName.agreement_page.toString(), ARoute.push(context, AgreementPage());
arguments: Bundle()..putString('path', pathPDF)); break;
case '隐私政策':
ARoute.push(context,PrivacyPage());
break; break;
default: default:
} }
@ -335,7 +314,7 @@ class _SettingPageState extends State<SettingPage> {
SizedBox(height: Screenutil.length(24)), SizedBox(height: Screenutil.length(24)),
Column( Column(
children: _listView children: _listView
.take(7) .take(8)
.skip(3) .skip(3)
.toList() .toList()
.map((item) => _inkWellListTile( .map((item) => _inkWellListTile(

@ -1,17 +1,13 @@
import 'dart:async'; import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart';
import 'dart:io'; import 'package:akuCommunity/pages/setting_page/agreement_page/privacy_page.dart';
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:ani_route/ani_route.dart'; import 'package:ani_route/ani_route.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);
@ -24,9 +20,6 @@ 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(
elevation: 0, 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double _statusHeight = MediaQuery.of(context).padding.top; double _statusHeight = MediaQuery.of(context).padding.top;
@ -230,12 +195,16 @@ class _SignInPageState extends State<SignInPage> {
children: [ children: [
FlatButton( FlatButton(
onPressed: () { onPressed: () {
Navigator.pushNamed( ARoute.push(context, AgreementPage());
context, PageName.agreement_page.toString(),
arguments: Bundle()..putString('path', pathPDF));
}, },
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:fluro/fluro.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -166,6 +167,7 @@ enum PageName {
things_create_page, things_create_page,
things_evaluate_page, things_evaluate_page,
agreement_page, agreement_page,
privacy_page,
} }
class Bundle { class Bundle {
@ -257,7 +259,8 @@ final Map<PageName, PageBuilder> pageRoutes = {
PageBuilder(builder: (bundle) => UserAuthenticationPage()), PageBuilder(builder: (bundle) => UserAuthenticationPage()),
PageName.common_page: PageName.common_page:
PageBuilder(builder: (bundle) => CommonPage(bundle: bundle)), PageBuilder(builder: (bundle) => CommonPage(bundle: bundle)),
PageName.privacy_page:
PageBuilder(builder:(bundle)=>PrivacyPage()),
PageName.confirm_order_page: PageName.confirm_order_page:
PageBuilder(builder: (bundle) => ConfirmOrderPage(bundle: bundle)), PageBuilder(builder: (bundle) => ConfirmOrderPage(bundle: bundle)),
@ -356,7 +359,7 @@ final Map<PageName, PageBuilder> pageRoutes = {
PageName.feedback_page: PageName.feedback_page:
PageBuilder(builder: (bundle) => FeedBackPage()), PageBuilder(builder: (bundle) => FeedBackPage()),
PageName.agreement_page: PageName.agreement_page:
PageBuilder(builder: (bundle) => AgreementPage(bundle: bundle)), PageBuilder(builder: (bundle) => AgreementPage()),
PageName.things_page: PageName.things_page:
PageBuilder(builder: (bundle) => ThingsPage(bundle: bundle)), PageBuilder(builder: (bundle) => ThingsPage(bundle: bundle)),
PageName.things_detail_page: PageName.things_detail_page:

Loading…
Cancel
Save