fluffychat/lib/pangea/widgets/signup/tos_checkbox.dart
ggurdin 9ecf4e3bd2
fix: fix dart formatting for CI (#1368)
* fix: fix dart formatting for CI

* fix: sorted imports, updated deprecated flutter functions

* fix: format files

* fix: format files

* feat: replace syncfusion flutter package with excel flutter package

* fix: don't run enable google services patch in CI

* fix: update iOS supported platforms for enable ios build script

* fix: commented out linux build in integrate CI
2025-01-07 08:32:42 -05:00

89 lines
2.7 KiB
Dart

// Flutter imports:
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/utils/url_launcher.dart';
class TosCheckbox extends StatefulWidget {
final bool value;
final Function(bool?) onChange;
final String? error;
const TosCheckbox(
this.value,
this.onChange, {
this.error,
super.key,
});
@override
TosCheckboxState createState() => TosCheckboxState();
}
class TosCheckboxState extends State<TosCheckbox>
with SingleTickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () => UrlLauncher(context, AppConfig.termsOfServiceUrl)
.launchUrl(),
child: Padding(
padding: const EdgeInsets.only(left: 15),
child: RichText(
text: TextSpan(
text: L10n.of(context).iAgreeToThe,
children: [
TextSpan(
text: L10n.of(context).termsAndConditions,
style: const TextStyle(
decoration: TextDecoration.underline,
),
),
],
style: TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.onSurface,
),
),
),
),
),
AnimatedSize(
duration: FluffyThemes.animationDuration,
child: widget.error == null
? const SizedBox.shrink()
: Padding(
padding: const EdgeInsets.only(top: 4, left: 30),
child: Text(
widget.error!,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
fontSize: 12,
),
),
),
),
],
),
),
Checkbox(
value: widget.value,
activeColor: Theme.of(context).colorScheme.primary,
onChanged: widget.onChange,
),
],
);
}
}