This commit is contained in:
Gaurav Kumar
2025-09-20 11:18:30 +05:30
parent 70c992ddb9
commit 6ace7ced7b
5 changed files with 15 additions and 1 deletions

View File

@@ -28,6 +28,10 @@ class CheckboxField extends BaseField {
required ColorScheme colorScheme,
VoidCallback? onChanged,
}) {
// Set default value to false if controller is empty
if (controller.text.isEmpty) {
controller.text = 'false';
}
final bool checked = controller.text.toLowerCase() == 'true';
return Row(
children: [

View File

@@ -1,3 +1,5 @@
// working code
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'base_field.dart';

View File

@@ -24,6 +24,11 @@ class SwitchField extends BaseField {
required ColorScheme colorScheme,
VoidCallback? onChanged,
}) {
// Set default value to true if controller is empty
if (controller.text.isEmpty) {
controller.text = 'true';
}
final bool current = (controller.text.toLowerCase() == 'true');
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,

View File

@@ -383,6 +383,7 @@
// }
// }
// }
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../core/providers/dynamic_theme_provider.dart';