Commit 75a2b092 authored by Nilupul Jayasekara's avatar Nilupul Jayasekara

Merge branch 'IT19115894' into 'master'

It19115894

See merge request !6
parents 31f6db41 72e11618
No preview for this file type
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This diff is collapsed.
{
"name": "diabeta-web",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
\ No newline at end of file
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
......@@ -22,11 +22,14 @@ if (flutterVersionName == null) {
}
apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
......@@ -44,8 +47,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.diabeta_app"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
minSdkVersion 21
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
......
{
"project_info": {
"project_number": "247730670466",
"firebase_url": "https://diabeta-e2bfe-default-rtdb.firebaseio.com",
"project_id": "diabeta-e2bfe",
"storage_bucket": "diabeta-e2bfe.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:247730670466:android:4348a6ed394223efa05d9b",
"android_client_info": {
"package_name": "com.example.diabeta_app"
}
},
"oauth_client": [
{
"client_id": "247730670466-ggtm24v92sj9b100iv4tdqe4m2sffj19.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyA1ZrNeRH6i2FqLkWfQvdEBJR0glLmLqRU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "247730670466-ggtm24v92sj9b100iv4tdqe4m2sffj19.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "247730670466-tc414ncddkil5kqcqvqrsn7r4nlo2m9u.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.diabetaApp"
}
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.diabeta_app">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- For apps with targetSDK=31 (Android 12) -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<application
android:label="diabeta_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<service
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/>
<receiver
android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver"
android:exported="false"/>
<receiver
android:name="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver"
android:enabled="false"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity
android:name=".MainActivity"
android:exported="true"
......@@ -11,6 +30,8 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
......
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
......@@ -7,6 +7,9 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
......
......@@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
......@@ -665,6 +665,11 @@ PODS:
- FirebaseCore (~> 8.0)
- GTMSessionFetcher/Core (~> 1.5)
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
- google_sign_in_ios (0.0.1):
- Flutter
- GoogleSignIn (~> 5.0)
......@@ -758,7 +763,14 @@ PODS:
- nanopb/encode (= 2.30908.0)
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- path_provider_ios (0.0.1):
- Flutter
- printing (1.0.0):
- Flutter
- PromisesObjC (2.1.0)
- shared_preferences_ios (0.0.1):
- Flutter
- Toast (4.0.0)
DEPENDENCIES:
- cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
......@@ -766,7 +778,12 @@ DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_storage (from `.symlinks/plugins/firebase_storage/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- printing (from `.symlinks/plugins/printing/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
SPEC REPOS:
trunk:
......@@ -790,6 +807,7 @@ SPEC REPOS:
- Libuv-gRPC
- nanopb
- PromisesObjC
- Toast
EXTERNAL SOURCES:
cloud_firestore:
......@@ -802,8 +820,18 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_storage/ios"
Flutter:
:path: Flutter
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
google_sign_in_ios:
:path: ".symlinks/plugins/google_sign_in_ios/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
printing:
:path: ".symlinks/plugins/printing/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
SPEC CHECKSUMS:
abseil: ebe5b5529fb05d93a8bdb7951607be08b7fa71bc
......@@ -819,7 +847,9 @@ SPEC CHECKSUMS:
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseFirestore: d7023faff8e1b4fd69d0adbcf18e65129bc03842
FirebaseStorage: 8019af461599b2c3bc61c6a5dbdfa3d2de66a4d9
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037
google_sign_in_ios: ed71c0dbddfba8b1ea9aa210dbda695f46bf51bd
GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940
GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213
......@@ -831,7 +861,11 @@ SPEC CHECKSUMS:
leveldb-library: 50c7b45cbd7bf543c81a468fe557a16ae3db8729
Libuv-gRPC: 55e51798e14ef436ad9bc45d12d43b77b49df378
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
printing: eafa00acb682c0ca029d4d98d0798f55a1e27102
PromisesObjC: 99b6f43f9e1044bd87a95a60beff28c2c44ddb72
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
PODFILE CHECKSUM: fe0e1ee7f3d1f7d00b11b474b62dd62134535aea
......
......@@ -361,7 +361,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
......@@ -438,7 +438,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
......@@ -487,7 +487,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
......
......@@ -7,6 +7,9 @@ import Flutter
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
......
......@@ -43,5 +43,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:247730670466:ios:b33e66d123772576a05d9b",
"FIREBASE_PROJECT_ID": "diabeta-e2bfe",
"GCM_SENDER_ID": "247730670466"
}
\ No newline at end of file
......@@ -21,12 +21,12 @@ class _CategoryCardState extends State<CategoryCard> {
child: Column(
children: [
Container(
height: 150,
height: MediaQuery.of(context).size.height/5,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(widget.imgPath),
fit: BoxFit.fill,
fit: BoxFit.fitWidth,
alignment: Alignment.topCenter,
),
borderRadius: const BorderRadius.only(
......
import 'package:flutter/material.dart';
const kPrimaryColor = Colors.teal;
const text_style =
TextStyle(color: Colors.black, fontSize: 12, fontWeight: FontWeight.normal);
const kSecondaryColor = Color(0xFFFF7F50);
enum QuesType{
enum QuesType {
withTwoButton,
withThreeButton,
withSlider,
......@@ -18,23 +21,23 @@ const mealTimeList = [
'Fasting'
];
IconData getMealIconByName (String name){
IconData getMealIconByName(String name) {
switch (name) {
case 'Breakfast':
return Icons.free_breakfast;
case 'Lunch':
return Icons.lunch_dining;
case 'Dinner':
return Icons.dinner_dining;
case 'Snack':
return Icons.local_pizza;
case 'After meal':
return Icons.restaurant_menu;
case 'Before meal':
return Icons.restaurant;
case 'Fasting':
return Icons.no_meals;
default:
return Icons.abc;
case 'Breakfast':
return Icons.free_breakfast;
case 'Lunch':
return Icons.lunch_dining;
case 'Dinner':
return Icons.dinner_dining;
case 'Snack':
return Icons.local_pizza;
case 'After meal':
return Icons.restaurant_menu;
case 'Before meal':
return Icons.restaurant;
case 'Fasting':
return Icons.no_meals;
default:
return Icons.abc;
}
}
}
\ No newline at end of file
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/screens/diabetes/screens/quiz_screen1.dart';
import 'package:flutter/material.dart';
import '../screens/diabetes/screens/quiz_screen.dart';
class DiabetesTestType extends StatelessWidget {
final BuildContext buildContext;
const DiabetesTestType({ Key? key , required this.buildContext}) : super(key: key);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text(
'Select Diabetes Test',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
content:Container(
//height: 50,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextButton(onPressed: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const QuizScreen()),
);
}, child: Text("Test 1")),
TextButton(onPressed: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const QuizScreen1()),
);
}, child: Text("Test 2")),
],
),
),
);
}
}
\ No newline at end of file
This diff is collapsed.
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
return web;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyD5IRuR9PAvwRZzbUcLlRXr7iSkHjEobcs',
appId: '1:247730670466:web:5d195e3ccf6f9a05a05d9b',
messagingSenderId: '247730670466',
projectId: 'diabeta-e2bfe',
authDomain: 'diabeta-e2bfe.firebaseapp.com',
databaseURL: 'https://diabeta-e2bfe-default-rtdb.firebaseio.com',
storageBucket: 'diabeta-e2bfe.appspot.com',
measurementId: 'G-HVPDDELR0B',
);
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyA1ZrNeRH6i2FqLkWfQvdEBJR0glLmLqRU',
appId: '1:247730670466:android:4348a6ed394223efa05d9b',
messagingSenderId: '247730670466',
projectId: 'diabeta-e2bfe',
databaseURL: 'https://diabeta-e2bfe-default-rtdb.firebaseio.com',
storageBucket: 'diabeta-e2bfe.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyBcQtXDuf_2PfRMyMWRkfrSgHlaQF2oNwc',
appId: '1:247730670466:ios:b33e66d123772576a05d9b',
messagingSenderId: '247730670466',
projectId: 'diabeta-e2bfe',
databaseURL: 'https://diabeta-e2bfe-default-rtdb.firebaseio.com',
storageBucket: 'diabeta-e2bfe.appspot.com',
iosClientId: '247730670466-tc414ncddkil5kqcqvqrsn7r4nlo2m9u.apps.googleusercontent.com',
iosBundleId: 'com.example.diabetaApp',
);
}
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/screens/login_screen.dart';
import 'package:diabeta_app/screens/main_screen.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
......@@ -12,15 +13,18 @@ void main() async{
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var _currentUser = FirebaseAuth.instance.currentUser;
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: kPrimaryColor,
),
home: const LoginScreen(),
home: _currentUser!= null? MainScreen(): const LoginScreen(),
);
}
}
......
class ReceivedNotification {
ReceivedNotification({
required this.id,
required this.title,
required this.body,
required this.payload,
});
final int id;
final String? title;
final String? body;
final String? payload;
}
\ No newline at end of file
import '../components/constants.dart';
import 'diabetes_ques.dart';
class DiabetesQuizAns{
final int qno;
final String answer;
class DiabeticQuestions{
static List sampleQuiz1 =<DiabetesQues>[
DiabetesQues(qno: 1, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 2, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 25, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 3, question: "What is your hieght?", type: QuesType.withSlider, minValue: 1, maxValue: 200, defaultValue: 150, unit: "cm", subText: "Your Height"),
DiabetesQues(qno: 4, question: "What is your weight?", type: QuesType.withSlider, minValue: 1, maxValue: 200, defaultValue: 70, unit: "Kg", subText: "Your Weight"),
DiabetesQues(qno: 5, question: "Select your blood glucose?", type: QuesType.withSlider, minValue: 1, maxValue: 300, defaultValue: 80, unit: "mg/dL", subText: "Your Blood Pressure"),
DiabetesQues(qno: 6, question: "Select your blood pressure?", type: QuesType.withSlider, minValue: 1, maxValue: 200, defaultValue: 120, unit: "mmHg", subText: "Your Blood Pressure"),
DiabetesQues(qno: 7, question: "Select your insulin level?", type: QuesType.withSlider, minValue: 1, maxValue: 200, defaultValue: 20, unit: "muU/ml", subText: "Your Insulin"),
DiabetesQues(qno: 8, question: "Select your skin thickness?", type: QuesType.withSlider, minValue: 1, maxValue: 50, defaultValue: 20, unit: "mm", subText: "Your Skin Thickness"),
];
DiabetesQuizAns({required this.qno, required this.answer});
}
static List sampleQuiz2 =<DiabetesQues>[
DiabetesQues(qno: 1, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 2, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 3, question: "Do you have Polyuria?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img: "poliyuria.png", des: 'Polyuria is defined as the frequent passage of large volumes of urine – more than 3 litres a day compared to the normal daily urine output in adults of about 1 to 2 litres.'),
DiabetesQues(qno: 4, question: "Do you have Polydipsia?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img: "polydipsia.png", des: "Polydipsia is the term given to excessive thirst and is one of the initial symptoms of diabetes. It is also usually accompanied by temporary or prolonged dryness of the mouth."),
DiabetesQues(qno: 5, question: "Have you had sudden weight loss?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img:"suddenweightloss.png", des:'Sudden weight loss is a noticeable drop in body weight that occurs even if the person is not trying to lose weight.'),
DiabetesQues(qno: 6, question: "Do you feel Irritability?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img:"irritability.png", des:"Irritability involves feelings of anger or frustration that often arise over even the smallest of things."),
DiabetesQues(qno: 7, question: "Do you have Delayed Healing?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img:"delayedhealing.png", des:" Delayed wound healing is when it takes longer than normal for a wound to heal."),
DiabetesQues(qno: 8, question: "Do you have Partial Paresis?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img:"partialparalisis.png", des: "Partial or incomplete paralysis is when you still have some feeling in, and possibly control over, your paralyzed muscles."),
DiabetesQues(qno: 9, question: "Do you have Alopecia?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img:"alpecia.png", des: " Alopecia areata occurs when the immune system attacks hair follicles and may be brought on by severe stress. The main symptom is hair loss."),
DiabetesQues(qno: 10, question: "Do you have Visual Blurring?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img:"blurredvision.png", des:"Blurred vision refers to a lack of sharpness of vision resulting in the inability to see fine detail."),
];
}
\ No newline at end of file
import '../components/constants.dart';
import 'diabetes_ques.dart';
class DiabeticQuestions{
static List sampleQuiz1 =<DiabetesQues>[
DiabetesQues(qno: 1, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 2, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 3, question: "What is your hieght?", type: QuesType.withSlider, minValue: 1, maxValue: 120, defaultValue: 20, unit: "cm", subText: "Your Height"),
DiabetesQues(qno: 4, question: "What is your weight?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "Kg", subText: "Your Weight"),
DiabetesQues(qno: 5, question: "Select your blood pressure level?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "mmHg", subText: "Your Blood Pressure"),
DiabetesQues(qno: 6, question: "Select your insulin level?", type: QuesType.withSlider, minValue: 1, maxValue: 200, defaultValue: 20, unit: "muU/ml", subText: "Your Insulin"),
];
static List sampleQuiz2 =<DiabetesQues>[
DiabetesQues(qno: 1, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 2, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 3, question: "Do you have Polyuria?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img: "poliyuria.png", des: 'Polyuria is defined as the frequent passage of large volumes of urine – more than 3 litres a day compared to the normal daily urine output in adults of about 1 to 2 litres.'),
DiabetesQues(qno: 4, question: "Do you have Polydipsia?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0, img: "polydipsia.png", des: "Polydipsia is the term given to excessive thirst and is one of the initial symptoms of diabetes. It is also usually accompanied by temporary or prolonged dryness of the mouth."),
DiabetesQues(qno: 5, question: "Have you had sudden weight loss?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 6, question: "Do you feel Irritability?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 7, question: "Do you have Delayed Healing?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 8, question: "Do you have Partial Paresis?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 9, question: "Do you have Alopecia?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 10, question: "Do you have Visual Blurring?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
];
}
\ No newline at end of file
class Exercise{
final String lifestyle, activity, category, diabetes;
Exercise({
required this.lifestyle,
required this.activity,
required this.category,
required this.diabetes
});
}
\ No newline at end of file
import '../components/constants.dart';
import 'diabetes_ques.dart';
class HealthQuestions{
static List kidneyQuiz =<DiabetesQues>[
DiabetesQues(qno: 1, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 2, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 3, question: "What is your hieght?", type: QuesType.withSlider, minValue: 1, maxValue: 120, defaultValue: 20, unit: "cm", subText: "Your Height"),
DiabetesQues(qno: 4, question: "What is your weight?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "Kg", subText: "Your Weight"),
DiabetesQues(qno: 5, question: "Are you taking medicines to any disease?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 6, question: "Has any one in your family had kidney transplant, had kidney failure or been on diagnosis?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 7, question: "Have your urine amount decreased?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 8, question: "Are you having diabetes?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
];
static List eyeQuiz =<DiabetesQues>[
DiabetesQues(qno: 1, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 2, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 3, question: "Select your blood pressure level?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "mmHg", subText: "Your Blood Pressure"),
DiabetesQues(qno: 4, question: "Have you ever had an eye injury or eye surgery?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 5, question: "Have you noticed a changes in your vision over the last 12 months?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 6, question: "Do you have persistent pain in or around the eye?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 7, question: "Are you having diabetes?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
];
static List heartQuiz =<DiabetesQues>[
DiabetesQues(qno: 1, question: "How old are you?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "years", subText: "Your Age"),
DiabetesQues(qno: 2, question: "What is your gender?", type: QuesType.withTwoButton, options: ["Male", "Female"], defaultValue: 0),
DiabetesQues(qno: 3, question: "Select your blood pressure level?", type: QuesType.withSlider, minValue: 1, maxValue: 100, defaultValue: 20, unit: "mmHg", subText: "Your Blood Pressure"),
DiabetesQues(qno: 4, question: "Have you ever had an eye injury or eye surgery?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 5, question: "Have you noticed a changes in your vision over the last 12 months?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 6, question: "Do you have persistent pain in or around the eye?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
DiabetesQues(qno: 7, question: "Are you having diabetes?", type: QuesType.withTwoButton, options: ["Yes", "No"], defaultValue: 0),
];
}
\ No newline at end of file
class LogCount{
final String type;
late DateTime? dateTime;
late int index;
late int inrange;
late int below;
late int above;
LogCount({required this.dateTime, required this.index, required this.type, required this.inrange, required this.below, required this.above});
}
\ No newline at end of file
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/diabetes_ques.dart';
import 'package:diabeta_app/model/diabetes_questions.dart';
import 'package:diabeta_app/model/diabetes_ques_ans.dart';
import 'package:flutter/material.dart';
class QCard extends StatefulWidget {
......
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/diabetes_ques.dart';
import 'package:diabeta_app/model/diabetes_questions.dart';
import 'package:diabeta_app/model/diabetes_ques_ans.dart';
import 'package:flutter/material.dart';
class QCard1 extends StatefulWidget {
......@@ -84,21 +84,26 @@ class _QCardState extends State<QCard1> {
): Container(),
widget.ques.qno == DiabeticQuestions.sampleQuiz2.length ?
Padding(
padding: const EdgeInsets.only(top: 100.0),
padding: const EdgeInsets.only(top: 30.0),
child: Center(
child: InkWell(
onTap: (){
widget.callBack();
},
child: Container(
decoration: BoxDecoration(
color: kSecondaryColor,
border: Border.all(color: kSecondaryColor),
borderRadius: const BorderRadius.all(Radius.circular(20))
child: InkWell(
onTap: () async{
widget.callBack();
},
child: Container(
decoration: BoxDecoration(
color: kSecondaryColor,
border: Border.all(color: kSecondaryColor),
borderRadius: const BorderRadius.all(Radius.circular(20))
),
height: 40,
width: 120,
child: const Center(child: Text('Predict', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),)),
),
height: 40,
width: 120,
child: const Center(child: Text('Predict', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),)),
),
),
),
......@@ -178,14 +183,14 @@ class _QCardState extends State<QCard1> {
InkWell(
onTap: () {
setState(() {
_currentValue = 0;
_currentValue = 1;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue != 1.0 ? kPrimaryColor : Colors.white,
_currentValue == 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
......@@ -197,7 +202,7 @@ class _QCardState extends State<QCard1> {
widget.ques.options![0],
style: TextStyle(
fontSize: 16,
color: _currentValue != 1
color: _currentValue == 1
? Colors.white
: Colors.black),
),
......@@ -209,14 +214,14 @@ class _QCardState extends State<QCard1> {
InkWell(
onTap: () {
setState(() {
_currentValue = 1;
_currentValue = 0;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue == 1.0 ? kPrimaryColor : Colors.white,
_currentValue != 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
......@@ -228,12 +233,12 @@ class _QCardState extends State<QCard1> {
widget.ques.options![1],
style: TextStyle(
fontSize: 16,
color: _currentValue == 1
color: _currentValue != 1
? Colors.white
: Colors.black),
),
)),
)
),
],
)
]);
......
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/diabetes_ques.dart';
import 'package:diabeta_app/model/diabetes_ques_ans.dart';
import 'package:diabeta_app/model/health_ques_ans.dart';
import 'package:flutter/material.dart';
class QHealthCard extends StatefulWidget {
const QHealthCard({Key? key, required this.ques, required this.callBack})
: super(key: key);
final DiabetesQues ques;
final Function() callBack;
@override
State<QHealthCard> createState() => _QCardState();
}
class _QCardState extends State<QHealthCard> {
double _currentValue = 0;
void setAnswer(){
HealthQuestions.kidneyQuiz[widget.ques.qno-1].defaultValue = _currentValue;
}
@override
void initState() {
_currentValue = widget.ques.defaultValue!;
super.initState();
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: const Offset(0, 3), // changes position of shadow
),
],
),
height: 300,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
widget.ques.qno.toString(),
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 20),
),
const Text(" of "),
Text(HealthQuestions.kidneyQuiz.length.toString())
],
),
const SizedBox(
height: 20,
),
Text(
widget.ques.question,
style:
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
getRandomWidget(widget.ques.type),
const SizedBox(
height: 16,
),
widget.ques.img != null ? Image.asset(
"assets/images/"+widget.ques.img!,
width: 80,
height: 80,
): Container(),
widget.ques.des != null ? Text(
widget.ques.des!
): Container(),
widget.ques.qno == HealthQuestions.kidneyQuiz.length ?
Padding(
padding: const EdgeInsets.only(top: 100.0),
child: Center(
child: InkWell(
onTap: (){
widget.callBack();
},
child: InkWell(
onTap: () async{
widget.callBack();
},
child: Container(
decoration: BoxDecoration(
color: kSecondaryColor,
border: Border.all(color: kSecondaryColor),
borderRadius: const BorderRadius.all(Radius.circular(20))
),
height: 40,
width: 120,
child: const Center(child: Text('Predict', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),)),
),
),
),
),
):Container(),
],
),
),
),
);
}
Widget getRandomWidget(QuesType quesType) {
switch (quesType) {
case QuesType.withSlider:
return Column(children: <Widget>[
const SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.ques.subText!),
Row(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(_currentValue.toStringAsFixed(0)),
),
),
Text(" " + widget.ques.unit!)
],
)
],
),
SliderTheme(
data: SliderTheme.of(context).copyWith(
trackShape: CustomTrackShape(),
trackHeight: 16,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 12.0),
),
child: Slider(
value: _currentValue,
max: widget.ques.maxValue!,
min: widget.ques.minValue!,
activeColor: kPrimaryColor,
label: _currentValue.round().toString(),
onChanged: (double value) {
setState(() {
_currentValue = value;
setAnswer();
});
},
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.ques.minValue.toString()),
Text(widget.ques.maxValue.toString()),
],
),
]);
case QuesType.withTwoButton:
return Column(children: <Widget>[
const SizedBox(
height: 16,
),
Row(
children: [
InkWell(
onTap: () {
setState(() {
_currentValue = 1;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue == 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
widget.ques.options![0],
style: TextStyle(
fontSize: 16,
color: _currentValue == 1
? Colors.white
: Colors.black),
),
)),
),
const SizedBox(
width: 8,
),
InkWell(
onTap: () {
setState(() {
_currentValue = 0;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue != 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
widget.ques.options![1],
style: TextStyle(
fontSize: 16,
color: _currentValue != 1
? Colors.white
: Colors.black),
),
)),
),
],
)
]);
default:
return const Text("");
}
}
}
class CustomTrackShape extends RoundedRectSliderTrackShape {
@override
Rect getPreferredRect({
required RenderBox parentBox,
Offset offset = Offset.zero,
required SliderThemeData sliderTheme,
bool isEnabled = false,
bool isDiscrete = false,
}) {
final double? trackHeight = sliderTheme.trackHeight;
final double trackLeft = offset.dx;
final double trackTop =
offset.dy + (parentBox.size.height - trackHeight!) / 2;
final double trackWidth = parentBox.size.width;
return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
}
}
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/diabetes_ques.dart';
import 'package:diabeta_app/model/health_ques_ans.dart';
import 'package:flutter/material.dart';
class QHealth1Card extends StatefulWidget {
const QHealth1Card({Key? key, required this.ques, required this.callBack})
: super(key: key);
final DiabetesQues ques;
final Function() callBack;
@override
State<QHealth1Card> createState() => _QCardState();
}
class _QCardState extends State<QHealth1Card> {
double _currentValue = 0;
void setAnswer(){
HealthQuestions.eyeQuiz[widget.ques.qno-1].defaultValue = _currentValue;
}
@override
void initState() {
_currentValue = widget.ques.defaultValue!;
super.initState();
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: const Offset(0, 3), // changes position of shadow
),
],
),
height: 300,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
widget.ques.qno.toString(),
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 20),
),
const Text(" of "),
Text(HealthQuestions.eyeQuiz.length.toString())
],
),
const SizedBox(
height: 20,
),
Text(
widget.ques.question,
style:
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
getRandomWidget(widget.ques.type),
const SizedBox(
height: 16,
),
widget.ques.img != null ? Image.asset(
"assets/images/"+widget.ques.img!,
width: 80,
height: 80,
): Container(),
widget.ques.des != null ? Text(
widget.ques.des!
): Container(),
widget.ques.qno == HealthQuestions.eyeQuiz.length ?
Padding(
padding: const EdgeInsets.only(top: 100.0),
child: Center(
child: InkWell(
onTap: (){
widget.callBack();
},
child: InkWell(
onTap: () async{
widget.callBack();
},
child: Container(
decoration: BoxDecoration(
color: kSecondaryColor,
border: Border.all(color: kSecondaryColor),
borderRadius: const BorderRadius.all(Radius.circular(20))
),
height: 40,
width: 120,
child: const Center(child: Text('Predict', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),)),
),
),
),
),
):Container(),
],
),
),
),
);
}
Widget getRandomWidget(QuesType quesType) {
switch (quesType) {
case QuesType.withSlider:
return Column(children: <Widget>[
const SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.ques.subText!),
Row(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(_currentValue.toStringAsFixed(0)),
),
),
Text(" " + widget.ques.unit!)
],
)
],
),
SliderTheme(
data: SliderTheme.of(context).copyWith(
trackShape: CustomTrackShape(),
trackHeight: 16,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 12.0),
),
child: Slider(
value: _currentValue,
max: widget.ques.maxValue!,
min: widget.ques.minValue!,
activeColor: kPrimaryColor,
label: _currentValue.round().toString(),
onChanged: (double value) {
setState(() {
_currentValue = value;
setAnswer();
});
},
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.ques.minValue.toString()),
Text(widget.ques.maxValue.toString()),
],
),
]);
case QuesType.withTwoButton:
return Column(children: <Widget>[
const SizedBox(
height: 16,
),
Row(
children: [
InkWell(
onTap: () {
setState(() {
_currentValue = 1;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue == 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
widget.ques.options![0],
style: TextStyle(
fontSize: 16,
color: _currentValue == 1
? Colors.white
: Colors.black),
),
)),
),
const SizedBox(
width: 8,
),
InkWell(
onTap: () {
setState(() {
_currentValue = 0;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue != 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
widget.ques.options![1],
style: TextStyle(
fontSize: 16,
color: _currentValue != 1
? Colors.white
: Colors.black),
),
)),
),
],
)
]);
default:
return const Text("");
}
}
}
class CustomTrackShape extends RoundedRectSliderTrackShape {
@override
Rect getPreferredRect({
required RenderBox parentBox,
Offset offset = Offset.zero,
required SliderThemeData sliderTheme,
bool isEnabled = false,
bool isDiscrete = false,
}) {
final double? trackHeight = sliderTheme.trackHeight;
final double trackLeft = offset.dx;
final double trackTop =
offset.dy + (parentBox.size.height - trackHeight!) / 2;
final double trackWidth = parentBox.size.width;
return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
}
}
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/diabetes_ques.dart';
import 'package:diabeta_app/model/health_ques_ans.dart';
import 'package:flutter/material.dart';
class QHealth3Card extends StatefulWidget {
const QHealth3Card({Key? key, required this.ques, required this.callBack})
: super(key: key);
final DiabetesQues ques;
final Function() callBack;
@override
State<QHealth3Card> createState() => _QCardState();
}
class _QCardState extends State<QHealth3Card> {
double _currentValue = 0;
void setAnswer(){
HealthQuestions.heartQuiz[widget.ques.qno-1].defaultValue = _currentValue;
}
@override
void initState() {
_currentValue = widget.ques.defaultValue!;
super.initState();
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: const Offset(0, 3), // changes position of shadow
),
],
),
height: 300,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
widget.ques.qno.toString(),
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 20),
),
const Text(" of "),
Text(HealthQuestions.heartQuiz.length.toString())
],
),
const SizedBox(
height: 20,
),
Text(
widget.ques.question,
style:
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
getRandomWidget(widget.ques.type),
const SizedBox(
height: 16,
),
widget.ques.img != null ? Image.asset(
"assets/images/"+widget.ques.img!,
width: 80,
height: 80,
): Container(),
widget.ques.des != null ? Text(
widget.ques.des!
): Container(),
widget.ques.qno == HealthQuestions.heartQuiz.length ?
Padding(
padding: const EdgeInsets.only(top: 100.0),
child: Center(
child: InkWell(
onTap: (){
widget.callBack();
},
child: InkWell(
onTap: () async{
widget.callBack();
},
child: Container(
decoration: BoxDecoration(
color: kSecondaryColor,
border: Border.all(color: kSecondaryColor),
borderRadius: const BorderRadius.all(Radius.circular(20))
),
height: 40,
width: 120,
child: const Center(child: Text('Predict', style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),)),
),
),
),
),
):Container(),
],
),
),
),
);
}
Widget getRandomWidget(QuesType quesType) {
switch (quesType) {
case QuesType.withSlider:
return Column(children: <Widget>[
const SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.ques.subText!),
Row(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(20))),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(_currentValue.toStringAsFixed(0)),
),
),
Text(" " + widget.ques.unit!)
],
)
],
),
SliderTheme(
data: SliderTheme.of(context).copyWith(
trackShape: CustomTrackShape(),
trackHeight: 16,
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 12.0),
),
child: Slider(
value: _currentValue,
max: widget.ques.maxValue!,
min: widget.ques.minValue!,
activeColor: kPrimaryColor,
label: _currentValue.round().toString(),
onChanged: (double value) {
setState(() {
_currentValue = value;
setAnswer();
});
},
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(widget.ques.minValue.toString()),
Text(widget.ques.maxValue.toString()),
],
),
]);
case QuesType.withTwoButton:
return Column(children: <Widget>[
const SizedBox(
height: 16,
),
Row(
children: [
InkWell(
onTap: () {
setState(() {
_currentValue = 1;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue == 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
widget.ques.options![0],
style: TextStyle(
fontSize: 16,
color: _currentValue == 1
? Colors.white
: Colors.black),
),
)),
),
const SizedBox(
width: 8,
),
InkWell(
onTap: () {
setState(() {
_currentValue = 0;
setAnswer();
});
},
child: Container(
decoration: BoxDecoration(
color:
_currentValue != 1.0 ? kPrimaryColor : Colors.white,
border: Border.all(
color: kPrimaryColor,
),
borderRadius:
const BorderRadius.all(Radius.circular(10))),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Text(
widget.ques.options![1],
style: TextStyle(
fontSize: 16,
color: _currentValue != 1
? Colors.white
: Colors.black),
),
)),
),
],
)
]);
default:
return const Text("");
}
}
}
class CustomTrackShape extends RoundedRectSliderTrackShape {
@override
Rect getPreferredRect({
required RenderBox parentBox,
Offset offset = Offset.zero,
required SliderThemeData sliderTheme,
bool isEnabled = false,
bool isDiscrete = false,
}) {
final double? trackHeight = sliderTheme.trackHeight;
final double trackLeft = offset.dx;
final double trackTop =
offset.dy + (parentBox.size.height - trackHeight!) / 2;
final double trackWidth = parentBox.size.width;
return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
}
}
......@@ -2,10 +2,10 @@ import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/log_entry.dart';
import 'package:diabeta_app/screens/diabetes/components/b_card.dart';
import 'package:diabeta_app/services/glucose_log_service.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../components/yes_no_model.dart';
class GlucoseLogScreen extends StatefulWidget {
......@@ -24,6 +24,7 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
final TextEditingController _carbsController = TextEditingController();
final TextEditingController _insulinController = TextEditingController();
final TextEditingController _pillController = TextEditingController();
final _currentUser = FirebaseAuth.instance.currentUser;
int selectedIndex = 0;
DateTime date = DateTime.now();
......@@ -85,7 +86,7 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
insulinType: null,
pillType: null,
mealType: mealTimeList[selectedIndex],
userId: '001');
userId: _currentUser!.uid);
String result = await GlucoseLogService.addRecord(logEntry);
return result != "";
......@@ -111,7 +112,7 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
insulinType: null,
pillType: null,
mealType: mealTimeList[selectedIndex],
userId: '001');
userId: _currentUser!.uid);
return await GlucoseLogService.editRecord(logEntry, widget.logEntry!.id);
}
......
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import '../../../components/log_card.dart';
import '../../../services/glucose_log_service.dart';
import 'glucose_log_screen.dart';
class LogbookScreen extends StatefulWidget {
const LogbookScreen({Key? key}) : super(key: key);
LogbookScreen({Key? key, required this.period}) : super(key: key);
String period = "This year";
@override
State<LogbookScreen> createState() => _LogbookScreenState();
}
class _LogbookScreenState extends State<LogbookScreen> {
final _currentUser = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
return Container(
child: FutureBuilder(
future: GlucoseLogService.getAllRecords('001'),
future: GlucoseLogService.getRecordsByTimeFrame(_currentUser!.uid, widget.period),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
int length = snapshot.data!.length;
return ListView(
return length>0 ? ListView(
shrinkWrap: true,
children: List.generate(length, (index) {
return Center(
......@@ -41,7 +44,7 @@ class _LogbookScreenState extends State<LogbookScreen> {
),
);
}),
);
): Container(child: Center(child: Text("No data to display."),),);
} else {
return const Center(
child: CircularProgressIndicator(),
......
import 'dart:typed_data';
import 'package:diabeta_app/services/glucose_log_service.dart';
import 'package:firebase_auth/firebase_auth.dart';
import "package:flutter/material.dart";
import 'package:intl/intl.dart';
import 'package:pdf/pdf.dart';
import 'package:printing/printing.dart';
import 'package:pdf/widgets.dart' as pw;
class PrintLogScreen extends StatelessWidget {
PrintLogScreen({Key? key, required this.period}) : super(key: key);
String period;
final _currentUser = FirebaseAuth.instance.currentUser;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Logbook")),
body: PdfPreview(
build: (format) => _generatePdf(format),
),
);
}
Future<Uint8List> _generatePdf(PdfPageFormat format) async {
final pdf = pw.Document(version: PdfVersion.pdf_1_5, compress: true);
var list = await GlucoseLogService.getRecordsByTimeFrame(_currentUser!.uid, period);
pdf.addPage(pw.MultiPage(
pageFormat: format,
maxPages: 20,
build: (pw.Context context) {
return getBarcodes(list);
}));
return pdf.save();
}
List<pw.Widget> getBarcodes(var list) {
List<pw.Widget> barcodeList = [];
barcodeList.add(pw.Table(
columnWidths: {
0: const pw.FlexColumnWidth(3),
1: const pw.FlexColumnWidth(3),
2: const pw.FlexColumnWidth(2),
3: const pw.FlexColumnWidth(2),
4: const pw.FlexColumnWidth(2),
5: const pw.FlexColumnWidth(2),
},
border: pw.TableBorder.all(width: 1.0, color: PdfColors.teal),
children: [
pw.TableRow(children: [
pw.Text(
"Date",
textScaleFactor: 1.5,
textAlign: pw.TextAlign.center,
),
pw.Text(
"Time",
textScaleFactor: 1.5,
textAlign: pw.TextAlign.center,
),
pw.Text("Glucose", textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
pw.Text("Carbs",textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
pw.Text("Insulin",textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
pw.Text("Pill",textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
]),
],
));
list.forEach((entry) => barcodeList.add(pw.Table(
columnWidths: {
0: const pw.FlexColumnWidth(3),
1: const pw.FlexColumnWidth(3),
2: const pw.FlexColumnWidth(2),
3: const pw.FlexColumnWidth(2),
4: const pw.FlexColumnWidth(2),
5: const pw.FlexColumnWidth(2),
},
border: pw.TableBorder.all(width: 1.0, color: PdfColors.teal),
children: [
pw.TableRow(children: [
pw.Text(
DateFormat('yyyy. MM. dd').format(entry.dateTime).toString(),
textAlign: pw.TextAlign.center,
textScaleFactor: 1.5,
),
pw.Text(
formatTimeOfDay(TimeOfDay.fromDateTime(entry.dateTime))
.toString(),
textAlign: pw.TextAlign.center,
textScaleFactor: 1.5,
),
pw.Text(entry.glucoseLevel == null ? "":entry.glucoseLevel.toString() ,textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
pw.Text(entry.carbs == null ? "":entry.carbs.toString(),textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
pw.Text(entry.insulin == null ? "":entry.insulin.toString(),textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
pw.Text(entry.pill == null ? "":entry.pill.toString(),textAlign: pw.TextAlign.center, textScaleFactor: 1.5),
]),
],
)));
return barcodeList;
}
String formatTimeOfDay(TimeOfDay tod) {
final now = DateTime.now();
final dt = DateTime(now.year, now.month, now.day, tod.hour, tod.minute);
final format = DateFormat.jm(); //"6:00 AM"
return format.format(dt);
}
}
// ignore_for_file: public_member_api_docs
import 'dart:typed_data';
import 'package:diabeta_app/model/diabetes_ques_ans.dart';
import 'package:flutter/material.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
class PrintScreen extends StatelessWidget {
const PrintScreen({Key? key, required this.comment, required this.prediction, required this.riskScore}) : super(key: key);
final String comment;
final bool prediction;
final double riskScore;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Prediction Result")),
body: PdfPreview(
build: (format) => _generatePdf(format),
),
);
}
Future<Uint8List> _generatePdf(PdfPageFormat format) async {
final pdf = pw.Document(version: PdfVersion.pdf_1_5, compress: true);
pdf.addPage(
pw.Page(
pageFormat: PdfPageFormat.a4,
build: (context) {
return pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Container(
width: double.infinity,
color: PdfColors.teal100,
child: pw.Padding(
padding: const pw.EdgeInsets.all(8),
child: pw.Text("Diabetes Prediction Result",
style: pw.TextStyle(
fontSize: 24, fontWeight: pw.FontWeight.bold)),
),
),
pw.SizedBox(height: 24),
pw.Text("1. " + DiabeticQuestions.sampleQuiz1[0].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
DiabeticQuestions.sampleQuiz1[0].defaultValue == 0
? " Male"
: " Female",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("2. " + DiabeticQuestions.sampleQuiz1[1].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
DiabeticQuestions.sampleQuiz1[1].defaultValue
.toStringAsFixed(0) +
" years",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("3. " + DiabeticQuestions.sampleQuiz1[2].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
(DiabeticQuestions.sampleQuiz1[2].defaultValue / 100.00)
.toStringAsFixed(2) +
" m",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("4. " + DiabeticQuestions.sampleQuiz1[3].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
(DiabeticQuestions.sampleQuiz1[3].defaultValue)
.toStringAsFixed(0) +
" Kg",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("5. " + DiabeticQuestions.sampleQuiz1[4].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
(DiabeticQuestions.sampleQuiz1[4].defaultValue)
.toStringAsFixed(0) +
" mg/dL",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("6. " + DiabeticQuestions.sampleQuiz1[5].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
(DiabeticQuestions.sampleQuiz1[5].defaultValue)
.toStringAsFixed(0) +
" mmHg",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("7. " + DiabeticQuestions.sampleQuiz1[6].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
(DiabeticQuestions.sampleQuiz1[6].defaultValue)
.toStringAsFixed(0) +
" muU/ml",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 8),
pw.Text("8. " + DiabeticQuestions.sampleQuiz1[7].question,
style: const pw.TextStyle(fontSize: 18)),
pw.SizedBox(height: 4),
pw.Text(
" " +
(DiabeticQuestions.sampleQuiz1[7].defaultValue)
.toStringAsFixed(0) +
" mm",
style:
const pw.TextStyle(fontSize: 18, color: PdfColors.teal)),
pw.SizedBox(height: 18),
pw.Container(
color: PdfColors.teal100,
child: pw.Padding(
padding: const pw.EdgeInsets.all(8),
child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Text("Test Result",
style: pw.TextStyle(
fontSize: 20, fontWeight: pw.FontWeight.bold)),
pw.SizedBox(height: 8),
pw.Row(children: [
pw.Text("Diabetes Status : ",
style: const pw.TextStyle(
fontSize: 18,
)),
prediction ? pw.Text("Positive",
style: pw.TextStyle(
fontSize: 18,
fontWeight: pw.FontWeight.bold,
color: PdfColors.red900
)):pw.Text("Negative",
style: pw.TextStyle(
fontSize: 18,
fontWeight: pw.FontWeight.bold,
color: PdfColors.green900
))
]),
pw.SizedBox(height: 4),
pw.Row(children: [
pw.Text("Risk Score : ",
style: const pw.TextStyle(
fontSize: 18,
)),
pw.Text(riskScore.toStringAsFixed(2)+ "%",
style: const pw.TextStyle(
fontSize: 18,
))
]),
pw.SizedBox(height: 8),
pw.Text("Comment : ",
style: const pw.TextStyle(
fontSize: 18,
)),
pw.SizedBox(height: 4),
pw.Text(comment,
style: const pw.TextStyle(
fontSize: 18,
))
],
),
),
),
],
);
},
),
);
return pdf.save();
}
}
// ignore_for_file: public_member_api_docs
import 'dart:typed_data';
import 'package:diabeta_app/model/diabetes_ques_ans.dart';
import 'package:flutter/material.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
class PrintScreen1 extends StatelessWidget {
const PrintScreen1(
{Key? key,
required this.comment,
required this.prediction,
required this.riskScore})
: super(key: key);
final String comment;
final bool prediction;
final double riskScore;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Prediction Result")),
body: PdfPreview(
build: (format) => _generatePdf(format),
),
);
}
Future<Uint8List> _generatePdf(PdfPageFormat format) async {
final pdf = pw.Document(version: PdfVersion.pdf_1_5, compress: true);
pdf.addPage(
pw.Page(
pageFormat: PdfPageFormat.a4,
build: (context) {
return pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Container(
width: double.infinity,
color: PdfColors.teal100,
child: pw.Padding(
padding: const pw.EdgeInsets.all(8),
child: pw.Text("Prediabetes Prediction Result",
style: pw.TextStyle(
fontSize: 24, fontWeight: pw.FontWeight.bold)),
),
),
pw.SizedBox(height: 24),
pw.Row(children: [
pw.Text("1. " + DiabeticQuestions.sampleQuiz2[0].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[0].defaultValue == 1
? " Male"
: " Female",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("2. " + DiabeticQuestions.sampleQuiz2[1].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
" " +
DiabeticQuestions.sampleQuiz2[1].defaultValue
.toStringAsFixed(0) +
" years",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("3. " + DiabeticQuestions.sampleQuiz2[2].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[2].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 8),
pw.Row(children: [
pw.Text("4. " + DiabeticQuestions.sampleQuiz2[3].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[3].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("5. " + DiabeticQuestions.sampleQuiz2[4].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[4].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("6. " + DiabeticQuestions.sampleQuiz2[5].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[5].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("7. " + DiabeticQuestions.sampleQuiz2[6].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[6].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("8. " + DiabeticQuestions.sampleQuiz2[7].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[7].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("9. " + DiabeticQuestions.sampleQuiz2[8].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[8].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 12),
pw.Row(children: [
pw.Text("10. " + DiabeticQuestions.sampleQuiz2[9].question,
style: const pw.TextStyle(fontSize: 18)),
pw.Text(
DiabeticQuestions.sampleQuiz2[9].defaultValue == 1
? " Yes"
: " No",
style: const pw.TextStyle(
fontSize: 18, color: PdfColors.teal)),
]),
pw.SizedBox(height: 20),
pw.Container(
color: PdfColors.teal100,
child: pw.Padding(
padding: const pw.EdgeInsets.all(8),
child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Text("Test Result",
style: pw.TextStyle(
fontSize: 20, fontWeight: pw.FontWeight.bold)),
pw.SizedBox(height: 8),
pw.Row(children: [
pw.Text("Diabetes Status : ",
style: const pw.TextStyle(
fontSize: 18,
)),
prediction
? pw.Text("Positive",
style: pw.TextStyle(
fontSize: 18,
fontWeight: pw.FontWeight.bold,
color: PdfColors.red900))
: pw.Text("Negative",
style: pw.TextStyle(
fontSize: 18,
fontWeight: pw.FontWeight.bold,
color: PdfColors.green900))
]),
pw.SizedBox(height: 4),
pw.Row(children: [
pw.Text("Risk Score : ",
style: const pw.TextStyle(
fontSize: 18,
)),
pw.Text(riskScore.toStringAsFixed(2) + "%",
style: const pw.TextStyle(
fontSize: 18,
))
]),
pw.SizedBox(height: 8),
pw.Text("Comment : ",
style: const pw.TextStyle(
fontSize: 18,
)),
pw.SizedBox(height: 4),
pw.Text(comment,
style: const pw.TextStyle(
fontSize: 18,
))
],
),
),
),
],
);
},
),
);
return pdf.save();
}
}
import 'dart:convert';
import 'package:diabeta_app/components/constants.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card.dart';
import 'package:diabeta_app/screens/diabetes/screens/print_screen.dart';
import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart';
import '../../../model/diabetes_questions.dart';
import '../../../model/diabetes_ques_ans.dart';
import '../../../services/diabates_predict_service.dart';
import '../components/q_card.dart';
class QuizScreen extends StatefulWidget {
const QuizScreen({Key? key}) : super(key: key);
......@@ -15,11 +17,28 @@ class QuizScreen extends StatefulWidget {
class _QuizScreenState extends State<QuizScreen> {
bool isLoading = false;
bool isResult = false;
bool isPositive = false;
double riskScore = 0;
final String positiveMsg ="Based on your score, you are likely to have diabetes. Seeing your doctor is the critical next step to determining if you have diabetes.";
final negativeMsg = "Based on your risk score, your diabetes risk is low, continue having a healty life style.";
void setResult(){
void setResult() async {
setState(() {
isLoading = true;
});
String result = await DiabatesPredictService.getDiabatesPrediction();
setState(() {
riskScore = jsonDecode(result)['probability'] * 100;
if (jsonDecode(result)['result'] == 0) {
isPositive = false;
} else {
isPositive = true;
}
isResult = true;
});
}
@override
......@@ -27,9 +46,8 @@ class _QuizScreenState extends State<QuizScreen> {
return Scaffold(
backgroundColor: Colors.teal[100],
appBar: AppBar(
title: const Text("Diabetes Prediction"),
title: const Text("Diabates Prediction"),
centerTitle: true,
backgroundColor: kPrimaryColor,
),
body: !isLoading
? Container(
......@@ -43,26 +61,144 @@ class _QuizScreenState extends State<QuizScreen> {
layout: SwiperLayout.STACK,
pagination: const SwiperPagination(),
itemBuilder: (BuildContext context, int index) {
return QCard(ques: DiabeticQuestions.sampleQuiz1[index], callBack: setResult);
return QCard(
ques: DiabeticQuestions.sampleQuiz1[index],
callBack: setResult);
},
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
: !isResult
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
)
: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 50),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset:
const Offset(0, 3), // changes position of shadow
),
],
),
height: 400,
width: 600,
child: Column(
children: [
Image.asset(
"assets/images/diabetsresult.png",
width: 200,
height: 180,
),
Padding(
padding:
const EdgeInsets.only(bottom: 16.0, left: 24),
child: Row(
children: [
const Text(
"Your Risk Score : ",
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
riskScore <= 50
? Text(
riskScore.toStringAsFixed(2) + "%",
style: const TextStyle(
color: kPrimaryColor,
fontSize: 18,
fontWeight: FontWeight.bold),
)
: Text(
riskScore.toStringAsFixed(2) + "%",
style: TextStyle(
color: Colors.red[400],
fontSize: 18,
fontWeight: FontWeight.bold),
)
],
),
),
isPositive
? Padding(
padding:
const EdgeInsets.only(left: 24.0, right: 24.0),
child: Text(
positiveMsg
),
)
: Padding(
padding:
const EdgeInsets.only(left: 24.0, right: 24.0),
child: Text(
negativeMsg
),
),
const SizedBox(
height: 20,
),
Padding(
padding:
const EdgeInsets.only(left: 24.0, right: 24.0),
child: Padding(
padding: const EdgeInsets.only(
top: 8.0, bottom: 16.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PrintScreen(
prediction: isPositive,
riskScore: riskScore,
comment: isPositive ? positiveMsg : negativeMsg,
)),
);
},
child: Container(
height: 40,
width: 150,
decoration: const BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
)),
child: const Center(
child: Text(
'DOWNLOAD',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
),
),
)
],
),
),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
),
);
}
}
import 'dart:convert';
import 'package:diabeta_app/components/constants.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card1.dart';
import 'package:diabeta_app/screens/diabetes/screens/print_screen1.dart';
import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart';
import '../../../model/diabetes_questions.dart';
import '../../../model/diabetes_ques_ans.dart';
import '../../../services/diabates_predict_service.dart';
class QuizScreen1 extends StatefulWidget {
const QuizScreen1({Key? key}) : super(key: key);
......@@ -16,11 +18,30 @@ class QuizScreen1 extends StatefulWidget {
class _QuizScreenState extends State<QuizScreen1> {
bool isLoading = false;
bool isResult = false;
bool isPositive = false;
double riskScore = 0;
void setResult(){
String positiveMsg =
"Based on your score, you are likely to have prediabetes. Seeing your doctor is the critical next step to determining if you have prediabetes.";
String negativeMsg =
"Based on your risk score, your prediabetes risk is low, continue having a healty life style.";
void setResult() async {
setState(() {
isLoading = true;
});
String result = await DiabatesPredictService.getPrediabatesPrediction();
setState(() {
riskScore = jsonDecode(result)['probability'] * 100;
if (jsonDecode(result)['result'] == 0) {
isPositive = false;
} else {
isPositive = true;
}
isResult = true;
});
}
@override
......@@ -28,7 +49,7 @@ class _QuizScreenState extends State<QuizScreen1> {
return Scaffold(
backgroundColor: Colors.teal[100],
appBar: AppBar(
title: const Text("Diabetes Prediction"),
title: const Text("Prediabates Prediction"),
centerTitle: true,
backgroundColor: kPrimaryColor,
),
......@@ -44,26 +65,141 @@ class _QuizScreenState extends State<QuizScreen1> {
layout: SwiperLayout.STACK,
pagination: const SwiperPagination(),
itemBuilder: (BuildContext context, int index) {
return QCard1(ques: DiabeticQuestions.sampleQuiz2[index], callBack: setResult);
return QCard1(
ques: DiabeticQuestions.sampleQuiz2[index],
callBack: setResult);
},
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
: !isResult
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
)
: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 50),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(20)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset:
const Offset(0, 3), // changes position of shadow
),
],
),
height: 400,
width: 600,
child: Column(
children: [
Image.asset(
"assets/images/diabetsresult.png",
width: 200,
height: 180,
),
Padding(
padding:
const EdgeInsets.only(bottom: 16.0, left: 24),
child: Row(
children: [
const Text(
"Your Risk Score : ",
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
riskScore <= 50
? Text(
riskScore.toString() + "%",
style: const TextStyle(
color: kPrimaryColor,
fontSize: 18,
fontWeight: FontWeight.bold),
)
: Text(
riskScore.toString() + "%",
style: TextStyle(
color: Colors.red[400],
fontSize: 18,
fontWeight: FontWeight.bold),
)
],
),
),
isPositive
? Padding(
padding: const EdgeInsets.only(
left: 24.0, right: 24.0),
child: Text(positiveMsg),
)
: Padding(
padding: const EdgeInsets.only(
left: 24.0, right: 24.0),
child: Text(negativeMsg),
),
const SizedBox(
height: 20,
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PrintScreen1(
prediction: isPositive,
riskScore: riskScore,
comment: isPositive
? positiveMsg
: negativeMsg,
)),
);
},
child: Padding(
padding:
const EdgeInsets.only(left: 24.0, right: 24.0),
child: Padding(
padding:
const EdgeInsets.only(top: 8.0, bottom: 16.0),
child: Container(
height: 40,
width: 150,
decoration: const BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
)),
child: const Center(
child: Text(
'DOWNLOAD',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
),
),
),
],
),
),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
),
);
}
}
import 'package:diabeta_app/model/exercise_cal.dart';
import 'package:diabeta_app/screens/exercise/components/exercise_cal_card.dart';
import 'package:diabeta_app/screens/food/components/food_cal_card.dart';
import 'package:diabeta_app/services/exercise_calc_service.dart';
import 'package:diabeta_app/services/exercise_service.dart';
import 'package:diabeta_app/services/food_calc_service.dart';
import "package:flutter/material.dart";
import 'package:outline_search_bar/outline_search_bar.dart';
......@@ -45,7 +45,7 @@ class _ExersiceCalculatorScreenState extends State<ExersiceCalculatorScreen> {
),
_query != ""
? FutureBuilder(
future: ExerciseCalcService.getExerciseDetails(_query),
future: ExerciseService.getExerciseDetails(_query),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
int length = snapshot.data!.length;
......@@ -72,10 +72,10 @@ class _ExersiceCalculatorScreenState extends State<ExersiceCalculatorScreen> {
),
Container(
height: 150,
width: 150,
width: 170,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/search.jpg"),
image: AssetImage("assets/images/search.png"),
fit: BoxFit.fill,
alignment: Alignment.topCenter,
),
......@@ -85,6 +85,9 @@ class _ExersiceCalculatorScreenState extends State<ExersiceCalculatorScreen> {
),
child: Center(),
),
const SizedBox(
height: 16,
),
const Text("Search for exercises", style: TextStyle(fontSize: 16, color: Colors.black38),)
],
),
......
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/screens/exercise/exercise_calculator_screen.dart';
import 'package:diabeta_app/screens/food/food_calculator_screen.dart';
import 'package:diabeta_app/screens/food/food_recommendation_screen.dart';
import 'package:diabeta_app/screens/exercise/exercise_recommendation_screen.dart';
import 'package:flutter/material.dart';
class ExerciseMainScreen extends StatefulWidget {
......@@ -33,9 +32,9 @@ class _ExerciseMainScreenState extends State<ExerciseMainScreen> {
},
child: Container(
decoration: BoxDecoration(
border: const Border(
top: BorderSide(width: 1, color: Colors.white),
right: BorderSide(width: 1, color: Colors.white)),
// border: const Border(
// top: BorderSide(width: 1, color: Colors.white),
// right: BorderSide(width: 1, color: Colors.white)),
color: selectedIndex == 0 ? Colors.teal[300] : kPrimaryColor,
),
height: 50,
......@@ -54,8 +53,8 @@ class _ExerciseMainScreenState extends State<ExerciseMainScreen> {
},
child: Container(
decoration: BoxDecoration(
border: const Border(
top: BorderSide(width: 1, color: Colors.white)),
// border: const Border(
// top: BorderSide(width: 1, color: Colors.white)),
color: selectedIndex == 1 ? Colors.teal[300] : kPrimaryColor,
),
height: 50,
......@@ -69,7 +68,7 @@ class _ExerciseMainScreenState extends State<ExerciseMainScreen> {
),
selectedIndex == 0 ?
const ExersiceCalculatorScreen():
const FoodRecommendationScreen()
const ExerciseRecommendationScreen()
],
);
}
......
......@@ -70,10 +70,10 @@ class _FoodCalculatorScreenState extends State<FoodCalculatorScreen> {
),
Container(
height: 150,
width: 150,
width: 170,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/search.jpg"),
image: AssetImage("assets/images/search.png"),
fit: BoxFit.fill,
alignment: Alignment.topCenter,
),
......@@ -83,6 +83,9 @@ class _FoodCalculatorScreenState extends State<FoodCalculatorScreen> {
),
child: Center(),
),
const SizedBox(
height: 16,
),
const Text("Search for foods", style: TextStyle(fontSize: 16, color: Colors.black38),)
],
),
......
......@@ -35,9 +35,9 @@ class _FoodMainScreenState extends State<FoodMainScreen> {
},
child: Container(
decoration: BoxDecoration(
border: const Border(
top: BorderSide(width: 1, color: Colors.white),
right: BorderSide(width: 1, color: Colors.white)),
// border: const Border(
// top: BorderSide(width: 1, color: Colors.white),
// right: BorderSide(width: 1, color: Colors.white)),
color: selectedIndex == 0 ? Colors.teal[300] : kPrimaryColor,
),
height: 50,
......@@ -56,8 +56,8 @@ class _FoodMainScreenState extends State<FoodMainScreen> {
},
child: Container(
decoration: BoxDecoration(
border: const Border(
top: BorderSide(width: 1, color: Colors.white)),
// border: const Border(
// top: BorderSide(width: 1, color: Colors.white)),
color: selectedIndex == 1 ? Colors.teal[300] : kPrimaryColor,
),
height: 50,
......
import 'package:diabeta_app/components/constants.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:diabeta_app/model/health_ques_ans.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card_health1.dart';
import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart';
import '../../model/diabetes_ques_ans.dart';
import '../../services/health_predict_service.dart';
class EyeRiskScreen extends StatefulWidget {
const EyeRiskScreen({Key? key}) : super(key: key);
@override
State<EyeRiskScreen> createState() => _EyeRiskScreenState();
}
class _EyeRiskScreenState extends State<EyeRiskScreen> {
bool isLoading = false;
void setResult(){
var result = HealthPredictService.getEyePrediction();
print(result);
setState(() {
isLoading = true;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.teal[100],
appBar: AppBar(
title: const Text("Eye Risk Prediction"),
centerTitle: true,
backgroundColor: kPrimaryColor,
),
body: !isLoading
? Container(
height: 500,
child: Swiper(
loop: false,
itemCount: HealthQuestions.eyeQuiz.length,
itemHeight: 400.0,
itemWidth: 600,
onIndexChanged: (index) {},
layout: SwiperLayout.STACK,
pagination: const SwiperPagination(),
itemBuilder: (BuildContext context, int index) {
return QHealth1Card(ques: HealthQuestions.eyeQuiz[index], callBack: setResult);
},
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
),
);
}
}
import 'package:diabeta_app/components/constants.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:diabeta_app/model/health_ques_ans.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card_health3.dart';
import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart';
import '../../model/diabetes_ques_ans.dart';
import '../../services/health_predict_service.dart';
class HeartRiskScreen extends StatefulWidget {
const HeartRiskScreen({Key? key}) : super(key: key);
@override
State<HeartRiskScreen> createState() => _HeartRiskScreenState();
}
class _HeartRiskScreenState extends State<HeartRiskScreen> {
bool isLoading = false;
void setResult(){
var result = HealthPredictService.getHeartPrediction();
setState(() {
isLoading = true;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.teal[100],
appBar: AppBar(
title: const Text("Heart Risk Prediction"),
centerTitle: true,
backgroundColor: kPrimaryColor,
),
body: !isLoading
? Container(
height: 500,
child: Swiper(
loop: false,
itemCount: HealthQuestions.heartQuiz.length,
itemHeight: 400.0,
itemWidth: 600,
onIndexChanged: (index) {},
layout: SwiperLayout.STACK,
pagination: const SwiperPagination(),
itemBuilder: (BuildContext context, int index) {
return QHealth3Card(ques: HealthQuestions.heartQuiz[index], callBack: setResult);
},
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
),
);
}
}
import 'package:diabeta_app/components/constants.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:diabeta_app/model/health_ques_ans.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card.dart';
import 'package:diabeta_app/screens/diabetes/components/q_card_health.dart';
import 'package:diabeta_app/services/health_predict_service.dart';
import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart';
import '../../model/diabetes_ques_ans.dart';
class KidneyRiskScreen extends StatefulWidget {
const KidneyRiskScreen({Key? key}) : super(key: key);
@override
State<KidneyRiskScreen> createState() => _KidneyRiskScreenState();
}
class _KidneyRiskScreenState extends State<KidneyRiskScreen> {
bool isLoading = false;
void setResult(){
var result = HealthPredictService.getKidneyPrediction();
setState(() {
isLoading = true;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.teal[100],
appBar: AppBar(
title: const Text("Kidney Risk Prediction"),
centerTitle: true,
backgroundColor: kPrimaryColor,
),
body: !isLoading
? Container(
height: 500,
child: Swiper(
loop: false,
itemCount: HealthQuestions.kidneyQuiz.length,
itemHeight: 400.0,
itemWidth: 600,
onIndexChanged: (index) {},
layout: SwiperLayout.STACK,
pagination: const SwiperPagination(),
itemBuilder: (BuildContext context, int index) {
return QHealthCard(ques: HealthQuestions.kidneyQuiz[index], callBack: setResult);
},
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LoadingFlipping.circle(
borderColor: kPrimaryColor,
// borderSize: 3.0,
size: 60.0,
backgroundColor: kPrimaryColor,
duration: const Duration(milliseconds: 2000),
),
const SizedBox(
height: 8,
),
const Text('Loading result...')
],
),
);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import 'dart:convert';
import 'package:diabeta_app/model/ReceivedNotification.dart';
import 'package:shared_preferences/shared_preferences.dart';
class DataStore {
DataStore._privateConstructor();
static final DataStore _instance = DataStore._privateConstructor();
static DataStore get shared => _instance;
static final Future<SharedPreferences> _store = SharedPreferences.getInstance();
List<dynamic> _reminders = [];
Future clearAll() async {
final SharedPreferences store = await _store;
_reminders = [];
await store.clear();
}
Future<List<dynamic>> getReminderList() async {
final SharedPreferences store = await _store;
List<dynamic> _reminders = jsonDecode(store.getString("reminders") ?? '[]');
print("_reminders");
print(_reminders);
return _reminders;
}
setReminderList(ReceivedNotification value) {
_store.then((store) {
_reminders = jsonDecode(store.getString("reminders") ?? '[]');
_reminders.insert(0, {
"id": value.id,
"body": value.body,
"payload": value.payload,
"title": value.title,
});
String newReminders = jsonEncode(_reminders);
print("newReminders");
print(newReminders);
store.setString("reminders", newReminders);
});
}
setReminderFullList(List<dynamic> value) {
_store.then((store) {
String newReminders = jsonEncode(value);
print("newReminders");
print(newReminders);
store.setString("reminders", newReminders);
});
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -49,6 +49,16 @@ dependencies:
loading_animations: ^2.2.0
outline_search_bar: ^2.3.0
dio: ^4.0.6
dropdown_button2: ^1.8.1
timezone: ^0.8.0
rxdart: ^0.27.4
flutter_datetime_picker: ^1.5.1
fluttertoast: ^8.0.8
shared_preferences: ^2.0.15
flutter_local_notifications: ^10.0.0
pdf: ^3.8.3
printing: ^5.9.3
google_fonts: ^3.0.1
dev_dependencies:
flutter_test:
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment