38 lines
1.2 KiB
Dart
38 lines
1.2 KiB
Dart
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||
|
import 'networking.dart';
|
||
|
|
||
|
class Settings extends StatelessWidget {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: Text("Einstellungen"),
|
||
|
),
|
||
|
body: ListView(
|
||
|
padding: EdgeInsets.fromLTRB(20, 20, 20, 20),
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||
|
child: TextField(
|
||
|
decoration: InputDecoration(
|
||
|
icon: Icon(CupertinoIcons.lock),
|
||
|
border: OutlineInputBorder(),
|
||
|
labelText: 'API Key (POST /login)',
|
||
|
),
|
||
|
onSubmitted: (String value) async {
|
||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||
|
String api_key = value;
|
||
|
print('Set new API key to $api_key');
|
||
|
await prefs.setString('api_key', api_key);
|
||
|
}
|
||
|
)
|
||
|
),
|
||
|
Divider(),
|
||
|
buildClassesChooser()
|
||
|
],
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
}
|