Skip to content

Commit

Permalink
Merge pull request #8 from xpavle00/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
xpavle00 authored Dec 5, 2021
2 parents 8cb6df9 + e51a867 commit 0658140
Show file tree
Hide file tree
Showing 19 changed files with 1,034 additions and 135 deletions.
9 changes: 9 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />

<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>

<application
android:label="Habo"
android:icon="@mipmap/ic_launcher">
Expand Down
1 change: 1 addition & 0 deletions assets/images/noDataStatistics.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions lib/helpers.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import 'package:Habo/screens/create_habit_screen.dart';
import 'package:Habo/screens/settings_screen.dart';
import 'package:Habo/screens/statistics_screen.dart';
import 'package:flutter/material.dart';

Future navigateToSettingsPage(context) async {
Navigator.push(
context, MaterialPageRoute(builder: (context) => SettingsScreen()));
}

Future navigateToStatisticsPage(context) async {
Navigator.push(
context, MaterialPageRoute(builder: (context) => StatisticsScreen()));
}

Future navigateToCreatePage(context) async {
Navigator.push(
context, MaterialPageRoute(builder: (context) => CreateHabitScreen()));
Expand All @@ -23,3 +29,11 @@ TimeOfDay parseTimeOfDay(String value) {
}

enum DayType { Clear, Check, Fail, Skip }

class HaboColors {
static final Color primary = Color(0xFF09BF30);
static final Color red = Colors.red;
static final Color skip = Color(0xFF818181); //0xFF505050
static final Color comment = Colors.yellow[700];
static final Color orange = Colors.orange;
}
5 changes: 5 additions & 0 deletions lib/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:Habo/habit_data.dart';
import 'package:Habo/model.dart';
import 'package:Habo/notification_center.dart';
import 'package:Habo/settings_data.dart';
import 'package:Habo/statistics.dart';
import 'package:Habo/widgets/habit.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -38,6 +39,10 @@ class Bloc with ChangeNotifier {
_clickPlayer.setAsset('assets/sounds/click.wav');
}

Future<AllStatistics> getFutureStatsData() async {
return await Statistics.calculateStatistics(allHabits);
}

playCheckSound() {
if (settingsData.getSoundEffects) {
_checkPlayer.setClip(
Expand Down
9 changes: 9 additions & 0 deletions lib/screens/create_habit_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ class _CreateHabitScreenState extends State<CreateHabitScreen> {
}
}

@override
void dispose() {
title.dispose();
cue.dispose();
routine.dispose();
reward.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down
31 changes: 22 additions & 9 deletions lib/screens/edit_habit_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:Habo/habit_data.dart';
import 'package:Habo/helpers.dart';
import 'package:Habo/provider.dart';
import 'package:Habo/widgets/text_container.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -53,6 +54,15 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
notTime = widget.habitData.notTime;
}

@override
void dispose() {
title.dispose();
cue.dispose();
routine.dispose();
reward.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -69,7 +79,7 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
Icons.delete,
semanticLabel: 'Delete',
),
color: Colors.red,
color: HaboColors.red,
tooltip: 'Delete',
onPressed: () {
Navigator.of(context).pop();
Expand Down Expand Up @@ -129,7 +139,8 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
label: 'Habit',
),
Container(
margin: EdgeInsets.symmetric(vertical: 5, horizontal: 20),
margin:
const EdgeInsets.symmetric(vertical: 5, horizontal: 20),
child: Row(
children: <Widget>[
Checkbox(
Expand All @@ -142,7 +153,7 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
),
Text("Use Two day rule"),
Tooltip(
child: Icon(
child: const Icon(
Icons.info,
color: Colors.grey,
size: 18,
Expand Down Expand Up @@ -171,9 +182,9 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
},
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Center(
child: Text(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: const Center(
child: const Text(
"This section helps you better define your habits. You should define cue, routine, and reward for every habit.",
textAlign: TextAlign.center,
),
Expand All @@ -185,7 +196,8 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
label: 'Cue',
),
ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 25),
contentPadding:
const EdgeInsets.symmetric(horizontal: 25),
title: Text("Notifications"),
trailing: Switch(
value: notification,
Expand All @@ -195,7 +207,8 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
}),
),
ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 25),
contentPadding:
const EdgeInsets.symmetric(horizontal: 25),
enabled: notification,
title: Text("Notification time"),
trailing: InkWell(
Expand All @@ -217,7 +230,7 @@ class _EditHabitScreenState extends State<EditHabitScreen> {
),
TextContainer(
title: routine,
hint: 'Do 50 pushups',
hint: 'Do 50 push ups',
label: 'Routine',
),
TextContainer(
Expand Down
12 changes: 12 additions & 0 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ class HomeScreen extends StatelessWidget {
),
backgroundColor: Colors.transparent,
actions: <Widget>[
IconButton(
icon: const Icon(
Icons.bar_chart,
semanticLabel: 'Statistics',
),
color: Colors.grey[400],
tooltip: 'Statistics',
onPressed: () {
Provider.of<Bloc>(context, listen: false).hideSnackBar();
navigateToStatisticsPage(context);
},
),
IconButton(
icon: const Icon(
Icons.settings,
Expand Down
Loading

0 comments on commit 0658140

Please sign in to comment.