This commit is contained in:
zhutao
2025-09-04 17:57:35 +08:00
parent 4d12f8afc2
commit 0231dcfe1a
34 changed files with 1339 additions and 368 deletions

View File

@@ -26,9 +26,6 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> {
var _subLoading = false;
///协议
bool _agree = false;
///谷歌登陆
final GoogleSignIn _googleSignIn = GoogleSignIn.instance;
@@ -80,11 +77,6 @@ class _LoginPageState extends State<LoginPage> {
///谷歌登录
void _handleGoogleSignIn() async {
if (!_agree) {
EasyLoading.showToast('Please read and agree to the terms first.');
return;
}
try {
// 如果用户未登录,则启动标准的 Google 登录
if (_googleSignIn.supportsAuthenticate()) {
@@ -120,11 +112,6 @@ class _LoginPageState extends State<LoginPage> {
///apple登录
void _handAppleSignIn() async {
if (!_agree) {
EasyLoading.showToast('Please read and agree to the terms first.');
return;
}
try {
final credential = await SignInWithApple.getAppleIDCredential(scopes: [AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName]);
EasyLoading.show(status: "Logging in...");
@@ -139,10 +126,6 @@ class _LoginPageState extends State<LoginPage> {
}
void _handSubmit() async {
if (!_agree) {
EasyLoading.showToast('Please read and agree to the terms first.');
return;
}
if (_emailController.text.isEmpty) {
//请输入邮箱
EasyLoading.showError("Please enter your email");
@@ -238,14 +221,7 @@ class _LoginPageState extends State<LoginPage> {
width: double.infinity,
margin: EdgeInsets.only(top: 40),
alignment: Alignment.center,
child: AgreementBox(
checked: _agree,
onChanged: (value) {
setState(() {
_agree = value;
});
},
),
child: AgreementBox(),
),
],
),

View File

@@ -6,68 +6,40 @@ import '../../../../router/config/route_paths.dart';
///勾中协议
class AgreementBox extends StatelessWidget {
final bool checked;
final Function(bool) onChanged;
const AgreementBox({
super.key,
this.checked = false,
required this.onChanged,
});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 25,
child: Transform.scale(
scale: 0.8,
child: Checkbox(
value: checked,
shape: CircleBorder(),
onChanged: (value) {
onChanged(value!);
},
),
return Text.rich(
textAlign: TextAlign.center,
TextSpan(
style: Theme.of(context).textTheme.labelSmall,
children: [
const TextSpan(text: "By logging in, you agree to our "),
TextSpan(
text: "Terms",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Terms of Service", "url": "https://support.curain.ai/privacy/foodcura/terms_service.html"},
),
),
),
GestureDetector(
onTap: () {
onChanged(!checked);
},
child: RichText(
text: TextSpan(
style: Theme.of(context).textTheme.labelSmall,
children: [
TextSpan(
text: "I agree to the ",
),
TextSpan(
text: "Terms",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Terms of Service", "url": "https://support.curain.ai/privacy/foodcura/terms_service.html"},
),
),
TextSpan(text: " & "),
TextSpan(
text: "Privacy Policy",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Privacy", "url": "https://support.curain.ai/privacy/foodcura/privacy_policy.html"},
),
),
],
),
const TextSpan(text: " and "),
TextSpan(
text: "Privacy Policy",
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () => context.push(
RoutePaths.agreement,
extra: {"title": "Privacy", "url": "https://support.curain.ai/privacy/foodcura/privacy_policy.html"},
),
),
),
],
const TextSpan(text: "."),
],
),
);
}
}

View File

@@ -10,12 +10,15 @@ class LogoBox extends StatelessWidget {
margin: EdgeInsets.only(bottom: 40),
child: Column(
children: [
Image.asset(
"assets/image/logo.png",
width: 43,
ClipRRect(
borderRadius: BorderRadius.circular(5),
child: Image.asset(
"assets/image/logo.png",
width: 43,
),
),
Text(
"FoodCura",
"PlanCura",
style: Theme.of(context).textTheme.titleSmall,
),
],