Similar to using css and html. Goal would be to have a single file where we can set the color size or whatever other property for the Column, or DropDownMenu class and not have to repeat for every instance of the class.
CodePudding user response:
Try the following code:
class CustomColumn extends StatelessWidget {
const CustomColumn({super.key, required this.children});
final List<Widget> children;
@override
Widget build(BuildContext context) {
return Column(
// You can style your Column here
children: children,
);
}
}
class CustomDropdownButton extends StatelessWidget {
const CustomDropdownButton({super.key, required this.items, required this.onChanged});
final List<DropdownMenuItem> items;
final void Function(dynamic) onChanged;
@override
Widget build(BuildContext context) {
return DropdownButton(
items: items,
onChanged: onChanged,
// You can style your DropdownButton here
);
}
}