Create management portal in Flutter #39
This commit is contained in:
parent
8a18e7a4c9
commit
199aea55be
@ -30,7 +30,7 @@ class AddMountWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _AddMountWidgetState extends State<AddMountWidget> {
|
class _AddMountWidgetState extends State<AddMountWidget> {
|
||||||
static const _items = <String>['Encrypt', 'Remote', 'S3', 'Sia'];
|
static const _items = <String>['Encrypt', 'Remote', 'S3', 'Sia'];
|
||||||
static const _padding = 10.0;
|
static const _padding = 15.0;
|
||||||
|
|
||||||
String? _mountType;
|
String? _mountType;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ class _AddMountWidgetState extends State<AddMountWidget> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _createTextField(String name, onChanged) {
|
List<Widget> _createTextField(String name, onChanged, {String? value}) {
|
||||||
return [
|
return [
|
||||||
const SizedBox(height: _padding),
|
const SizedBox(height: _padding),
|
||||||
Text(
|
Text(
|
||||||
@ -51,7 +51,11 @@ class _AddMountWidgetState extends State<AddMountWidget> {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(decoration: InputDecoration(), onChanged: onChanged),
|
TextField(
|
||||||
|
decoration: InputDecoration(),
|
||||||
|
onChanged: onChanged,
|
||||||
|
controller: TextEditingController(text: value),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,11 +104,23 @@ class _AddMountWidgetState extends State<AddMountWidget> {
|
|||||||
if (mountTypeLower == 'sia')
|
if (mountTypeLower == 'sia')
|
||||||
..._createTextField('ApiAuth', widget.onApiAuthChanged),
|
..._createTextField('ApiAuth', widget.onApiAuthChanged),
|
||||||
if (mountTypeLower == 's3' || mountTypeLower == 'sia')
|
if (mountTypeLower == 's3' || mountTypeLower == 'sia')
|
||||||
..._createTextField('Bucket', widget.onBucketChanged),
|
..._createTextField(
|
||||||
if (mountTypeLower == 'remote')
|
'Bucket',
|
||||||
..._createTextField('HostNameOrIp', widget.onHostNameOrIpChanged),
|
widget.onBucketChanged,
|
||||||
if (mountTypeLower == 'remote')
|
value: mountTypeLower == 'sia' ? 'default' : null,
|
||||||
..._createTextField('ApiPort', widget.onApiPortChanged),
|
),
|
||||||
|
if (mountTypeLower == 'remote' || mountTypeLower == 'sia')
|
||||||
|
..._createTextField(
|
||||||
|
'HostNameOrIp',
|
||||||
|
widget.onHostNameOrIpChanged,
|
||||||
|
value: 'localhost',
|
||||||
|
),
|
||||||
|
if (mountTypeLower == 'remote' || mountTypeLower == 'sia')
|
||||||
|
..._createTextField(
|
||||||
|
'ApiPort',
|
||||||
|
widget.onApiPortChanged,
|
||||||
|
value: mountTypeLower == 'sia' ? '9980' : null,
|
||||||
|
),
|
||||||
if (mountTypeLower == 'remote')
|
if (mountTypeLower == 'remote')
|
||||||
..._createTextField(
|
..._createTextField(
|
||||||
'EncryptionToken',
|
'EncryptionToken',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user