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});

  @override
  State<Settings> createState() => _SettingsState();
}

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 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))
          ],
        ),
      ),
    );
  }
}