Untitled
unknown
plain_text
2 years ago
2.9 kB
4
Indexable
import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:sanad_flutter/core/config/app_localization.dart'; import 'package:sanad_flutter/core/config/global_variables.dart'; import 'package:sanad_flutter/core/config/sanad_colors.dart'; class CustomDropDownID extends StatelessWidget { CustomDropDownID( {super.key, this.fillColor, required this.onChanged, this.value, required this.labelText, required this.items, this.margin, this.validator}); void Function(Object?)? onChanged; Color? fillColor; Object? value; String labelText; List<DropdownMenuItem<Object>>? items; EdgeInsetsGeometry? margin; final String? Function(Object?)? validator; @override Widget build(BuildContext context) { return Container( margin: margin ?? EdgeInsets.symmetric(horizontal: 0.025.sw), child: DropdownButtonFormField( isExpanded: true, validator: validator, value: value, onChanged: onChanged, decoration: InputDecoration( fillColor: fillColor ?? selectColor(context, Colors.transparent, textFieldDark.withAlpha(150)), filled: true, focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(radius), borderSide: BorderSide( color: selectColor( context, textFieldBorderLight, textFieldBorderDark), width: 1), ), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(radius), borderSide: BorderSide( color: selectColor( context, textFieldBorderLight, textFieldBorderDark), width: 1), ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(radius), borderSide: BorderSide(color: red, width: 2), ), focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(radius), borderSide: BorderSide(color: red, width: 1), ), contentPadding: const EdgeInsets.symmetric(horizontal: 8.0), border: OutlineInputBorder( borderRadius: BorderRadius.circular(radius), borderSide: BorderSide( color: selectColor( context, Colors.transparent, Colors.white))), labelText: AppLocalization.of(context).getTranslatedValues(labelText), hintText: ''), items: items), ); } }
Editor is loading...