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:spannable_grid/spannable_grid.dart';
import 'package:percent_indicator/percent_indicator.dart';
import 'notifications.dart' as LocalNoticeService;
import 'test.dart' as Tests;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -14,7 +17,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fitness Homie',
title: 'Health Homie',
theme: ThemeData(
primarySwatch: Colors.blue,
appBarTheme: AppBarTheme(
@@ -23,7 +26,7 @@ class MyApp extends StatelessWidget {
centerTitle: true,
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 = [];
final tasks_progress = [];
int _total_tasks = 15;
int _water = 7;
int _water = 0;
List<Widget> screens = [
SpannableGrid(
@@ -155,7 +158,7 @@ class _MyHomePageState extends State<MyHomePage> {
fontSize: 20.0,
)),
Text(
'Boss',
'Experienced User',
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
@@ -287,7 +290,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
Text(
"Cats, Basketball, Guitar",
"Active lifestyle, Healthy BMI",
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[400],
@@ -321,7 +324,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Column(
children: [
Text(
'Achievements',
'Daily streak',
style:
TextStyle(color: Colors.grey[400], fontSize: 14.0),
),
@@ -472,37 +475,35 @@ class _MyHomePageState extends State<MyHomePage> {
column: 1,
row: 1,
columnSpan: 4,
child: Container(
child: Center(
child: Text(
"Hello Mihnea!",
style: TextStyle(
fontSize: 35,
fontFamily: "Lato",
color: Color.fromARGB(255, 0, 0, 0),
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
letterSpacing: 8,
wordSpacing: 10,
),
))),
),
SpannableGridCellData(
id: 6,
column: 1,
row: 2,
columnSpan: 4,
child: Container(
child: Center(
child: Text(
"Welcome back!",
style: TextStyle(
fontSize: 35,
color: Color.fromARGB(255, 0, 0, 0),
fontStyle: FontStyle.normal,
letterSpacing: 4,
wordSpacing: 5),
))),
rowSpan: 2,
child: Column(
children: [
SizedBox(
height: 20,
),
Text(
"Hello Dumi,",
style: TextStyle(
fontSize: 35,
fontFamily: "Lato",
color: Color.fromARGB(255, 0, 0, 0),
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
),
),
SizedBox(
height: 20,
),
Text(
"You're getting close\n to your steps goal!",
style: TextStyle(
fontSize: 35,
color: Color.fromARGB(255, 0, 0, 0),
fontStyle: FontStyle.normal,
),
)
],
),
),
SpannableGridCellData(
id: 7,
@@ -519,8 +520,8 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text("data1"),
Text("data2"),
Text("Steps\ncounter"),
Text("Target\n 8k"),
],
),
),
@@ -530,13 +531,13 @@ class _MyHomePageState extends State<MyHomePage> {
SizedBox(
child: LinearPercentIndicator(
alignment: MainAxisAlignment.center,
width: MediaQuery.of(context).size.width * 0.8,
width: MediaQuery.of(context).size.width * 0.86,
animation: true,
lineHeight: 20.0,
animationDuration: 2500,
percent: 0.8,
percent: 0.75,
barRadius: const Radius.circular(16),
center: Text("80.0%"),
center: Text("75.0%"),
progressColor: Colors.deepPurple,
),
),
@@ -565,13 +566,44 @@ class _MyHomePageState extends State<MyHomePage> {
child: Flex(
direction: Axis.vertical,
children: [
Expanded(flex: 1, child: Center(child: Text("Hours Used"))),
Expanded(
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(
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(
direction: Axis.vertical,
children: [
Expanded(flex: 1, child: Center(child: Text('data'))),
Expanded(
flex: 1,
child: Center(
child: Text(
'Daily Hydration',
style: TextStyle(fontSize: 19),
))),
Expanded(
flex: 1,
child: Center(
@@ -606,7 +644,7 @@ class _MyHomePageState extends State<MyHomePage> {
lineHeight: 35.0,
animationDuration: 1000,
percent: 0.1 * _water,
progressColor: Color.fromARGB(255, 58, 79, 183),
progressColor: Color.fromARGB(255, 0, 141, 223),
),
Image(
image: AssetImage("paharPB.png"),
@@ -628,8 +666,10 @@ class _MyHomePageState extends State<MyHomePage> {
},
);
},
// ignore: prefer_const_constructors
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
# See https://dart.dev/tools/pub/glossary#lockfile
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:
dependency: transitive
description:
@@ -43,6 +57,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description:
@@ -116,6 +151,48 @@ packages:
description: flutter
source: sdk
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:
dependency: transitive
description:
@@ -123,6 +200,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
matcher:
dependency: transitive
description:
@@ -144,6 +228,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -179,6 +284,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
process:
dependency: transitive
description:
@@ -186,11 +298,60 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description: flutter
source: sdk
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:
dependency: transitive
description:
@@ -233,6 +394,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
test:
dependency: "direct main"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.4"
test_api:
dependency: transitive
description:
@@ -240,6 +408,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.16"
timezone:
dependency: transitive
description:
@@ -247,6 +422,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -254,6 +436,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@@ -268,6 +478,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.18.4 <3.0.0"
flutter: ">=2.12.0"
+1
View File
@@ -40,6 +40,7 @@ dependencies:
cupertino_icons: ^1.0.2
flutter_local_notifications: ^12.0.3+1
percent_indicator: ^4.2.2
test: ^1.21.4
dev_dependencies:
flutter_test: