switch
This commit is contained in:
		
							parent
							
								
									70c992ddb9
								
							
						
					
					
						commit
						6ace7ced7b
					
				| @ -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: [ | ||||
|  | ||||
| @ -1,3 +1,5 @@ | ||||
| // working code | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:provider/provider.dart'; | ||||
| import 'base_field.dart'; | ||||
|  | ||||
| @ -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, | ||||
|  | ||||
| @ -383,6 +383,7 @@ | ||||
| //     } | ||||
| //   } | ||||
| // } | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:provider/provider.dart'; | ||||
| import '../../../core/providers/dynamic_theme_provider.dart'; | ||||
|  | ||||
| @ -185,7 +185,9 @@ class _ModernTextFieldState extends State<ModernTextField> | ||||
|                     controller: widget.controller, | ||||
|                     focusNode: widget.focusNode, | ||||
|                     keyboardType: widget.keyboardType, | ||||
|                     obscureText: _obscureText, | ||||
|                     obscureText: widget.suffixIcon != null | ||||
|                         ? widget.obscureText | ||||
|                         : _obscureText, | ||||
|                     enabled: widget.enabled, | ||||
|                     readOnly: widget.readOnly, | ||||
|                     maxLines: widget.maxLines, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user