import 'package:flutter/material.dart'; class SubDropdownInputWidget extends StatefulWidget { String subkey; double width; bool empty; String? initialValue; List> dropdownMenuEntries = []; void Function(String?)? change = (value) {}; SubDropdownInputWidget ({ super.key, required this.dropdownMenuEntries, this.initialValue, required this.subkey, required this.width, required this.empty, required this.change }); @override SubDropdownInputWidgetState createState() => SubDropdownInputWidgetState(); } class SubDropdownInputWidgetState extends State { @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: widget.subkey, child: Container( margin: EdgeInsets.only(top: widget.empty ? 0 : 15), width: widget.width, height: 30, child: DropdownButtonFormField( isExpanded: true, items: widget.dropdownMenuEntries, value: widget.initialValue, onChanged: widget.change, style: const TextStyle(fontSize: 12,color: Colors.black, overflow: TextOverflow.ellipsis), decoration: InputDecoration( hintText: "select ${widget.subkey}...", fillColor: Colors.white, filled: true, labelText: widget.subkey, alignLabelWithHint: false, errorStyle: const TextStyle(fontSize: 0), hintStyle: const TextStyle(fontSize: 10), labelStyle: const TextStyle(fontSize: 10), floatingLabelBehavior: FloatingLabelBehavior.always, enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)), border: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)), contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), ), ))), ]); } }