Create management portal in Flutter #39

This commit is contained in:
Scott E. Graves 2025-03-05 20:19:42 -06:00
parent 3a72563a5c
commit 58fde34cfe

View File

@ -18,13 +18,7 @@ class _AddMountWidgetState extends State<AddMountWidget> {
static const _items = <String>['Encrypt', 'Remote', 'S3', 'Sia'];
static const _padding = 15.0;
String? _mountType;
@override
void initState() {
_mountType = widget.mountType;
super.initState();
}
late String _mountType;
List<Widget> _createTextField(
String title,
@ -56,7 +50,7 @@ class _AddMountWidgetState extends State<AddMountWidget> {
@override
Widget build(BuildContext context) {
final mountTypeLower = _mountType?.toLowerCase();
final mountTypeLower = _mountType.toLowerCase();
return Column(
mainAxisSize: MainAxisSize.min,
@ -79,10 +73,10 @@ class _AddMountWidgetState extends State<AddMountWidget> {
DropdownButton<String>(
value: _mountType,
onChanged: (value) {
setState(() {
_mountType = value;
});
widget.onDataChanged('Provider', value);
setState(() {
_mountType = value ?? "";
});
},
items:
_items.map<DropdownMenuItem<String>>((item) {
@ -122,4 +116,10 @@ class _AddMountWidgetState extends State<AddMountWidget> {
],
);
}
@override
void initState() {
_mountType = widget.mountType;
super.initState();
}
}