sitzung luc
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
@@ -11,14 +10,33 @@ class IntroScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _IntroScreenState extends State<IntroScreen> {
|
||||
TextEditingController nameVornameC = TextEditingController();
|
||||
TextEditingController addresse1C = TextEditingController();
|
||||
TextEditingController bLandC = TextEditingController();
|
||||
TextEditingController apiAddress = TextEditingController();
|
||||
|
||||
Future<void> _saveData() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString('nameVorname', nameVornameC.text);
|
||||
await prefs.setString('addresse1', addresse1C.text);
|
||||
await prefs.setString('bLand', bLandC.text);
|
||||
await prefs.setBool('isFirstLaunch', false);
|
||||
await prefs.setString('apiAddress', apiAddress.text);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadPrefs();
|
||||
}
|
||||
|
||||
void _loadPrefs() {
|
||||
Future.delayed(Duration.zero, () async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
setState(() {
|
||||
apiAddress.text = prefs.getString('apiAddress') ?? "";
|
||||
addresse1C.text = prefs.getString('addresse1') ?? "";
|
||||
bLandC.text = prefs.getString('bLand') ?? "";
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -34,10 +52,10 @@ class _IntroScreenState extends State<IntroScreen> {
|
||||
children: [
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.namevorname),
|
||||
controller: nameVornameC,
|
||||
hintText: AppLocalizations.of(context)!.benutzername),
|
||||
controller: addresse1C,
|
||||
onChanged: (value) => setState(() {
|
||||
nameVornameC.text = value;
|
||||
addresse1C.text = value;
|
||||
}),
|
||||
),
|
||||
const SizedBox(
|
||||
@@ -45,8 +63,8 @@ class _IntroScreenState extends State<IntroScreen> {
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
DropdownButton(
|
||||
hint: Text(bLandC.text),
|
||||
DropdownButton(
|
||||
hint: Text(bLandC.text),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'Baden-Württemberg',
|
||||
@@ -118,10 +136,18 @@ class _IntroScreenState extends State<IntroScreen> {
|
||||
bLandC.text = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
TextField(
|
||||
controller: bLandC,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
controller: bLandC,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.apiaddress),
|
||||
controller: apiAddress,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user