83 lines
2.1 KiB
Dart
83 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:repertory/types/mount_config.dart';
|
|
import 'package:settings_ui/settings_ui.dart';
|
|
|
|
class MountSettingsWidget extends StatefulWidget {
|
|
final String title;
|
|
final MountConfig config;
|
|
const MountSettingsWidget({
|
|
super.key,
|
|
required this.config,
|
|
required this.title,
|
|
});
|
|
|
|
@override
|
|
State<MountSettingsWidget> createState() => _MountSettingsWidgetState();
|
|
}
|
|
|
|
class _MountSettingsWidgetState extends State<MountSettingsWidget> {
|
|
MountConfig? config;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
List<SettingsTile> commonSettings = [];
|
|
config?.settings.forEach((key, value) {
|
|
if (key == "ApiAuth") {
|
|
commonSettings.add(
|
|
SettingsTile.navigation(
|
|
leading: Icon(Icons.password),
|
|
title: Text(key),
|
|
value: Text('*' * (value as String).length),
|
|
),
|
|
);
|
|
} else if (key == "ApiPort") {
|
|
commonSettings.add(
|
|
SettingsTile.navigation(
|
|
leading: Icon(Icons.onetwothree),
|
|
title: Text(key),
|
|
value: Text((value as int).toString()),
|
|
),
|
|
);
|
|
} else if (key == "ApiUser") {
|
|
commonSettings.add(
|
|
SettingsTile.navigation(
|
|
leading: Icon(Icons.person),
|
|
title: Text(key),
|
|
value: Text(value),
|
|
),
|
|
);
|
|
} else if (key == "DatabaseType") {
|
|
commonSettings.add(
|
|
SettingsTile.navigation(
|
|
leading: Icon(Icons.dataset),
|
|
title: Text(key),
|
|
value: Text(value),
|
|
),
|
|
);
|
|
}
|
|
});
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
title: Text(widget.title),
|
|
),
|
|
body: SettingsList(
|
|
shrinkWrap: false,
|
|
sections: [
|
|
SettingsSection(
|
|
title: Text('Common Settings'),
|
|
tiles: commonSettings.toList(),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
config = widget.config;
|
|
super.initState();
|
|
}
|
|
}
|