2024-10-15 11:28:29 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class SubDropdownInputWidget extends StatefulWidget {
|
|
|
|
String subkey;
|
|
|
|
double width;
|
|
|
|
bool empty;
|
2025-02-05 09:07:39 +01:00
|
|
|
String? initialValue;
|
2024-10-15 11:28:29 +02:00
|
|
|
List<DropdownMenuItem<String>> dropdownMenuEntries = [];
|
|
|
|
void Function(String?)? change = (value) {};
|
2025-02-05 09:07:39 +01:00
|
|
|
SubDropdownInputWidget ({ super.key, required this.dropdownMenuEntries, this.initialValue,
|
|
|
|
required this.subkey, required this.width, required this.empty, required this.change });
|
2024-10-15 11:28:29 +02:00
|
|
|
@override SubDropdownInputWidgetState createState() => SubDropdownInputWidgetState();
|
|
|
|
}
|
|
|
|
class SubDropdownInputWidgetState extends State<SubDropdownInputWidget> {
|
|
|
|
|
|
|
|
@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(
|
2025-02-05 09:07:39 +01:00
|
|
|
isExpanded: true,
|
2024-10-15 11:28:29 +02:00
|
|
|
items: widget.dropdownMenuEntries,
|
2025-02-05 09:07:39 +01:00
|
|
|
value: widget.initialValue,
|
2024-10-15 11:28:29 +02:00
|
|
|
onChanged: widget.change,
|
2025-02-05 09:07:39 +01:00
|
|
|
style: const TextStyle(fontSize: 12,color: Colors.black, overflow: TextOverflow.ellipsis),
|
2024-10-15 11:28:29 +02:00
|
|
|
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),
|
|
|
|
),
|
|
|
|
))),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|