Skip to content

Commit

Permalink
Merge branch 'release/1.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeoxs committed Jul 12, 2021
2 parents 11670c0 + 644f47c commit 5038896
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 38 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog][Keep a Changelog] and this project adh

## [Released]

## [1.0.5] - 2021-07-11
### Added
- Dark Mode

## [1.0.4] - 2021-07-10
### Added
- Drawer Menu on Home Page with items
Expand Down Expand Up @@ -59,7 +63,8 @@ The format is based on [Keep a Changelog][Keep a Changelog] and this project adh
<!-- Versions -->
[Released]: https://github.com/Jeoxs/khanos/releases

[1.0.3]: https://github.com/Jeoxs/khanos/compare/v1.0.3...v1.0.4
[1.0.5]: https://github.com/Jeoxs/khanos/compare/v1.0.4...v1.0.5
[1.0.4]: https://github.com/Jeoxs/khanos/compare/v1.0.3...v1.0.4
[1.0.3]: https://github.com/Jeoxs/khanos/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/Jeoxs/khanos/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/Jeoxs/khanos/compare/v1.0...v1.0.1
Expand Down
36 changes: 26 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,47 @@ import 'package:khanos/src/pages/task_page.dart';
import 'package:khanos/src/pages/welcome_page.dart';
import 'package:khanos/src/preferences/user_preferences.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:khanos/src/providers/dark_theme_provider.dart';
import 'package:provider/provider.dart';
import 'package:provider/single_child_widget.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
final prefs = new UserPreferences();
await prefs.initPrefs();

runApp(MyApp());
}

class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => ThemeChanger(lightTheme)),
],
child: MaterialAppWithTheme(),
);
}
}

class MaterialAppWithTheme extends StatelessWidget {
final Map<String, dynamic> preferences = {
'endpoint': prefs.endpoint,
'username': prefs.username,
'password': prefs.password,
'authFlag': prefs.authFlag
};

runApp(MyApp(preferences));
}

class MyApp extends StatelessWidget {
MyApp(this.preferences);
final Map<String, dynamic> preferences;

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
final theme = Provider.of<ThemeChanger>(context);
String _initialRoute = '';

if (preferences['endpoint'] == '' ||
Expand Down Expand Up @@ -68,9 +86,7 @@ class MyApp extends StatelessWidget {
'login': (BuildContext context) => LoginPage(),
'newProject': (BuildContext context) => NewProjectPage()
},
theme: ThemeData(
primarySwatch: Colors.blue,
),
theme: theme.getTheme,
);
}
}
37 changes: 31 additions & 6 deletions lib/src/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:khanos/src/preferences/user_preferences.dart';
import 'package:khanos/src/providers/dark_theme_provider.dart';
import 'package:khanos/src/providers/user_provider.dart';
import 'package:khanos/src/utils/theme_utils.dart';
import 'package:khanos/src/utils/utils.dart';
import 'package:khanos/src/utils/widgets_utils.dart';
import 'package:provider/provider.dart';
import 'package:shimmer/shimmer.dart';
import 'package:khanos/src/models/project_model.dart';
import 'package:khanos/src/providers/column_provider.dart';
Expand All @@ -22,14 +24,26 @@ class _HomePageState extends State<HomePage> {
final projectProvider = new ProjectProvider();
final columnProvider = new ColumnProvider();
final userProvider = new UserProvider();
bool _darkTheme;
ThemeData currentThemeData;

@override
void initState() {
_darkTheme = _prefs.darkTheme;
super.initState();
}

int projectsAmount;
@override
Widget build(BuildContext context) {
currentThemeData =
_darkTheme == true ? ThemeData.dark() : ThemeData.light();
return Scaffold(
appBar: normalAppBar('Khanos'),
body: projectList(context),
drawer: _homeDrawer(),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.blue,
child: Icon(Icons.add),
onPressed: () => Navigator.of(context)
.pushNamed('newProject')
Expand Down Expand Up @@ -183,7 +197,7 @@ class _HomePageState extends State<HomePage> {
Widget _projectElement(String title, String description) {
description = description != null ? description : 'No description';
return Container(
margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 30.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
Expand All @@ -203,17 +217,16 @@ class _HomePageState extends State<HomePage> {
decoration: BoxDecoration(
gradient: LinearGradient(
stops: [0.015, 0.015],
colors: [Colors.green, Colors.white],
colors: [Colors.blue, currentThemeData.cardColor],
),
borderRadius: BorderRadius.all(
Radius.circular(5.0),
),
boxShadow: [
BoxShadow(
color: CustomColors.GreyBorder,
blurRadius: 10.0,
spreadRadius: 5.0,
offset: Offset(0.0, 0.0),
color: currentThemeData.shadowColor,
blurRadius: 4,
offset: Offset(1.5, 1.5),
),
],
),
Expand All @@ -231,6 +244,7 @@ class _HomePageState extends State<HomePage> {
}

Widget _homeDrawer() {
var _themeProvider = Provider.of<ThemeChanger>(context);
return Container(
child: Drawer(
child: ListView(
Expand Down Expand Up @@ -280,6 +294,17 @@ class _HomePageState extends State<HomePage> {
top: 140.0,
left: 100.0),
]),
SwitchListTile(
activeColor: Colors.blue,
value: _darkTheme,
title: Text('Dark Mode'),
onChanged: (value) {
_themeProvider.setTheme(value ? darkTheme : lightTheme);
prefs.darkTheme = value;
_darkTheme = value;
setState(() {});
},
),
ListTile(
leading: Icon(Icons.support, color: Colors.blue),
title: Text('Support'),
Expand Down
21 changes: 16 additions & 5 deletions lib/src/pages/project_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ProjectPage extends StatefulWidget {
}

class _ProjectPageState extends State<ProjectPage> {
bool _darkTheme;
ThemeData currentThemeData;
final _prefs = new UserPreferences();
Map<String, dynamic> error;
ProjectModel project = new ProjectModel();
Expand All @@ -29,8 +31,17 @@ class _ProjectPageState extends State<ProjectPage> {
final taskProvider = new TaskProvider();
final columnProvider = new ColumnProvider();
Widget floatingAction;

@override
void initState() {
_darkTheme = _prefs.darkTheme;
super.initState();
}

@override
Widget build(BuildContext context) {
currentThemeData =
_darkTheme == true ? ThemeData.dark() : ThemeData.light();
final Map projectArgs = ModalRoute.of(context).settings.arguments;

if (projectArgs['project'] != null) {
Expand Down Expand Up @@ -76,6 +87,7 @@ class _ProjectPageState extends State<ProjectPage> {
padding: EdgeInsets.only(top: 20.0),
child: _projectInfo(tasks)),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.blue,
child: Icon(Icons.add),
onPressed: () {
Navigator.pushNamed(context, 'taskForm',
Expand Down Expand Up @@ -235,17 +247,16 @@ class _ProjectPageState extends State<ProjectPage> {
decoration: BoxDecoration(
gradient: LinearGradient(
stops: [0.015, 0.015],
colors: [color, Colors.white],
colors: [color, currentThemeData.cardColor],
),
borderRadius: BorderRadius.all(
Radius.circular(5.0),
),
boxShadow: [
BoxShadow(
color: CustomColors.GreyBorder,
blurRadius: 10.0,
spreadRadius: 5.0,
offset: Offset(0.0, 0.0),
color: currentThemeData.shadowColor,
blurRadius: 4,
offset: Offset(1.5, 1.5),
),
],
),
Expand Down
23 changes: 18 additions & 5 deletions lib/src/pages/subtask_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ class _SubtaskPageState extends State<SubtaskPage> {
TaskModel task = new TaskModel();
final taskProvider = new TaskProvider();
final subtaskProvider = new SubtaskProvider();
bool _darkTheme;
ThemeData currentThemeData;

@override
void initState() {
_darkTheme = _prefs.darkTheme;
super.initState();
}

@override
Widget build(BuildContext context) {
currentThemeData =
_darkTheme == true ? ThemeData.dark() : ThemeData.light();
final Map taskArgs = ModalRoute.of(context).settings.arguments;
task = taskArgs['task'];
return Scaffold(
Expand All @@ -35,6 +45,7 @@ class _SubtaskPageState extends State<SubtaskPage> {
child: _subtaskList(int.parse(task.id)),
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.blue,
child: Icon(Icons.add),
onPressed: () {
Navigator.pushNamed(context, 'newSubtask', arguments: {'task': task})
Expand Down Expand Up @@ -224,17 +235,19 @@ class _SubtaskPageState extends State<SubtaskPage> {
decoration: BoxDecoration(
gradient: LinearGradient(
stops: [0.015, 0.015],
colors: [(status == "2" ? Colors.grey : Colors.blue), Colors.white],
colors: [
(status == "2" ? Colors.grey : Colors.blue),
currentThemeData.cardColor
],
),
borderRadius: BorderRadius.all(
Radius.circular(5.0),
),
boxShadow: [
BoxShadow(
color: CustomColors.GreyBorder,
blurRadius: 10.0,
spreadRadius: 5.0,
offset: Offset(0.0, 0.0),
color: currentThemeData.shadowColor,
blurRadius: 4,
offset: Offset(1.5, 1.5),
),
],
),
Expand Down
12 changes: 10 additions & 2 deletions lib/src/pages/task_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class _TaskFormPageState extends State<TaskFormPage> {

ProjectModel project = new ProjectModel();
TaskModel task = new TaskModel();

bool _darkTheme;
ThemeData currentThemeData;

List<UserModel> _users = [];
List<ColumnModel> _columns = [];
DateTime dateStartedLimitMin;
Expand Down Expand Up @@ -79,6 +83,8 @@ class _TaskFormPageState extends State<TaskFormPage> {

@override
Widget build(BuildContext context) {
currentThemeData =
_darkTheme == true ? ThemeData.dark() : ThemeData.light();
final Map taskArgs = ModalRoute.of(context).settings.arguments;
project = taskArgs['project'];
_users = taskArgs['usersData'];
Expand Down Expand Up @@ -777,9 +783,11 @@ class _TaskFormPageState extends State<TaskFormPage> {
List<Widget> chips = [];
_availableTags.forEach((tag) {
chips.add(InputChip(
backgroundColor: CustomColors.HeaderBlueLight,
backgroundColor: Colors.blue,
elevation: 4.0,
label: Text(tag.name),
label: Text(
tag.name,
),
selected: _tags.contains(tag.name) ? true : false,
onSelected: (bool selected) {
setState(() {
Expand Down
19 changes: 17 additions & 2 deletions lib/src/pages/task_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,19 @@ class _TaskPageState extends State<TaskPage> {
final subtaskProvider = new SubtaskProvider();
final userProvider = new UserProvider();
final columnProvider = new ColumnProvider();
bool _darkTheme;
ThemeData currentThemeData;

@override
void initState() {
_darkTheme = _prefs.darkTheme;
super.initState();
}

@override
Widget build(BuildContext context) {
currentThemeData =
_darkTheme == true ? ThemeData.dark() : ThemeData.light();
final Map taskArgs = ModalRoute.of(context).settings.arguments;

// final String projectName = taskArgs['project_name'];
Expand All @@ -51,6 +62,7 @@ class _TaskPageState extends State<TaskPage> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
FloatingActionButton(
backgroundColor: Colors.blue,
heroTag: "subtaskListHero",
onPressed: () {
Navigator.pushNamed(context, 'subtask',
Expand All @@ -60,6 +72,7 @@ class _TaskPageState extends State<TaskPage> {
),
SizedBox(height: 10.0),
FloatingActionButton(
backgroundColor: Colors.blue,
heroTag: "editTaskHero",
onPressed: () async {
Navigator.pushNamed(context, 'taskForm', arguments: {
Expand Down Expand Up @@ -326,9 +339,11 @@ class _TaskPageState extends State<TaskPage> {
List<Widget> chips = [];
_tags.forEach((tag) {
chips.add(Chip(
backgroundColor: CustomColors.HeaderBlueLight,
backgroundColor: Colors.blue,
elevation: 4.0,
label: Text(tag.name),
label: Text(
tag.name,
),
));
});
return Wrap(spacing: 5.0, children: chips);
Expand Down
Loading

0 comments on commit 5038896

Please sign in to comment.