import 'package:flutter/material.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../login.dart'; class DevSettings extends StatelessWidget { const DevSettings({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("Entwickler-Einstellungen"), centerTitle: true, ), body: ListView( padding: const EdgeInsets.fromLTRB(20, 20, 20, 20), children: [ Padding( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), child: TextField( decoration: const InputDecoration( icon: Icon(MdiIcons.keyOutline), border: OutlineInputBorder(), labelText: 'MeinCantor API-Schlüssel', ), onSubmitted: (String value) async { SharedPreferences prefs = await SharedPreferences.getInstance(); String apiKey = value; await prefs.setString('api_key', apiKey); final snackBar = SnackBar( content: Text('Neuer API-Schlüssel gesetzt: $apiKey')); ScaffoldMessenger.of(context).showSnackBar(snackBar); })), const Divider(), Padding( padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), child: OutlinedButton( onPressed: () async { Navigator.push( context, MaterialPageRoute(builder: (context) => Login()), ); }, child: const Text("Benutzerdaten neu laden"), ) ) ], )); } }