Spaces:
Configuration error
Configuration error
| library; | |
| import 'package:flutter/material.dart'; | |
| import 'package:smart_attendance_app/app/theme.dart'; | |
| class GlassInput extends StatelessWidget { | |
| final TextEditingController? controller; | |
| final String? label; | |
| final String? hint; | |
| final IconData? prefixIcon; | |
| final bool obscureText; | |
| final TextInputType keyboardType; | |
| final String? Function(String?)? validator; | |
| final ValueChanged<String>? onChanged; | |
| final bool enabled; | |
| final Widget? suffix; | |
| const GlassInput({ | |
| super.key, | |
| this.controller, | |
| this.label, | |
| this.hint, | |
| this.prefixIcon, | |
| this.obscureText = false, | |
| this.keyboardType = TextInputType.text, | |
| this.validator, | |
| this.onChanged, | |
| this.enabled = true, | |
| this.suffix, | |
| }); | |
| Widget build(BuildContext context) { | |
| return Column( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| mainAxisSize: MainAxisSize.min, | |
| children: [ | |
| if (label != null) ...[ | |
| Text( | |
| label!, | |
| style: const TextStyle( | |
| color: SasColors.textSecondary, | |
| fontSize: 13, | |
| fontWeight: FontWeight.w600, | |
| letterSpacing: 0.03, | |
| ), | |
| ), | |
| const SizedBox(height: 8), | |
| ], | |
| TextFormField( | |
| controller: controller, | |
| obscureText: obscureText, | |
| keyboardType: keyboardType, | |
| validator: validator, | |
| onChanged: onChanged, | |
| enabled: enabled, | |
| style: const TextStyle( | |
| color: SasColors.textPrimary, | |
| fontSize: 16, | |
| ), | |
| decoration: InputDecoration( | |
| hintText: hint, | |
| prefixIcon: prefixIcon != null | |
| ? Padding( | |
| padding: const EdgeInsets.only(left: 14, right: 10), | |
| child: Icon( | |
| prefixIcon, | |
| size: 20, | |
| color: SasColors.textMuted, | |
| ), | |
| ) | |
| : null, | |
| prefixIconConstraints: const BoxConstraints( | |
| minWidth: 44, | |
| minHeight: 44, | |
| ), | |
| suffixIcon: suffix, | |
| filled: true, | |
| fillColor: const Color(0x80030410), | |
| contentPadding: | |
| const EdgeInsets.symmetric(horizontal: 18, vertical: 14), | |
| border: OutlineInputBorder( | |
| borderRadius: BorderRadius.circular(12), | |
| borderSide: const BorderSide(color: SasColors.glassBorder), | |
| ), | |
| enabledBorder: OutlineInputBorder( | |
| borderRadius: BorderRadius.circular(12), | |
| borderSide: const BorderSide(color: SasColors.glassBorder), | |
| ), | |
| focusedBorder: OutlineInputBorder( | |
| borderRadius: BorderRadius.circular(12), | |
| borderSide: const BorderSide( | |
| color: SasColors.glassBorderHover, | |
| width: 1.5, | |
| ), | |
| ), | |
| errorBorder: OutlineInputBorder( | |
| borderRadius: BorderRadius.circular(12), | |
| borderSide: BorderSide( | |
| color: SasColors.accentPink.withValues(alpha: 0.5), | |
| ), | |
| ), | |
| ), | |
| ), | |
| ], | |
| ); | |
| } | |
| } | |