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.
213 lines
6.2 KiB
213 lines
6.2 KiB
import 'package:dating_touchme_app/pages/mine/open_webview.dart';
|
|
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class UserAgreementDialog extends StatefulWidget {
|
|
final VoidCallback onAgree;
|
|
final VoidCallback onDisagree;
|
|
|
|
const UserAgreementDialog({
|
|
super.key,
|
|
required this.onAgree,
|
|
required this.onDisagree,
|
|
});
|
|
|
|
@override
|
|
State<UserAgreementDialog> createState() => _UserAgreementDialogState();
|
|
}
|
|
|
|
class _UserAgreementDialogState extends State<UserAgreementDialog> {
|
|
late TapGestureRecognizer _userAgreementRecognizer;
|
|
late TapGestureRecognizer _privacyPolicyRecognizer;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_userAgreementRecognizer = TapGestureRecognizer()
|
|
..onTap = () {
|
|
Get.to(() => const OpenWebView(
|
|
url: "https://www.quzhaoqin.com/privacy.html",
|
|
title: "用户协议",
|
|
));
|
|
};
|
|
_privacyPolicyRecognizer = TapGestureRecognizer()
|
|
..onTap = () {
|
|
Get.to(() => const OpenWebView(
|
|
url: "https://www.quzhaoqin.com/information.html",
|
|
title: "隐私政策",
|
|
));
|
|
};
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_userAgreementRecognizer.dispose();
|
|
_privacyPolicyRecognizer.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: Colors.transparent,
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
color: Colors.black.withOpacity(0.5),
|
|
child: Center(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 40.w),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12.r),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// 标题
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 20.h),
|
|
child: Text(
|
|
'用户协议及隐私政策',
|
|
style: TextStyle(
|
|
fontSize: 18.sp,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black,
|
|
),
|
|
),
|
|
),
|
|
// 协议内容区域
|
|
Flexible(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w),
|
|
constraints: BoxConstraints(
|
|
maxHeight: MediaQuery.of(context).size.height * 0.5,
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: _buildAgreementContent(),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 20.h),
|
|
// 按钮区域
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
|
|
child: Row(
|
|
children: [
|
|
// 不同意按钮
|
|
Expanded(
|
|
child: _buildDisagreeButton(),
|
|
),
|
|
SizedBox(width: 12.w),
|
|
// 同意按钮
|
|
Expanded(
|
|
child: _buildAgreeButton(),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildAgreementContent() {
|
|
return RichText(
|
|
text: TextSpan(
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: Colors.black87,
|
|
height: 1.5,
|
|
),
|
|
children: [
|
|
const TextSpan(text: '欢迎使用趣恋恋。\n\n'),
|
|
const TextSpan(text: '在使用本应用前,请你仔细阅读并充分理解\n'),
|
|
TextSpan(
|
|
text: '《用户协议》',
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: const Color.fromRGBO(74, 99, 235, 1),
|
|
),
|
|
recognizer: _userAgreementRecognizer,
|
|
),
|
|
const TextSpan(text: ' 和 '),
|
|
TextSpan(
|
|
text: '《隐私政策》',
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: const Color.fromRGBO(74, 99, 235, 1),
|
|
),
|
|
recognizer: _privacyPolicyRecognizer,
|
|
),
|
|
const TextSpan(text: '。\n\n'),
|
|
const TextSpan(text: '我们将严格按照协议内容使用并保护你的个人信息。\n\n'),
|
|
const TextSpan(text: '点击「同意」即表示你已阅读并同意上述协议。'),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildDisagreeButton() {
|
|
return InkWell(
|
|
onTap: widget.onDisagree,
|
|
borderRadius: BorderRadius.circular(8.r),
|
|
child: Container(
|
|
height: 44.h,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: const Color.fromRGBO(131, 89, 255, 1),
|
|
width: 1,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.r),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
'不同意',
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
color: const Color.fromRGBO(131, 89, 255, 1),
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildAgreeButton() {
|
|
return InkWell(
|
|
onTap: widget.onAgree,
|
|
borderRadius: BorderRadius.circular(8.r),
|
|
child: Container(
|
|
height: 44.h,
|
|
decoration: BoxDecoration(
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color.fromRGBO(131, 89, 255, 1),
|
|
Color.fromRGBO(61, 138, 224, 1),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.r),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
'同意',
|
|
style: TextStyle(
|
|
fontSize: 16.sp,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|