BotZ_app/lib/ui/settings_page.dart

44 lines
1.3 KiB
Dart
Raw Normal View History

2019-08-30 01:29:37 +02:00
import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'dart:async';
import 'drawer.dart';
var log = Logger();
class SettingsPage extends StatelessWidget {
SettingsPage({this.title = "Settings"});
final String title;
Future<void> _goToServerForm(BuildContext context) async {
log.d("Going to server form");
var persistence = await SharedPreferences.getInstance();
persistence.setString("nextRoute", "/settings");
Navigator.of(context).pushNamed("/settings/server");
}
Future<void> _goToCredentialsForm(BuildContext context) async {
log.d("Going to credentials form");
var persistence = await SharedPreferences.getInstance();
persistence.setString("nextRoute", "/settings");
Navigator.of(context).pushNamed("/settings/credentials");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: ListView(padding: EdgeInsets.all(5), children: <Widget>[
ListTile(
title: Text("Change credentials"),
onTap: () => _goToCredentialsForm(context)),
ListTile(
title: Text("Change server configurations"),
onTap: () => _goToServerForm(context)),
]),
drawer: theDrawer(context),
);
}
}