theming!!!
This commit is contained in:
parent
839bb0bbde
commit
c63f062640
12 changed files with 118 additions and 63 deletions
|
@ -8,12 +8,12 @@ import 'package:flutter_localizations/flutter_localizations.dart';
|
|||
import 'themes/themes.dart' as themes;
|
||||
|
||||
String _initRoute = "/";
|
||||
ThemeData theme = themes.getTheme(themes.available[0]);
|
||||
|
||||
void main() async {
|
||||
Intl.defaultLocale = 'en_US';
|
||||
|
||||
// check if all information is available
|
||||
settings.saveAuthCode("");
|
||||
if (await settings.loadAuthCode() == "") {
|
||||
_initRoute = "/login";
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class _SlothmuState extends State<Slothmu> {
|
|||
Widget build(BuildContext context) {
|
||||
LocalJsonLocalization.delegate.directories = ['lib/i18n'];
|
||||
return MaterialApp(
|
||||
theme: themes.defaultThemeDark,
|
||||
theme: theme,
|
||||
supportedLocales: supported,
|
||||
localizationsDelegates: [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
|
||||
Widget Chat() {
|
||||
return Center(child: Text("Chat"));
|
||||
}
|
5
lib/pages/chat/chat.dart
Normal file
5
lib/pages/chat/chat.dart
Normal file
|
@ -0,0 +1,5 @@
|
|||
import 'package:flutter/widgets.dart';
|
||||
|
||||
Widget chat(context) {
|
||||
return const Center(child: Text("Chat"));
|
||||
}
|
|
@ -44,7 +44,7 @@ class _LoginFormState extends State<LoginForm> {
|
|||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text("greeting".i18n(), style: const TextStyle(fontSize: 64)),
|
||||
Text("greeting".i18n(), style: Theme.of(context).textTheme.headline1),
|
||||
TextFormField(
|
||||
onSaved: (value) async {
|
||||
await settings
|
||||
|
|
5
lib/pages/notifications/notifications.dart
Normal file
5
lib/pages/notifications/notifications.dart
Normal file
|
@ -0,0 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget notifications(context) {
|
||||
return const Center(child: Text("Notifications"));
|
||||
}
|
|
@ -1,15 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:settings_ui/settings_ui.dart';
|
||||
|
||||
Widget Settings() {
|
||||
return SafeArea(
|
||||
child: SettingsList(contentPadding: EdgeInsets.all(24), sections: [
|
||||
SettingsSection(title: Text("General"), tiles: [
|
||||
SettingsTile(
|
||||
title: Text("Language"),
|
||||
value: Text("no"),
|
||||
)
|
||||
])
|
||||
]),
|
||||
Widget settings(context) {
|
||||
return const Center(
|
||||
child: Text("Settings"),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget Timeline() {
|
||||
return Center(child: Text("Home"));
|
||||
Widget timeline(context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
children: [],
|
||||
));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:slothmu/pages/chat/%20chat.dart';
|
||||
import 'package:slothmu/pages/chat/chat.dart';
|
||||
import 'package:slothmu/pages/notifications/notifications.dart';
|
||||
import 'package:slothmu/pages/timeline/timeline.dart';
|
||||
import 'package:slothmu/pages/settings/settings.dart';
|
||||
|
||||
|
@ -12,29 +13,49 @@ class MainScaffold extends StatefulWidget {
|
|||
|
||||
class _MainScaffoldState extends State<MainScaffold> {
|
||||
int index = 0;
|
||||
final screens = [
|
||||
Timeline(),
|
||||
Chat(),
|
||||
Settings(),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screens = [
|
||||
timeline(context),
|
||||
chat(context),
|
||||
notifications(context),
|
||||
settings(context),
|
||||
];
|
||||
final buttons = [
|
||||
FloatingActionButton(
|
||||
child: const Icon(Icons.chat_bubble),
|
||||
onPressed: () {},
|
||||
),
|
||||
FloatingActionButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.person_add),
|
||||
),
|
||||
FloatingActionButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.clear_all),
|
||||
),
|
||||
null,
|
||||
];
|
||||
return Scaffold(
|
||||
extendBody: true,
|
||||
body: screens[index],
|
||||
bottomNavigationBar: NavigationBar(
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
elevation: 0,
|
||||
height: 60,
|
||||
onDestinationSelected: (index) => setState(() => this.index = index),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
floatingActionButton: buttons[index],
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: NavigationBar(
|
||||
onDestinationSelected: (index) =>
|
||||
setState(() => this.index = index),
|
||||
selectedIndex: index,
|
||||
destinations: const [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.list_alt), label: "Timeline"),
|
||||
NavigationDestination(icon: Icon(Icons.forum), label: "Timeline"),
|
||||
NavigationDestination(icon: Icon(Icons.chat), label: "Chat"),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.notifications), label: "Notifications"),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.settings), label: "Settings"),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
24
lib/themes/dracula.dart
Normal file
24
lib/themes/dracula.dart
Normal file
|
@ -0,0 +1,24 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'themes.dart' as themes;
|
||||
|
||||
themes.CustomColors theme = themes.CustomColors(
|
||||
"Dracula",
|
||||
const Color.fromARGB(
|
||||
255,
|
||||
98,
|
||||
114,
|
||||
164,
|
||||
),
|
||||
const ColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
primary: Color.fromARGB(255, 255, 121, 198),
|
||||
onPrimary: Color.fromARGB(255, 40, 42, 54),
|
||||
secondary: Color.fromARGB(255, 80, 250, 123),
|
||||
onSecondary: Color.fromARGB(255, 40, 42, 54),
|
||||
error: Color.fromARGB(255, 255, 85, 85),
|
||||
onError: Color.fromARGB(255, 40, 42, 54),
|
||||
background: Color.fromARGB(255, 40, 42, 54),
|
||||
onBackground: Color.fromARGB(255, 248, 248, 242),
|
||||
surface: Color.fromARGB(255, 68, 71, 90),
|
||||
onSurface: Color.fromARGB(255, 248, 248, 242),
|
||||
));
|
|
@ -1,15 +1,32 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'dracula.dart' as color_dracula;
|
||||
|
||||
final defaultThemeDark = ThemeData(
|
||||
colorScheme: const ColorScheme(
|
||||
brightness: Brightness.dark,
|
||||
primary: Colors.white,
|
||||
onPrimary: Colors.black,
|
||||
secondary: Colors.lime,
|
||||
onSecondary: Colors.black,
|
||||
error: Colors.red,
|
||||
onError: Colors.white,
|
||||
background: Colors.black,
|
||||
onBackground: Colors.white,
|
||||
surface: Colors.deepPurple,
|
||||
onSurface: Colors.white));
|
||||
final available = [color_dracula.theme];
|
||||
ThemeData getTheme(CustomColors colors) {
|
||||
return ThemeData(
|
||||
scaffoldBackgroundColor: colors.colorScheme.background,
|
||||
bottomAppBarColor: colors.colorScheme.background,
|
||||
hintColor: colors.hintColor,
|
||||
colorScheme: colors.colorScheme,
|
||||
errorColor: colors.colorScheme.error,
|
||||
bottomAppBarTheme: BottomAppBarTheme(
|
||||
color: colors.colorScheme.surface,
|
||||
shape: const CircularNotchedRectangle(),
|
||||
elevation: 0,
|
||||
),
|
||||
navigationBarTheme: const NavigationBarThemeData(
|
||||
backgroundColor: Colors.transparent,
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
indicatorColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
height: 64,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class CustomColors {
|
||||
late String name;
|
||||
late Color hintColor;
|
||||
late ColorScheme colorScheme;
|
||||
CustomColors(this.name, this.hintColor, this.colorScheme);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ packages:
|
|||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -210,13 +210,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
settings_ui:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: settings_ui
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.0.0+1
|
||||
version: 0.1.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.3 <3.0.0"
|
||||
|
@ -36,7 +36,6 @@ dependencies:
|
|||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
settings_ui: ^2.0.2
|
||||
http: ^0.13.4
|
||||
localization: ^2.1.0
|
||||
shared_preferences: ^2.0.15
|
||||
|
|
Loading…
Reference in a new issue