This commit is contained in:
2022-11-20 11:02:42 +02:00
parent 58212618cb
commit ad2489006a
4 changed files with 323 additions and 48 deletions
+88 -48
View File
@@ -1,7 +1,10 @@
import 'dart:ffi';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:spannable_grid/spannable_grid.dart'; import 'package:spannable_grid/spannable_grid.dart';
import 'package:percent_indicator/percent_indicator.dart'; import 'package:percent_indicator/percent_indicator.dart';
import 'notifications.dart' as LocalNoticeService; import 'notifications.dart' as LocalNoticeService;
import 'test.dart' as Tests;
Future<void> main() async { Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@@ -14,7 +17,7 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Fitness Homie', title: 'Health Homie',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
appBarTheme: AppBarTheme( appBarTheme: AppBarTheme(
@@ -23,7 +26,7 @@ class MyApp extends StatelessWidget {
centerTitle: true, centerTitle: true,
titleTextStyle: TextStyle(color: Colors.white, fontSize: 30), titleTextStyle: TextStyle(color: Colors.white, fontSize: 30),
)), )),
home: const MyHomePage(title: 'Fitness Homie'), home: const MyHomePage(title: 'Health Homie'),
); );
} }
} }
@@ -44,7 +47,7 @@ class _MyHomePageState extends State<MyHomePage> {
List<Widget> tasks = []; List<Widget> tasks = [];
final tasks_progress = []; final tasks_progress = [];
int _total_tasks = 15; int _total_tasks = 15;
int _water = 7; int _water = 0;
List<Widget> screens = [ List<Widget> screens = [
SpannableGrid( SpannableGrid(
@@ -155,7 +158,7 @@ class _MyHomePageState extends State<MyHomePage> {
fontSize: 20.0, fontSize: 20.0,
)), )),
Text( Text(
'Boss', 'Experienced User',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
@@ -287,7 +290,7 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
Text( Text(
"Cats, Basketball, Guitar", "Active lifestyle, Healthy BMI",
style: TextStyle( style: TextStyle(
fontSize: 12.0, fontSize: 12.0,
color: Colors.grey[400], color: Colors.grey[400],
@@ -321,7 +324,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Column( child: Column(
children: [ children: [
Text( Text(
'Achievements', 'Daily streak',
style: style:
TextStyle(color: Colors.grey[400], fontSize: 14.0), TextStyle(color: Colors.grey[400], fontSize: 14.0),
), ),
@@ -472,37 +475,35 @@ class _MyHomePageState extends State<MyHomePage> {
column: 1, column: 1,
row: 1, row: 1,
columnSpan: 4, columnSpan: 4,
child: Container( rowSpan: 2,
child: Center( child: Column(
child: Text( children: [
"Hello Mihnea!", SizedBox(
style: TextStyle( height: 20,
fontSize: 35, ),
fontFamily: "Lato", Text(
color: Color.fromARGB(255, 0, 0, 0), "Hello Dumi,",
fontWeight: FontWeight.w500, style: TextStyle(
fontStyle: FontStyle.normal, fontSize: 35,
letterSpacing: 8, fontFamily: "Lato",
wordSpacing: 10, color: Color.fromARGB(255, 0, 0, 0),
), fontWeight: FontWeight.w500,
))), fontStyle: FontStyle.normal,
), ),
SpannableGridCellData( ),
id: 6, SizedBox(
column: 1, height: 20,
row: 2, ),
columnSpan: 4, Text(
child: Container( "You're getting close\n to your steps goal!",
child: Center( style: TextStyle(
child: Text( fontSize: 35,
"Welcome back!", color: Color.fromARGB(255, 0, 0, 0),
style: TextStyle( fontStyle: FontStyle.normal,
fontSize: 35, ),
color: Color.fromARGB(255, 0, 0, 0), )
fontStyle: FontStyle.normal, ],
letterSpacing: 4, ),
wordSpacing: 5),
))),
), ),
SpannableGridCellData( SpannableGridCellData(
id: 7, id: 7,
@@ -519,8 +520,8 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ children: [
Text("data1"), Text("Steps\ncounter"),
Text("data2"), Text("Target\n 8k"),
], ],
), ),
), ),
@@ -530,13 +531,13 @@ class _MyHomePageState extends State<MyHomePage> {
SizedBox( SizedBox(
child: LinearPercentIndicator( child: LinearPercentIndicator(
alignment: MainAxisAlignment.center, alignment: MainAxisAlignment.center,
width: MediaQuery.of(context).size.width * 0.8, width: MediaQuery.of(context).size.width * 0.86,
animation: true, animation: true,
lineHeight: 20.0, lineHeight: 20.0,
animationDuration: 2500, animationDuration: 2500,
percent: 0.8, percent: 0.75,
barRadius: const Radius.circular(16), barRadius: const Radius.circular(16),
center: Text("80.0%"), center: Text("75.0%"),
progressColor: Colors.deepPurple, progressColor: Colors.deepPurple,
), ),
), ),
@@ -565,13 +566,44 @@ class _MyHomePageState extends State<MyHomePage> {
child: Flex( child: Flex(
direction: Axis.vertical, direction: Axis.vertical,
children: [ children: [
Expanded(flex: 1, child: Center(child: Text("Hours Used"))),
Expanded( Expanded(
flex: 1, flex: 1,
child: Center( child: Container(
child: Text(
"\nScreen Time",
style: TextStyle(
color: Colors.black,
fontSize: 25,
fontWeight: FontWeight.w500),
))),
Expanded(
flex: 1,
child: Container(
child: Flex( child: Flex(
direction: Axis.vertical, direction: Axis.vertical,
children: [Text("12 hrs"), Text("6hrs total")], children: [
new CircularPercentIndicator(
radius: 35.0,
lineWidth: 10.0,
percent: 0.2,
center: new Text(
"8/6\nhrs",
style: TextStyle(
color: Colors.red,
fontSize: 20,
),
),
progressColor: Colors.red,
backgroundColor: Colors.green,
)
// Text(
// " 8/6 hrs\nDaily limit\nexceeded",
// style: TextStyle(
// color: Colors.red,
// fontSize: 20,
// ),
// )
],
))), ))),
], ],
))), ))),
@@ -592,7 +624,13 @@ class _MyHomePageState extends State<MyHomePage> {
child: Flex( child: Flex(
direction: Axis.vertical, direction: Axis.vertical,
children: [ children: [
Expanded(flex: 1, child: Center(child: Text('data'))), Expanded(
flex: 1,
child: Center(
child: Text(
'Daily Hydration',
style: TextStyle(fontSize: 19),
))),
Expanded( Expanded(
flex: 1, flex: 1,
child: Center( child: Center(
@@ -606,7 +644,7 @@ class _MyHomePageState extends State<MyHomePage> {
lineHeight: 35.0, lineHeight: 35.0,
animationDuration: 1000, animationDuration: 1000,
percent: 0.1 * _water, percent: 0.1 * _water,
progressColor: Color.fromARGB(255, 58, 79, 183), progressColor: Color.fromARGB(255, 0, 141, 223),
), ),
Image( Image(
image: AssetImage("paharPB.png"), image: AssetImage("paharPB.png"),
@@ -628,8 +666,10 @@ class _MyHomePageState extends State<MyHomePage> {
}, },
); );
}, },
// ignore: prefer_const_constructors
child: Text( child: Text(
'TextButton', 'Drank some water!',
style: TextStyle(fontSize: 15),
), ),
))) )))
], ],
+17
View File
@@ -0,0 +1,17 @@
import "package:test/test.dart";
import 'notifications.dart' as Notification;
Future<void> water() async {
Notification.addNotification("Water Reminder",
"You haven't drink water in a long time. You should drink some");
}
Future<void> instagram() async {
Notification.addNotification("Instagram Warning",
"Hey! You have been spending quite some time on Instagram. Maybe you should take a break");
}
Future<void> sleep() async {
Notification.addNotification(
"Sleep Reminder", "Hey! It's quite late. Maybe you should go to sleep");
}
+217
View File
@@ -1,6 +1,20 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "47.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.7.0"
args: args:
dependency: transitive dependency: transitive
description: description:
@@ -43,6 +57,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.0" version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -116,6 +151,48 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.2"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.5"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@@ -123,6 +200,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@@ -144,6 +228,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
path: path:
dependency: transitive dependency: transitive
description: description:
@@ -179,6 +284,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
process: process:
dependency: transitive dependency: transitive
description: description:
@@ -186,11 +298,60 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.2.4" version: "4.2.4"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.11"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@@ -233,6 +394,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.1" version: "1.2.1"
test:
dependency: "direct main"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.4"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
@@ -240,6 +408,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.12" version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.16"
timezone: timezone:
dependency: transitive dependency: transitive
description: description:
@@ -247,6 +422,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.0" version: "0.9.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@@ -254,6 +436,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "9.4.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@@ -268,6 +478,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.0" version: "6.1.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sdks: sdks:
dart: ">=2.18.4 <3.0.0" dart: ">=2.18.4 <3.0.0"
flutter: ">=2.12.0" flutter: ">=2.12.0"
+1
View File
@@ -40,6 +40,7 @@ dependencies:
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
flutter_local_notifications: ^12.0.3+1 flutter_local_notifications: ^12.0.3+1
percent_indicator: ^4.2.2 percent_indicator: ^4.2.2
test: ^1.21.4
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: