import 'package:comwell_key_app/themes/dark_theme.dart';
import 'package:comwell_key_app/themes/light_theme.dart' show colorDivider;
import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
class AcceptTermsToggle extends StatelessWidget {
final bool isTermsAccepted;
final void Function(bool) onAcceptTermsChanged;
final void Function() onShowTermsAndConditions;
final bool showError;
const AcceptTermsToggle(
{super.key,
required this.isTermsAccepted,
required this.onAcceptTermsChanged,
required this.showError,
required this.onShowTermsAndConditions});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (showError)
Text(context.strings.please_accept_terms,
style: const TextStyle(color: colorError)),
Row(
children: [
Checkbox(
value: isTermsAccepted,
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
),
side: const BorderSide(color: colorDivider, width: 2,),
checkColor: Colors.white,
activeColor: sandColor[80],
onChanged: (value) {
onAcceptTermsChanged(value ?? false);
},
),
const SizedBox(width: 4),
Row(
children: [
Text(
context.strings.approve_conditions_title,
style: theme.textTheme.bodySmall?.copyWith(
color: colorHeadlineText,
),
),
const SizedBox(width: 4),
GestureDetector(
onTap: () {
onShowTermsAndConditions();
},
child: Text(
context.strings.approve_conditions_subtitle,
style: theme.textTheme.bodySmall?.copyWith(
color: sandColor[80],
decoration: TextDecoration.underline,
decorationColor: sandColor[80],
),
),
),
],
),
const SizedBox(height: 4),
],
),
],
);
}
}