Skip to content

Commit

Permalink
Add autoFormValidation to MetaDataField (#125)
Browse files Browse the repository at this point in the history
Remove hardcoded styling for BooleanMetaDataField to
prevent it from overriding an app's ThemeData
  • Loading branch information
bcorman authored Oct 16, 2024
1 parent 28e064e commit 538f7c4
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions lib/src/components/supa_email_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
: null,
builder: (FormFieldState<bool> field) {
final theme = Theme.of(context);
final isDark =
theme.brightness == Brightness.dark;

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand All @@ -389,24 +387,6 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
contentPadding:
const EdgeInsets.symmetric(
horizontal: 4.0),
activeColor: theme.colorScheme.primary,
checkColor: theme.colorScheme.onPrimary,
tileColor: isDark
? theme.inputDecorationTheme.fillColor
: null,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
side: BorderSide(
color: field.hasError
? theme.colorScheme.error
: theme
.inputDecorationTheme
.border
?.borderSide
.color ??
theme.dividerColor,
),
),
),
if (field.hasError)
Padding(
Expand Down Expand Up @@ -440,6 +420,8 @@ class _SupaEmailAuthState extends State<SupaEmailAuth> {
prefixIcon: metadataField.prefixIcon,
),
validator: metadataField.validator,
autovalidateMode:
AutovalidateMode.onUserInteraction,
onFieldSubmitted: (_) {
if (metadataField !=
widget.metadataFields!.last) {
Expand Down

0 comments on commit 538f7c4

Please sign in to comment.