Create management portal in Flutter #39
This commit is contained in:
parent
5e47cdb861
commit
b4fd093e7c
@ -65,11 +65,7 @@ class _AddMountScreenState extends State<AddMountScreen> {
|
|||||||
const SizedBox(width: _padding),
|
const SizedBox(width: _padding),
|
||||||
DropdownButton<String>(
|
DropdownButton<String>(
|
||||||
value: _mountType,
|
value: _mountType,
|
||||||
onChanged: (newValue) {
|
onChanged: (mountType) => _handleChange(mountType ?? ''),
|
||||||
setState(() {
|
|
||||||
_mountType = newValue ?? "";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
items:
|
items:
|
||||||
providerTypeList.map<DropdownMenuItem<String>>((
|
providerTypeList.map<DropdownMenuItem<String>>((
|
||||||
item,
|
item,
|
||||||
@ -100,21 +96,7 @@ class _AddMountScreenState extends State<AddMountScreen> {
|
|||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: _mountNameController,
|
controller: _mountNameController,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
onChanged: (_) {
|
onChanged: (_) => _handleChange(_mountType),
|
||||||
setState(() {
|
|
||||||
_mount =
|
|
||||||
(_mountNameController.text.isEmpty)
|
|
||||||
? null
|
|
||||||
: Mount(
|
|
||||||
MountConfig(
|
|
||||||
name: _mountNameController.text,
|
|
||||||
settings: _settings[_mountType],
|
|
||||||
type: _mountType,
|
|
||||||
),
|
|
||||||
isAdd: true,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -140,6 +122,23 @@ class _AddMountScreenState extends State<AddMountScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleChange(String mountType) {
|
||||||
|
setState(() {
|
||||||
|
_mountType = mountType;
|
||||||
|
_mount =
|
||||||
|
(_mountNameController.text.isEmpty)
|
||||||
|
? null
|
||||||
|
: Mount(
|
||||||
|
MountConfig(
|
||||||
|
name: _mountNameController.text,
|
||||||
|
settings: _settings[_mountType],
|
||||||
|
type: _mountType,
|
||||||
|
),
|
||||||
|
isAdd: true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback fn) {
|
void setState(VoidCallback fn) {
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user