Files
plan_flutter/lib/page/system/login/widget/agreement_box.dart
2025-09-04 10:16:11 +08:00

74 lines
2.2 KiB
Dart

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
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!);
},
),
),
),
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"},
),
),
],
),
),
),
],
);
}
}