added last save location in settings

This commit is contained in:
Nico
2024-03-24 15:24:37 +01:00
parent edfe6c31bb
commit a902541591
6 changed files with 116 additions and 28 deletions

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:shared_preferences/shared_preferences.dart';
class Settings extends StatefulWidget {
const Settings({super.key});
@@ -8,8 +10,40 @@ class Settings extends StatefulWidget {
}
class _SettingsState extends State<Settings> {
Future<String> _getSaveDir() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
final String saveDir = prefs.getString('saveDir') ?? "";
return saveDir;
}
@override
Widget build(BuildContext context) {
return const Placeholder();
return Scaffold(
appBar: AppBar(title: Text(AppLocalizations.of(context)!.settings),),
body: Center(
child: Column(
children: [
Text(AppLocalizations.of(context)!.filelocation, style: const TextStyle(fontSize: 20),),
FutureBuilder(future: _getSaveDir(), builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Text(snapshot.data ?? "");
} else {
return const CircularProgressIndicator();
}
}),
ElevatedButton(onPressed: () {
}, child: Text(AppLocalizations.of(context)!.open))
],
),
),
);
}
}