fixes
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class CustomDropdown extends StatelessWidget{
|
||||
class CustomDropdown extends StatelessWidget {
|
||||
final List<Widget> items;
|
||||
final values;
|
||||
final onChanged;
|
||||
final value;
|
||||
final List<dynamic>? values;
|
||||
final ValueChanged<dynamic> onChanged;
|
||||
final dynamic value;
|
||||
final String? hint;
|
||||
final String? label;
|
||||
final double radius;
|
||||
@@ -25,43 +23,54 @@ class CustomDropdown extends StatelessWidget{
|
||||
this.radius = 12,
|
||||
this.width = double.infinity,
|
||||
this.height = 70,
|
||||
this.color
|
||||
this.color,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Column(
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (label != null) Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
label!,
|
||||
style: TextStyle(fontSize: 14, letterSpacing: 0),
|
||||
if (label != null)
|
||||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
label!,
|
||||
style: const TextStyle(fontSize: 14, letterSpacing: 0),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: width,
|
||||
height: height,
|
||||
child: Center(child: DropdownButtonFormField(
|
||||
dropdownColor: Colors.white,
|
||||
decoration: InputDecoration(
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
||||
borderSide: BorderSide(color: color??Color(0xFF4B4B4B))
|
||||
)
|
||||
child: Center(
|
||||
child: DropdownButtonFormField<dynamic>(
|
||||
dropdownColor: Colors.white,
|
||||
decoration: InputDecoration(
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
||||
borderSide: BorderSide(
|
||||
color: color ?? const Color(0xFF4B4B4B),
|
||||
),
|
||||
),
|
||||
),
|
||||
initialValue: value,
|
||||
onChanged: onChanged,
|
||||
hint: hint != null ? Text(hint!) : null,
|
||||
items: List<DropdownMenuItem<dynamic>>.generate(items.length, (
|
||||
int index,
|
||||
) {
|
||||
final dynamic itemValue = values != null
|
||||
? values![index]
|
||||
: index;
|
||||
return DropdownMenuItem<dynamic>(
|
||||
value: itemValue,
|
||||
child: items[index],
|
||||
);
|
||||
}),
|
||||
),
|
||||
//underline: Container(),
|
||||
initialValue: value,
|
||||
onChanged: onChanged,
|
||||
hint: Text(hint??""),
|
||||
items: List<DropdownMenuItem>.generate(items.length, (int index){
|
||||
return DropdownMenuItem(value: (values!=null)?values[index]:index, child: items[index]);
|
||||
})
|
||||
)),
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
) ;
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user