1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00

fixed settings overflow

added option to disable snackbar for login
added option to customize theme based on dark mode status
This commit is contained in:
Benimautner 2023-05-17 12:28:55 +02:00
parent 6176af2acb
commit b126f54542
4 changed files with 8 additions and 5 deletions

View File

@ -19,6 +19,7 @@ class Client {
String _base = '';
bool authenticated = false;
bool ignoreCertificates = false;
bool showSnackBar = true;
String get base => _base;
String get token => _token;
@ -139,7 +140,7 @@ class Client {
final SnackBar snackBar = SnackBar(
content: Text(
"Error code " + response.statusCode.toString() + " received."),
action: SnackBarAction(
action: globalNavigatorKey.currentContext == null ? null : SnackBarAction(
label: ("Details"),
onPressed: () {
showDialog(
@ -160,7 +161,7 @@ class Client {
},
),
);
if(global_scaffold_key != null)
if(global_scaffold_key != null && showSnackBar)
global_scaffold_key!.currentState?.showSnackBar(snackBar);
else
print("error on request: ${error["message"]}");

View File

@ -60,7 +60,7 @@ class SettingsPageState extends State<SettingsPage> {
return new Scaffold(
appBar: AppBar(title: Text("Settings"),),
body: Column(
body: ListView(
children: [
UserAccountsDrawerHeader(
accountName: currentUser != null ? Text(currentUser.username) : null,

View File

@ -271,6 +271,7 @@ class _LoginPageState extends State<LoginPage> {
setState(() => _loading = true);
try {
var vGlobal = VikunjaGlobal.of(context);
vGlobal.client.showSnackBar = false;
vGlobal.client.configure(base: _server);
Server? info = await vGlobal.serverService.getInfo();
if (info == null)
@ -336,6 +337,7 @@ class _LoginPageState extends State<LoginPage> {
));
*/
} finally {
VikunjaGlobal.of(context).client.showSnackBar = true;
setState(() {
_loading = false;
});

View File

@ -4,9 +4,9 @@ import 'package:flutter/material.dart';
import 'package:vikunja_app/theme/constants.dart';
ThemeData buildVikunjaTheme() => _buildVikunjaTheme(ThemeData.light());
ThemeData buildVikunjaDarkTheme() => _buildVikunjaTheme(ThemeData.dark());
ThemeData buildVikunjaDarkTheme() => _buildVikunjaTheme(ThemeData.dark(), isDark: true);
ThemeData _buildVikunjaTheme(ThemeData base) {
ThemeData _buildVikunjaTheme(ThemeData base, {bool isDark = false}) {
return base.copyWith(
errorColor: vRed,
primaryColor: vPrimaryDark,