You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

577 lines
21 KiB

import 'dart:io';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart';
class GuidePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _GuidePage();
}
}
class _GuidePage extends State<GuidePage> {
@override
void initState() {
super.initState();
if(Platform.isAndroid)
isLogin();
}
isLogin() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getBool("isShowPrivacyPolicy") == null ||
!(sharedPreferences.getBool("isShowPrivacyPolicy") ?? false)) {
showAlertDialog();
}
// if (sharedPreferences.containsKey('token') &&
// sharedPreferences.getString("token") != null &&
// sharedPreferences.getString("token") != "") {
// Navigator.of(context).popAndPushNamed('/router/main_page');
// } else {
// initController();
//
// apiService = ApiService(Dio(), context: context);
// isShowLogin = true;
// setState(() {});
// }
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
scrollDirection: Axis.horizontal,
reverse: false,
controller: PageController(
initialPage: 0,
viewportFraction: 1,
keepPage: true,
),
physics: BouncingScrollPhysics(),
pageSnapping: true,
onPageChanged: (index) {
//监听事件
print('index=====$index');
},
children: <Widget>[
Container(
alignment: Alignment.center,
color: Colors.white,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 120.h, left: 19.w, right: 19.w),
child: Stack(
children: [
Column(
children: [
Align(
alignment: Alignment.center,
child: Image.asset(
"assets/image/icon_guide_1.webp",
// height: 307,
),
),
SizedBox(
height: 66.h,
),
Container(
alignment: Alignment.center,
child: Text(
S.of(context).yindaoye1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0XFF32A060),
),
),
),
SizedBox(
height: 23.h,
),
Padding(
padding: EdgeInsets.only(left: 19.w, right: 19.w),
child: Text(
S.of(context).yindao1,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.sp,
height: 1.5.h,
fontWeight: MyFontWeight.medium,
color: Color(0XFF727272),
),
),
),
],
),
Container(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"",
style:
TextStyle(fontSize: 8.sp, color: Colors.black),
),
SizedBox(
width: 10.w,
),
Text(
"",
style: TextStyle(
fontSize: 8.sp, color: Color(0xffB2B2B2)),
),
SizedBox(
width: 10.w,
),
Text(
"",
style: TextStyle(
fontSize: 8.sp, color: Color(0xffB2B2B2)),
),
SizedBox(
height: 108.h,
),
],
),
),
],
),
),
),
),
Container(
alignment: Alignment.center,
color: Colors.white,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 120.h, left: 19.w, right: 19.w),
child: Stack(
children: [
Column(
children: [
Align(
alignment: Alignment.center,
child: Image.asset(
"assets/image/icon_guide_2.webp",
// height: 307,
),
),
SizedBox(
height: 66.h,
),
Container(
alignment: Alignment.center,
child: Text(
S.of(context).yindaoye2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0XFF32A060),
),
),
),
SizedBox(
height: 23.h,
),
Padding(
padding: EdgeInsets.only(left: 19.w, right: 19.w),
child: Text(
S.of(context).yindao2,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.sp,
height: 1.5.h,
fontWeight: MyFontWeight.medium,
color: Color(0XFF727272)),
),
),
],
),
Container(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"",
style: TextStyle(
fontSize: 8.sp, color: Color(0xffB2B2B2)),
),
SizedBox(
width: 10.w,
),
Text(
"",
style:
TextStyle(fontSize: 8.sp, color: Colors.black),
),
SizedBox(
width: 10.w,
),
Text(
"",
style: TextStyle(
fontSize: 8.sp, color: Color(0xffB2B2B2)),
),
SizedBox(
height: 108.h,
),
],
),
),
],
),
),
),
),
Container(
alignment: Alignment.center,
color: Colors.white,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 120.h, left: 19.w, right: 19.w),
child: Stack(
children: [
Column(
children: [
Align(
alignment: Alignment.center,
child: Image.asset(
"assets/image/icon_guide_3.webp",
// height: 307,
),
),
SizedBox(
height: 66.h,
),
Container(
alignment: Alignment.center,
child: Text(
S.of(context).yindaoye3,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0XFF32A060),
),
),
),
SizedBox(
height: 23.h,
),
Padding(
padding: EdgeInsets.only(left: 19.w, right: 19.w),
child: Text(
S.of(context).yindao3,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.sp,
height: 1.5.h,
fontWeight: MyFontWeight.medium,
color: Color(0XFF727272)),
),
),
],
),
Container(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"",
style: TextStyle(
fontSize: 8.sp, color: Color(0xffB2B2B2)),
),
SizedBox(
width: 10.w,
),
Text(
"",
style: TextStyle(
fontSize: 8.sp, color: Color(0xffB2B2B2)),
),
SizedBox(
width: 10.w,
),
Text(
"",
style:
TextStyle(fontSize: 8.sp, color: Colors.black),
),
SizedBox(
height: 108.h,
),
],
),
),
],
),
),
),
),
Container(
alignment: Alignment.center,
color: Colors.white,
child: Center(
child: Container(
child: Stack(
children: [
Column(
children: [
Image.asset(
"assets/image/icon_guide_4.webp",
width: double.infinity,
fit: BoxFit.fill,
),
SizedBox(
height: MediaQuery.of(context).size.width >= 650 ? 20.h :66.h,
),
Container(
alignment: Alignment.center,
child: Text(
S.of(context).yindaoye4,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0XFF32A060)),
),
),
SizedBox(
height: MediaQuery.of(context).size.width >= 650 ? 15.h :23.h,
),
Padding(
padding: EdgeInsets.only(left: 52.w, right: 52.w),
child: Text(
S.of(context).yindao4,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.sp,
height: 1.5.h,
fontWeight: MyFontWeight.medium,
color: Color(0XFF727272)),
),
),
],
),
Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () {
toNext();
},
child: Container(
height: 50.h,
margin: EdgeInsets.only(
left: 71.w, right: 71.w, bottom: 55.h),
alignment: Alignment.center,
child: BorderText(
padding: EdgeInsets.all(5),
text: S.of(context).lijitiyan,
fontSize: 20.sp,
fontWeight: MyFontWeight.regular,
textColor: Color(0xFF32A060),
borderColor: Color(0xFF32A060),
borderWidth: 1.w,
radius: 26.5,
),
),
),
),
],
),
),
),
)
],
),
);
}
showAlertDialog() {
//显示对话框
showDialog(
context: context,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child:SimpleDialog(
titlePadding: EdgeInsets.all(10),
backgroundColor: Colors.transparent,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
children: <Widget>[
Stack(
alignment: Alignment.bottomCenter,
children: [
Container(
alignment: Alignment.center,
width: double.infinity,
height: 325.h,
padding: EdgeInsets.only(left: 16.w, right: 16.w),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(top: 24.h, bottom: 10.h),
child: Text(
S.of(context).xieyitanchuang,
style: TextStyle(
color: Color(0xff4D4D4D),
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
),
),
Text.rich(
TextSpan(children: [
TextSpan(
text: S.of(context).yinsizhengce1,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
height: 1.3.h,
color: Color(0xff727272),
),
),
TextSpan(
text: S.of(context).yinsixieyi,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xff32A060)),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context)
.popAndPushNamed('/router/treaty_page');
},
),
]),
),
SizedBox(
height: 10.h,
),
Text(
S.of(context).yinsizhengce2,
style: TextStyle(
color: Color(0xff727272),
fontSize: 14.sp,
height: 1.3.h,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
height: 16.h,
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
Navigator.of(context).pop();
// exit(0);
},
child: Container(
height: 40.h,
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(bottom: 20.h),
child: BorderText(
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 36.w,
right: 36.w,
),
text: S.of(context).jujue,
fontSize: 12.sp,
textColor: Color(0xFF32A060),
borderColor: Color(0xFF32A060),
borderWidth: 1.w,
radius: 23,
),
),
),
SizedBox(
width: 21.w,
),
Container(
height: 40.h,
margin: EdgeInsets.only(bottom: 20.h),
alignment: Alignment.bottomCenter,
child: RoundButton(
text: S.of(context).tongyibingjixu,
textColor: Colors.white,
fontSize: 12.sp,
callback: () {
SharedPreferences.getInstance().then((value) {
value.setBool("isShowPrivacyPolicy", true);
});
SharesdkPlugin.uploadPrivacyPermissionStatus(
1,
(success) => {
Navigator.of(context).pop(),
},
);
},
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 21.5.w,
right: 21.5.w,
),
backgroup: Color(0xff32A060),
radius: 23,
),
),
SizedBox(
height: 20.h,
),
],
),
],
)
],
));
},
);
}
toNext() {
SharedPreferences.getInstance().then((value) {
value.setBool("isFirst", false);
String? token = value.getString("token");
if (token?.isEmpty ?? true) {
Navigator.of(context).popAndPushNamed('/router/new_login_page');
} else {
Navigator.of(context).popAndPushNamed('/router/main_page');
}
});
}
}