/opt/canhelp/apps/mobile/lib/widgets
Edit: /opt/canhelp/apps/mobile/lib/widgets/auth_terms_consent.dart (3928B)
import 'package:flutter/material.dart';
import '../providers/locale_provider.dart';
import '../theme/app_theme.dart';
class AuthTermsConsent extends StatelessWidget {
const AuthTermsConsent({
super.key,
required this.locale,
required this.value,
required this.onChanged,
required this.onOpenTerms,
});
final LocaleProvider locale;
final bool value;
final ValueChanged
onChanged;
final VoidCallback onOpenTerms;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: AppTheme.surfaceVariant,
borderRadius: BorderRadius.circular(AppTheme.smallRadius),
border: Border.all(color: AppTheme.border),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Checkbox(
value: value,
onChanged: (v) => onChanged(v ?? false),
activeColor: AppTheme.primary,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 10),
child: Wrap(
spacing: 4,
runSpacing: 2,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text(
locale.t('auth.termsPrefix', 'I accept'),
style: const TextStyle(
color: AppTheme.textPrimary,
fontSize: 13,
),
),
GestureDetector(
onTap: onOpenTerms,
child: Text(
locale.t('auth.termsLink', 'Terms of Use'),
style: const TextStyle(
color: AppTheme.primary,
fontSize: 13,
fontWeight: FontWeight.w600,
decoration: TextDecoration.underline,
decorationColor: AppTheme.primary,
),
),
),
Text(
locale.t('auth.termsAnd', 'and'),
style: const TextStyle(
color: AppTheme.textPrimary,
fontSize: 13,
),
),
GestureDetector(
onTap: onOpenTerms,
child: Text(
locale.t('auth.communityRulesLink', 'Community Rules'),
style: const TextStyle(
color: AppTheme.primary,
fontSize: 13,
fontWeight: FontWeight.w600,
decoration: TextDecoration.underline,
decorationColor: AppTheme.primary,
),
),
),
],
),
),
),
],
),
);
}
}
Future showAuthTermsDialog(BuildContext context, LocaleProvider locale) {
return showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text(locale.t('auth.termsTitle', 'Terms of Use')),
content: SingleChildScrollView(
child: Text(
locale.t(
'auth.termsBody',
'By using CanHelp, you agree not to post spam, fraudulent, abusive, or illegal content. Violators may be blocked and content may be removed. By posting tasks and messages, you accept responsibility for their content.',
),
style: const TextStyle(fontSize: 14, height: 1.35),
),
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(locale.t('common.ok', 'OK')),
),
],
),
);
}