70 lines
2.1 KiB
Dart
70 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
class IntroScreen extends StatefulWidget {
|
|
const IntroScreen({super.key});
|
|
|
|
@override
|
|
State<IntroScreen> createState() => _IntroScreenState();
|
|
}
|
|
|
|
class _IntroScreenState extends State<IntroScreen> {
|
|
TextEditingController nameVornameC = TextEditingController();
|
|
TextEditingController bLandC = TextEditingController();
|
|
|
|
Future<void> _saveData() async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
await prefs.setString('nameVorname', nameVornameC.text);
|
|
await prefs.setString('bLand', bLandC.text);
|
|
await prefs.setBool('isFirstLaunch', false);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('FFOrte'),
|
|
),
|
|
body: Center(
|
|
child: Container(
|
|
padding: const EdgeInsets.all(31),
|
|
child: Column(
|
|
children: [
|
|
TextField(
|
|
decoration: InputDecoration(
|
|
hintText: AppLocalizations.of(context)!.namevorname),
|
|
controller: nameVornameC,
|
|
onChanged: (value) => setState(() {
|
|
nameVornameC.text = value;
|
|
}),
|
|
),
|
|
const SizedBox(
|
|
height: 15,
|
|
),
|
|
TextField(
|
|
decoration: InputDecoration(
|
|
hintText: AppLocalizations.of(context)!.bland),
|
|
controller: bLandC,
|
|
onChanged: (value) => setState(() {
|
|
bLandC.text = value;
|
|
}),
|
|
),
|
|
const SizedBox(
|
|
height: 15,
|
|
),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
_saveData();
|
|
Navigator.pushNamedAndRemoveUntil(
|
|
context, '/home', (route) => false);
|
|
},
|
|
child: Text(AppLocalizations.of(context)!.continueB))
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|