201 lines
7.9 KiB
Dart
201 lines
7.9 KiB
Dart
import 'package:flutter/gestures.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter/services.dart';
|
||
|
||
import '../pages/mine/setting/privacy_policy.dart';
|
||
import '../pages/mine/setting/user_manual.dart';
|
||
import '../components/gradientButton.dart';
|
||
|
||
class WelcomeDialog extends StatelessWidget {
|
||
final VoidCallback onAgree;
|
||
final VoidCallback onBasicMode;
|
||
final VoidCallback onDisagree;
|
||
|
||
const WelcomeDialog({
|
||
super.key,
|
||
required this.onAgree,
|
||
required this.onBasicMode,
|
||
required this.onDisagree,
|
||
});
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
// 获取屏幕宽度
|
||
final screenWidth = MediaQuery.of(context).size.width;
|
||
|
||
// 定义统一的按钮高度和圆角
|
||
const double buttonHeight = 36.0;
|
||
const double buttonRadius = 8.0;
|
||
|
||
// 使用Material替代Dialog,以便可以完全控制宽度和边距
|
||
return Material(
|
||
type: MaterialType.transparency,
|
||
child: Center(
|
||
child: Container(
|
||
width: screenWidth * 0.80,
|
||
constraints: BoxConstraints(
|
||
minHeight: 320,
|
||
maxHeight: MediaQuery.of(context).size.height * 0.8,
|
||
),
|
||
decoration: BoxDecoration(
|
||
color: const Color(0xFF1F212E),
|
||
borderRadius: BorderRadius.circular(8),
|
||
),
|
||
child: Column(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
const SizedBox(height: 24),
|
||
const Text(
|
||
'欢迎使用看那',
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 16,
|
||
fontWeight: FontWeight.bold,
|
||
),
|
||
),
|
||
const SizedBox(height: 16),
|
||
Flexible(
|
||
child: Container(
|
||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||
padding: const EdgeInsets.all(12),
|
||
decoration: BoxDecoration(
|
||
color: const Color(0xFF292B37),
|
||
borderRadius: BorderRadius.circular(8),
|
||
),
|
||
child: const Text(
|
||
'根据政策要求,您需要在充分阅读并同意《用户协议》与《隐私政策》后,我们才能开始为您提供相应的功能或服务,同时我们会保护您的个人信息安全。\n\n如您同意以上内容,请点击"同意"开始使用我们的产品与服务。',
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 12,
|
||
height: 1.5,
|
||
),
|
||
textAlign: TextAlign.justify, // 两端对齐
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(height: 16),
|
||
RichText(
|
||
textAlign: TextAlign.center,
|
||
text: TextSpan(
|
||
style: const TextStyle(
|
||
color: Color.fromRGBO(255, 255, 255, 0.6),
|
||
fontSize: 12,
|
||
),
|
||
children: [
|
||
const TextSpan(text: '点击阅读'),
|
||
TextSpan(
|
||
text: '《用户协议》',
|
||
style: TextStyle(
|
||
color: Color(0xFF96FBE9).withOpacity(0.8), // 修改为半透明白色
|
||
),
|
||
recognizer: TapGestureRecognizer()
|
||
..onTap = () {
|
||
Navigator.push(
|
||
context,
|
||
MaterialPageRoute(builder: (context) => const UserManualPage()),
|
||
);
|
||
},
|
||
),
|
||
const TextSpan(text: '和'),
|
||
TextSpan(
|
||
text: '《隐私政策》',
|
||
style: TextStyle(
|
||
color: Color(0xFF96FBE9).withOpacity(0.8) // 修改为半透明白色
|
||
),
|
||
recognizer: TapGestureRecognizer()
|
||
..onTap = () {
|
||
Navigator.push(
|
||
context,
|
||
MaterialPageRoute(builder: (context) => const PrivacyPolicyPage()),
|
||
);
|
||
},
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 24),
|
||
Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||
child: Row(
|
||
children: [
|
||
// 不同意按钮 - 背景色#292B37,无边框,白色文字
|
||
Expanded(
|
||
child: SizedBox(
|
||
height: buttonHeight,
|
||
child: ElevatedButton(
|
||
onPressed: onDisagree,
|
||
style: ElevatedButton.styleFrom(
|
||
backgroundColor: const Color(0xFF292B37), // 背景色
|
||
elevation: 0,
|
||
shape: RoundedRectangleBorder(
|
||
borderRadius: BorderRadius.circular(buttonRadius),
|
||
),
|
||
padding: EdgeInsets.zero,
|
||
),
|
||
child: const Text(
|
||
'不同意',
|
||
style: TextStyle(
|
||
color: Colors.white, // 白色文字
|
||
fontSize: 14,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(width: 8),
|
||
// 基本模式按钮 - 边框和文字Color.fromRGBO(255, 255, 255, 0.6),背景色Color.fromRGBO(255, 255, 255, 0.3)
|
||
Expanded(
|
||
child: Container(
|
||
height: buttonHeight,
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(buttonRadius),
|
||
border: Border.all(
|
||
color: Color(0xFF96FBE9).withOpacity(0.8), // 半透明白色边框
|
||
width: 1,
|
||
),
|
||
color: Color(0xFF96FBE9).withOpacity(0.3), // 背景色
|
||
),
|
||
child: ElevatedButton(
|
||
onPressed: onBasicMode,
|
||
style: ElevatedButton.styleFrom(
|
||
backgroundColor: Colors.transparent,
|
||
elevation: 0,
|
||
shape: RoundedRectangleBorder(
|
||
borderRadius: BorderRadius.circular(buttonRadius),
|
||
),
|
||
padding: EdgeInsets.zero,
|
||
),
|
||
child: Text(
|
||
'基本模式',
|
||
style: TextStyle(
|
||
color: Color(0xFF96FBE9).withOpacity(0.8), // 半透明白色文字
|
||
fontSize: 14,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
const SizedBox(width: 8),
|
||
// 同意按钮 - 使用GradientButton组件
|
||
Expanded(
|
||
child: SizedBox(
|
||
height: buttonHeight,
|
||
child: GradientButton(
|
||
width: double.infinity,
|
||
height: buttonHeight,
|
||
text: '同意',
|
||
onPressed: onAgree,
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
const SizedBox(height: 24),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
} |