70 lines
2.4 KiB
Dart
70 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_provisioning_for_iot/objects/cloud_service_api.dart';
|
|
|
|
import '../widgets/sidebar.dart';
|
|
|
|
class Settings extends StatefulWidget {
|
|
const Settings({Key? key}) : super(key: key);
|
|
static CloudServiceAPI cloudService = CloudServiceAPI();
|
|
|
|
static String address = cloudService.getAddress();
|
|
static String username = cloudService.getUsername();
|
|
static String password = cloudService.getPassword();
|
|
|
|
@override
|
|
State<Settings> createState() => _SettingsState();
|
|
|
|
/// Initializes the Settings with the correct Values from the last session
|
|
static Future initSettings() async {
|
|
}
|
|
}
|
|
|
|
class _SettingsState extends State<Settings> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
// Here we take the value from the MyHomePage object that was created by
|
|
// the App.build method, and use it to set our appbar title.
|
|
title: const Text("Settings"),
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
children: [
|
|
TextFormField(
|
|
decoration: const InputDecoration(
|
|
labelText: "Address for the Device Manager"),
|
|
initialValue: Settings.address,
|
|
keyboardType: TextInputType.text,
|
|
onChanged: (String newValue) {
|
|
Settings.address = newValue;
|
|
Settings.cloudService.setAddress(newValue);
|
|
},
|
|
),
|
|
TextFormField(
|
|
decoration: const InputDecoration(
|
|
labelText: "Username"),
|
|
keyboardType: TextInputType.text,
|
|
initialValue: Settings.username,
|
|
onChanged: (String newValue) {
|
|
Settings.username = newValue;
|
|
Settings.cloudService.setUsername(newValue);
|
|
},
|
|
),
|
|
TextFormField(
|
|
decoration: const InputDecoration(
|
|
labelText: "Password"),
|
|
keyboardType: TextInputType.text,
|
|
initialValue: Settings.password,
|
|
onChanged: (String newValue) {
|
|
Settings.password = newValue;
|
|
Settings.cloudService.setPassword(newValue);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
drawer: const Sidebar());
|
|
}
|
|
}
|