mirror of
https://github.com/git-touch/git-touch
synced 2025-01-31 08:04:51 +01:00
fix: login screen theme
This commit is contained in:
parent
baf3e43045
commit
0b334f341e
28
lib/app.dart
28
lib/app.dart
@ -1,34 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:git_touch/home.dart';
|
import 'package:git_touch/home.dart';
|
||||||
import 'package:git_touch/models/auth.dart';
|
|
||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:git_touch/screens/login.dart';
|
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final auth = Provider.of<AuthModel>(context);
|
|
||||||
final theme = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
|
|
||||||
final themData = ThemeData(
|
|
||||||
brightness: theme.brightness,
|
|
||||||
// primaryColorBrightness: theme.brightness,
|
|
||||||
primaryColorLight: theme.paletteLight.background,
|
|
||||||
primaryColorDark: theme.paletteDark.background,
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
if (!auth.ready || !Provider.of<ThemeModel>(context).ready) {
|
|
||||||
return MaterialApp(theme: themData, home: Scaffold(body: Text('a')));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fimber.d(settings.activeLogin);
|
|
||||||
if (auth.activeAccount == null) {
|
|
||||||
return MaterialApp(theme: themData, home: LoginScreen());
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (theme.theme) {
|
switch (theme.theme) {
|
||||||
case AppThemeType.cupertino:
|
case AppThemeType.cupertino:
|
||||||
return CupertinoApp(
|
return CupertinoApp(
|
||||||
@ -37,7 +16,12 @@ class MyApp extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: themData,
|
theme: ThemeData(
|
||||||
|
brightness: theme.brightness,
|
||||||
|
// primaryColorBrightness: theme.brightness,
|
||||||
|
primaryColorLight: theme.paletteLight.background,
|
||||||
|
primaryColorDark: theme.paletteDark.background,
|
||||||
|
),
|
||||||
home: Home(),
|
home: Home(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import 'package:git_touch/models/notification.dart';
|
|||||||
import 'package:git_touch/models/theme.dart';
|
import 'package:git_touch/models/theme.dart';
|
||||||
import 'package:git_touch/screens/gitlab_todos.dart';
|
import 'package:git_touch/screens/gitlab_todos.dart';
|
||||||
import 'package:git_touch/screens/gitlab_user.dart';
|
import 'package:git_touch/screens/gitlab_user.dart';
|
||||||
|
import 'package:git_touch/screens/login.dart';
|
||||||
import 'package:git_touch/screens/notification.dart';
|
import 'package:git_touch/screens/notification.dart';
|
||||||
import 'package:git_touch/screens/user.dart';
|
import 'package:git_touch/screens/user.dart';
|
||||||
import 'package:git_touch/utils/utils.dart';
|
import 'package:git_touch/utils/utils.dart';
|
||||||
@ -121,6 +122,10 @@ class _HomeState extends State<Home> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
|
final auth = Provider.of<AuthModel>(context);
|
||||||
|
if (auth.activeAccount == null) {
|
||||||
|
return LoginScreen();
|
||||||
|
}
|
||||||
|
|
||||||
switch (theme.theme) {
|
switch (theme.theme) {
|
||||||
case AppThemeType.cupertino:
|
case AppThemeType.cupertino:
|
||||||
|
@ -31,7 +31,6 @@ class AuthModel with ChangeNotifier {
|
|||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|
||||||
List<Account> get accounts => _accounts;
|
List<Account> get accounts => _accounts;
|
||||||
bool get ready => _accounts != null;
|
|
||||||
Account get activeAccount {
|
Account get activeAccount {
|
||||||
if (activeAccountIndex == null || _accounts == null) return null;
|
if (activeAccountIndex == null || _accounts == null) return null;
|
||||||
return _accounts[activeAccountIndex];
|
return _accounts[activeAccountIndex];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user