|
|
|
@ -20,57 +20,96 @@ class SettingsView extends StatelessWidget {
|
|
|
|
|
title: const Text('Settings'),
|
|
|
|
|
),
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
DropdownButton<ThemeMode>(
|
|
|
|
|
value: controller.themeMode,
|
|
|
|
|
onChanged: controller.updateThemeMode,
|
|
|
|
|
items: const [
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: ThemeMode.system,
|
|
|
|
|
child: Text('System Theme'),
|
|
|
|
|
),
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: ThemeMode.light,
|
|
|
|
|
child: Text('Light Theme'),
|
|
|
|
|
),
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: ThemeMode.dark,
|
|
|
|
|
child: Text('Dark Theme'),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Hostname",
|
|
|
|
|
),
|
|
|
|
|
initialValue: controller.hostname,
|
|
|
|
|
onChanged: controller.setHostname,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Username",
|
|
|
|
|
),
|
|
|
|
|
initialValue: controller.username,
|
|
|
|
|
onChanged: controller.setUsername,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Password",
|
|
|
|
|
),
|
|
|
|
|
obscureText: true,
|
|
|
|
|
enableSuggestions: false,
|
|
|
|
|
autocorrect: false,
|
|
|
|
|
initialValue: controller.password,
|
|
|
|
|
onChanged: controller.setPassword,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
themeSelector(),
|
|
|
|
|
...hostSelector(),
|
|
|
|
|
...loginForm(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget themeSelector() {
|
|
|
|
|
return DropdownButton<ThemeMode>(
|
|
|
|
|
value: controller.themeMode,
|
|
|
|
|
onChanged: controller.updateThemeMode,
|
|
|
|
|
items: const [
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: ThemeMode.system,
|
|
|
|
|
child: Text('System Theme'),
|
|
|
|
|
),
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: ThemeMode.light,
|
|
|
|
|
child: Text('Light Theme'),
|
|
|
|
|
),
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: ThemeMode.dark,
|
|
|
|
|
child: Text('Dark Theme'),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> hostSelector() {
|
|
|
|
|
return [
|
|
|
|
|
DropdownButton<String>(
|
|
|
|
|
value: controller.protocol.isEmpty ? 'https://' : controller.protocol,
|
|
|
|
|
onChanged: controller.setProtocol,
|
|
|
|
|
items: const [
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: 'https://',
|
|
|
|
|
child: Text('https://'),
|
|
|
|
|
),
|
|
|
|
|
DropdownMenuItem(
|
|
|
|
|
value: 'http://',
|
|
|
|
|
child: Text('http://'),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Hostname",
|
|
|
|
|
),
|
|
|
|
|
initialValue: controller.hostname,
|
|
|
|
|
onChanged: controller.setHostname,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Port",
|
|
|
|
|
),
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
initialValue: controller.port,
|
|
|
|
|
onChanged: controller.setPort,
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> loginForm() {
|
|
|
|
|
return [
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Username",
|
|
|
|
|
),
|
|
|
|
|
initialValue: controller.username,
|
|
|
|
|
onChanged: controller.setUsername,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: UnderlineInputBorder(),
|
|
|
|
|
labelText: "Password",
|
|
|
|
|
),
|
|
|
|
|
obscureText: true,
|
|
|
|
|
enableSuggestions: false,
|
|
|
|
|
autocorrect: false,
|
|
|
|
|
initialValue: controller.password,
|
|
|
|
|
onChanged: controller.setPassword,
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|