Commit 1c336c23 authored by Nilupul Jayasekara's avatar Nilupul Jayasekara

finalize the main functionalities

parent d3d97f22
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- For apps with targetSDK=31 (Android 12) --> <!-- For apps with targetSDK=31 (Android 12) -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/> <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<queries> <intent> <action android:name="android.intent.action.SENDTO" /> <data android:scheme="mailto" /> </intent> </queries>
<application <application
android:label="DiaBeta" android:label="DiaBeta"
android:name="${applicationName}" android:name="${applicationName}"
......
diabeta_app/assets/images/profile.png

8.69 KB | W: | H:

diabeta_app/assets/images/profile.png

78.2 KB | W: | H:

diabeta_app/assets/images/profile.png
diabeta_app/assets/images/profile.png
diabeta_app/assets/images/profile.png
diabeta_app/assets/images/profile.png
  • 2-up
  • Swipe
  • Onion skin
import 'package:diabeta_app/components/constants.dart'; import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/screens/auth_screen.dart';
import 'package:diabeta_app/screens/login_screen.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_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -24,8 +24,7 @@ class MyApp extends StatelessWidget { ...@@ -24,8 +24,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primarySwatch: kPrimaryColor, primarySwatch: kPrimaryColor,
), ),
home: LoginScreen(), home: _currentUser != null ? const AuthScreen() : const LoginScreen(),
// home: _currentUser != null ? MainScreen() : const LoginScreen(),
); );
} }
} }
class AccountInfo {
String? id;
String? uid;
String? fullname;
String? email;
String? mobile;
String? diabetesType;
String? gender;
DateTime? dob;
DateTime? yod;
AccountInfo({
this.id,
this.uid,
this.fullname,
this.email,
this.mobile,
this.diabetesType,
this.dob,
this.gender,
this.yod});
}
...@@ -23,7 +23,7 @@ class HealthQuestions { ...@@ -23,7 +23,7 @@ class HealthQuestions {
question: "What is your hieght?", question: "What is your hieght?",
type: QuesType.withSlider, type: QuesType.withSlider,
minValue: 1, minValue: 1,
maxValue: 120, maxValue: 200,
defaultValue: 20, defaultValue: 20,
unit: "cm", unit: "cm",
subText: "Your Height"), subText: "Your Height"),
...@@ -32,8 +32,8 @@ class HealthQuestions { ...@@ -32,8 +32,8 @@ class HealthQuestions {
question: "What is your weight?", question: "What is your weight?",
type: QuesType.withSlider, type: QuesType.withSlider,
minValue: 1, minValue: 1,
maxValue: 100, maxValue: 200,
defaultValue: 20, defaultValue: 60,
unit: "Kg", unit: "Kg",
subText: "Your Weight"), subText: "Your Weight"),
DiabetesQues( DiabetesQues(
...@@ -143,7 +143,7 @@ class HealthQuestions { ...@@ -143,7 +143,7 @@ class HealthQuestions {
type: QuesType.withSlider, type: QuesType.withSlider,
minValue: 80, minValue: 80,
maxValue: 300, maxValue: 300,
defaultValue: 20, defaultValue: 100,
unit: "mg/dL", unit: "mg/dL",
subText: "Your Cholesterol"), subText: "Your Cholesterol"),
DiabetesQues( DiabetesQues(
......
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/screens/main_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:local_auth/local_auth.dart';
import 'package:shared_preferences/shared_preferences.dart';
class AuthScreen extends StatefulWidget {
const AuthScreen({Key? key}) : super(key: key);
@override
State<AuthScreen> createState() => _AuthScreenState();
}
enum _SupportState {
unknown,
supported,
unsupported,
}
class _AuthScreenState extends State<AuthScreen> {
final LocalAuthentication auth = LocalAuthentication();
_SupportState _supportState = _SupportState.unknown;
bool? _canCheckBiometrics;
List<BiometricType>? _availableBiometrics;
String _authorized = 'Not Authorized';
bool _isAuthenticating = false;
bool isLoad = true;
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
Future<void> _authenticateWithBiometrics() async {
SharedPreferences prefs = await _prefs;
bool authenticated = false;
if (prefs.getBool("isAppLock") == null) {
prefs.setBool("isAppLock", false);
}
if (prefs.getBool("isAppLock")!) {
isLoad = false;
try {
setState(() {
_isAuthenticating = true;
_authorized = 'Authenticating';
});
authenticated = await auth.authenticate(
localizedReason: 'Scan your fingerprint to authenticate',
options: const AuthenticationOptions(
stickyAuth: true,
biometricOnly: true,
),
);
setState(() {
_isAuthenticating = false;
_authorized = 'Authenticating';
});
} on PlatformException catch (e) {
setState(() {
_isAuthenticating = false;
_authorized = 'Error - ${e.message}';
});
return;
}
if (!mounted) {
return;
}
if (authenticated) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const MainScreen()),
);
}
} else {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const MainScreen()),
);
}
}
@override
void initState() {
auth.isDeviceSupported().then(
(bool isSupported) => setState(() => _supportState = isSupported
? _SupportState.supported
: _SupportState.unsupported),
);
_authenticateWithBiometrics();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: isLoad
? Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 40.0),
child: Image.asset(
"assets/images/frontlogo.png",
width: 300,
height: 300,
),
),
const Center(
child: Text(
"DiaBeta",
style: TextStyle(fontSize: 36, color: Colors.teal),
),
),
],
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MainScreen()),
);
},
child: Padding(
padding: const EdgeInsets.only(bottom: 40),
child: Text(
"Continue",
style: TextStyle(
color: kPrimaryColor,
fontWeight: FontWeight.bold,
fontSize: 16),
),
),
),
],
)
: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 40.0),
child: Image.asset(
"assets/images/frontlogo.png",
width: 300,
height: 300,
),
),
const Center(
child: Text(
"DiaBeta Locked",
style: TextStyle(fontSize: 24, color: Colors.teal),
),
),
],
),
InkWell(
onTap: () {
_authenticateWithBiometrics();
},
child: Padding(
padding: const EdgeInsets.only(bottom: 40),
child: Text(
"Unlock",
style: TextStyle(
color: kPrimaryColor,
fontWeight: FontWeight.bold,
fontSize: 16),
),
),
),
],
),
);
}
}
import 'package:diabeta_app/components/constants.dart'; import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/model/log_entry.dart'; import 'package:diabeta_app/model/log_entry.dart';
import 'package:diabeta_app/screens/diabetes/components/b_card.dart'; import 'package:diabeta_app/screens/diabetes/components/b_card.dart';
import 'package:diabeta_app/screens/main_screen.dart';
import 'package:diabeta_app/services/glucose_log_service.dart'; import 'package:diabeta_app/services/glucose_log_service.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart'; import 'package:firebase_database/firebase_database.dart';
...@@ -11,8 +12,9 @@ import '../../../components/yes_no_model.dart'; ...@@ -11,8 +12,9 @@ import '../../../components/yes_no_model.dart';
class GlucoseLogScreen extends StatefulWidget { class GlucoseLogScreen extends StatefulWidget {
final String title; final String title;
final String? glucose;
final LogEntry? logEntry; final LogEntry? logEntry;
const GlucoseLogScreen({Key? key, this.title = "", this.logEntry}) const GlucoseLogScreen({Key? key, this.title = "", this.logEntry, this.glucose})
: super(key: key); : super(key: key);
@override @override
...@@ -55,20 +57,13 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> { ...@@ -55,20 +57,13 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
@override @override
void initState() { void initState() {
DatabaseReference starCountRef = FirebaseDatabase.instance.ref('2/Glucose'); if(widget.glucose != null){
starCountRef.onValue.listen((DatabaseEvent event) { _glucoseController.text = widget.glucose!;
final data = event.snapshot.value; _changeGlucoseColor(int.parse(widget.glucose!));
print(data);
if (mounted) {
setState(() {
if (data != 0) {
_glucoseController.text = data.toString();
}
});
} }
});
if (widget.title != "") { if (widget.title != "") {
if (widget.logEntry!.glucoseLevel != null) { if (widget.logEntry!.glucoseLevel != null) {
_changeGlucoseColor(widget.logEntry!.glucoseLevel!.toInt());
_glucoseController.text = widget.logEntry!.glucoseLevel.toString(); _glucoseController.text = widget.logEntry!.glucoseLevel.toString();
} }
if (widget.logEntry!.carbs != null) { if (widget.logEntry!.carbs != null) {
...@@ -244,15 +239,14 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> { ...@@ -244,15 +239,14 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
? <Widget>[ ? <Widget>[
IconButton( IconButton(
onPressed: () async { onPressed: () async {
FirebaseDatabase.instance.ref('2/Glucose').set(0).then((_) {
// Data saved successfully!
}).catchError((error) {
// The write failed...
});
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
bool result = await _addRecord(); bool result = await _addRecord();
if (result) { if (result) {
Navigator.pop(context); Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MainScreen()),
);
} }
} }
}, },
......
...@@ -404,6 +404,10 @@ class _FoodRecommendationScreenState extends State<FoodRecommendationScreen> { ...@@ -404,6 +404,10 @@ class _FoodRecommendationScreenState extends State<FoodRecommendationScreen> {
clean_input += "notdesert "; clean_input += "notdesert ";
} }
if(vegNonVeg == "Non Veg"){
vegNonVeg = "non";
}
clean_input += foodType+' '; clean_input += foodType+' ';
clean_input += vegNonVeg+ ' '; clean_input += vegNonVeg+ ' ';
......
...@@ -5,6 +5,7 @@ import 'package:diabeta_app/screens/health/eye_risk_screen.dart'; ...@@ -5,6 +5,7 @@ import 'package:diabeta_app/screens/health/eye_risk_screen.dart';
import 'package:diabeta_app/screens/health/heart_risk_screen.dart'; import 'package:diabeta_app/screens/health/heart_risk_screen.dart';
import 'package:diabeta_app/screens/health/kidney_risk_screen.dart'; import 'package:diabeta_app/screens/health/kidney_risk_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'diabetes/screens/quiz_screen1.dart'; import 'diabetes/screens/quiz_screen1.dart';
...@@ -16,6 +17,12 @@ class HealthCheckScreen extends StatefulWidget { ...@@ -16,6 +17,12 @@ class HealthCheckScreen extends StatefulWidget {
} }
class _HealthCheckScreenState extends State<HealthCheckScreen> { class _HealthCheckScreenState extends State<HealthCheckScreen> {
Future<void> _launchUrl(_url) async {
if (!await launchUrl(Uri.parse(_url))) {
throw 'Could not launch $_url';
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -43,14 +50,6 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> { ...@@ -43,14 +50,6 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
topLeft: Radius.circular(40.0), topLeft: Radius.circular(40.0),
topRight: Radius.circular(40.0), topRight: Radius.circular(40.0),
)), )),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const QuizScreen1()),
);
},
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 32, vertical: 32), horizontal: 32, vertical: 32),
...@@ -60,10 +59,18 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> { ...@@ -60,10 +59,18 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
const Text( const Text(
'Could You Have Prediabetes?', 'Could You Have Prediabetes?',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18, fontWeight: FontWeight.bold),
fontWeight: FontWeight.bold),
), ),
Padding( InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const QuizScreen1()),
);
},
child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 8.0, bottom: 16.0), top: 8.0, bottom: 16.0),
child: Container( child: Container(
...@@ -83,20 +90,21 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> { ...@@ -83,20 +90,21 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
)), )),
), ),
), ),
),
const Text( const Text(
'Could You Have Type 2 Diabetes?', 'Could You Have Type 2 Diabetes?',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18, fontWeight: FontWeight.bold),
fontWeight: FontWeight.bold),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( _launchUrl("https://diabeta.000webhostapp.com/educations.html");
context, // Navigator.push(
MaterialPageRoute( // context,
builder: (context) => // MaterialPageRoute(
const QuizScreen()), // builder: (context) =>
); // const QuizScreen()),
// );
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
...@@ -121,7 +129,6 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> { ...@@ -121,7 +129,6 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
), ),
], ],
), ),
),
)); ));
}); });
// showDialog( // showDialog(
...@@ -143,7 +150,8 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> { ...@@ -143,7 +150,8 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => const HeartRiskScreen()), MaterialPageRoute(
builder: (context) => const HeartRiskScreen()),
); );
}, },
), ),
...@@ -167,7 +175,8 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> { ...@@ -167,7 +175,8 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => const KidneyRiskScreen()), MaterialPageRoute(
builder: (context) => const KidneyRiskScreen()),
); );
}, },
), ),
......
import 'package:diabeta_app/components/constants.dart';
import 'package:diabeta_app/screens/main_screen.dart'; import 'package:diabeta_app/screens/main_screen.dart';
import 'package:diabeta_app/screens/register_screen.dart'; import 'package:diabeta_app/screens/register_screen.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:local_auth/local_auth.dart';
class LoginScreen extends StatefulWidget { class LoginScreen extends StatefulWidget {
const LoginScreen({Key? key}) : super(key: key); const LoginScreen({Key? key}) : super(key: key);
...@@ -13,19 +10,7 @@ class LoginScreen extends StatefulWidget { ...@@ -13,19 +10,7 @@ class LoginScreen extends StatefulWidget {
State<LoginScreen> createState() => _LoginScreenState(); State<LoginScreen> createState() => _LoginScreenState();
} }
enum _SupportState {
unknown,
supported,
unsupported,
}
class _LoginScreenState extends State<LoginScreen> { class _LoginScreenState extends State<LoginScreen> {
final LocalAuthentication auth = LocalAuthentication();
_SupportState _supportState = _SupportState.unknown;
bool? _canCheckBiometrics;
List<BiometricType>? _availableBiometrics;
String _authorized = 'Not Authorized';
bool _isAuthenticating = false;
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final TextEditingController _userNameController = TextEditingController(); final TextEditingController _userNameController = TextEditingController();
final TextEditingController _passwordController = TextEditingController(); final TextEditingController _passwordController = TextEditingController();
...@@ -35,52 +20,6 @@ class _LoginScreenState extends State<LoginScreen> { ...@@ -35,52 +20,6 @@ class _LoginScreenState extends State<LoginScreen> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
auth.isDeviceSupported().then(
(bool isSupported) => setState(() => _supportState = isSupported
? _SupportState.supported
: _SupportState.unsupported),
);
_authenticateWithBiometrics();
}
Future<void> _authenticateWithBiometrics() async {
bool authenticated = false;
try {
setState(() {
_isAuthenticating = true;
_authorized = 'Authenticating';
});
authenticated = await auth.authenticate(
localizedReason:
'Scan your fingerprint to authenticate',
options: const AuthenticationOptions(
stickyAuth: true,
biometricOnly: true,
),
);
setState(() {
_isAuthenticating = false;
_authorized = 'Authenticating';
});
} on PlatformException catch (e) {
print(e);
setState(() {
_isAuthenticating = false;
_authorized = 'Error - ${e.message}';
});
return;
}
if (!mounted) {
return;
}
final String message = authenticated ? 'Authorized' : 'Not Authorized';
if(authenticated){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const MainScreen()),
);
}
} }
@override @override
...@@ -96,7 +35,7 @@ class _LoginScreenState extends State<LoginScreen> { ...@@ -96,7 +35,7 @@ class _LoginScreenState extends State<LoginScreen> {
child: Image.asset( child: Image.asset(
"assets/images/frontlogo.png", "assets/images/frontlogo.png",
width: 300, width: 300,
height: 350, height: 300,
), ),
), ),
const Center( const Center(
...@@ -176,20 +115,6 @@ class _LoginScreenState extends State<LoginScreen> { ...@@ -176,20 +115,6 @@ class _LoginScreenState extends State<LoginScreen> {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
_login(); _login();
} }
// if (_userNameController.text == "amal" &&
// _passwordController.text == "1234") {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => const MainScreen()),
// );
// } else {
// const snackBar = SnackBar(
// content: Text("Invalid username or password."),
// backgroundColor: Colors.red);
// ScaffoldMessenger.of(context)
// .showSnackBar(snackBar);
// }
}, },
child: const Text( child: const Text(
'Login', 'Login',
...@@ -203,9 +128,7 @@ class _LoginScreenState extends State<LoginScreen> { ...@@ -203,9 +128,7 @@ class _LoginScreenState extends State<LoginScreen> {
), ),
), ),
), ),
SizedBox(
height: 16,
),
const Padding( const Padding(
padding: EdgeInsets.symmetric(vertical: 16.0), padding: EdgeInsets.symmetric(vertical: 16.0),
child: Center( child: Center(
...@@ -291,6 +214,9 @@ class _LoginScreenState extends State<LoginScreen> { ...@@ -291,6 +214,9 @@ class _LoginScreenState extends State<LoginScreen> {
// ); // );
// }, // },
// ), // ),
const SizedBox(
height: 24,
),
], ],
), ),
), ),
......
import 'package:diabeta_app/model/account_info.dart';
import 'package:diabeta_app/screens/diabetes/screens/logbook_screen.dart'; import 'package:diabeta_app/screens/diabetes/screens/logbook_screen.dart';
import 'package:diabeta_app/screens/diabetes/screens/print_log_screen.dart'; import 'package:diabeta_app/screens/diabetes/screens/print_log_screen.dart';
import 'package:diabeta_app/screens/exercise/exercise_main_screen.dart'; import 'package:diabeta_app/screens/exercise/exercise_main_screen.dart';
...@@ -7,6 +8,7 @@ import 'package:diabeta_app/screens/dashboard_screen.dart'; ...@@ -7,6 +8,7 @@ import 'package:diabeta_app/screens/dashboard_screen.dart';
import 'package:diabeta_app/screens/reminders/reminder_screen.dart'; import 'package:diabeta_app/screens/reminders/reminder_screen.dart';
import 'package:diabeta_app/screens/reports/report_screen.dart'; import 'package:diabeta_app/screens/reports/report_screen.dart';
import 'package:diabeta_app/screens/settings/settings_screen.dart'; import 'package:diabeta_app/screens/settings/settings_screen.dart';
import 'package:diabeta_app/services/account_service.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../components/constants.dart'; import '../components/constants.dart';
...@@ -24,6 +26,21 @@ class _MainScreenState extends State<MainScreen> { ...@@ -24,6 +26,21 @@ class _MainScreenState extends State<MainScreen> {
String period = "All records"; String period = "All records";
String _title = "DiaBeta"; String _title = "DiaBeta";
final _currentUser = FirebaseAuth.instance.currentUser; final _currentUser = FirebaseAuth.instance.currentUser;
String fullname = "";
@override
void initState() {
getAccountInfo();
super.initState();
}
void getAccountInfo() async {
AccountInfo accountInfo =
await AccountService.getAccountInfoByID(_currentUser!.uid);
setState(() {
fullname = accountInfo.fullname ?? "";
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -100,7 +117,7 @@ class _MainScreenState extends State<MainScreen> { ...@@ -100,7 +117,7 @@ class _MainScreenState extends State<MainScreen> {
Padding( Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: Text( child: Text(
_currentUser!.displayName.toString(), fullname,
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),
...@@ -282,30 +299,23 @@ class _MainScreenState extends State<MainScreen> { ...@@ -282,30 +299,23 @@ class _MainScreenState extends State<MainScreen> {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
ListTile( // ListTile(
title: Row( // title: Row(
children: const [ // children: const [
Icon( // Icon(
Icons.exit_to_app, // Icons.exit_to_app,
color: kPrimaryColor, // color: kPrimaryColor,
), // ),
SizedBox( // SizedBox(
width: 8, // width: 8,
), // ),
Text('Logout') // Text('Logout')
], // ],
), // ),
onTap: () async { // onTap: () async {
try {
await FirebaseAuth.instance.signOut(); // },
Navigator.of(context).pushReplacement( // ),
MaterialPageRoute(
builder: (context) => const LoginScreen(),
),
);
} on FirebaseAuthException catch (e) {}
},
),
], ],
), ),
), ),
...@@ -335,7 +345,8 @@ class _MainScreenState extends State<MainScreen> { ...@@ -335,7 +345,8 @@ class _MainScreenState extends State<MainScreen> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Container(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
...@@ -373,6 +384,7 @@ class _MainScreenState extends State<MainScreen> { ...@@ -373,6 +384,7 @@ class _MainScreenState extends State<MainScreen> {
], ],
), ),
), ),
),
const Divider(), const Divider(),
Container( Container(
height: 32, height: 32,
......
...@@ -46,7 +46,7 @@ class _RegisterScreenState extends State<RegisterScreen> { ...@@ -46,7 +46,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
child: Image.asset( child: Image.asset(
"assets/images/frontlogo.png", "assets/images/frontlogo.png",
width: 300, width: 300,
height: 350, height: 300,
), ),
), ),
const Padding( const Padding(
......
...@@ -73,8 +73,7 @@ class _ReminderDetailsState extends State<ReminderDetails> { ...@@ -73,8 +73,7 @@ class _ReminderDetailsState extends State<ReminderDetails> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
title: const Text("Reminder Details"), title: const Text("Add Reminder"),
centerTitle: true,
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: () { onPressed: () {
...@@ -119,15 +118,12 @@ class _ReminderDetailsState extends State<ReminderDetails> { ...@@ -119,15 +118,12 @@ class _ReminderDetailsState extends State<ReminderDetails> {
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Padding( child: Padding(
padding: const EdgeInsets.all(17.0), padding: const EdgeInsets.all(16.0),
child: Center( child: Center(
child: Column( child: Column(
// mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(
height: 40,
),
Padding( Padding(
padding: EdgeInsets.only(left: 12.0, bottom: 0), padding: EdgeInsets.only(left: 12.0, bottom: 0),
child: Text( child: Text(
......
...@@ -33,8 +33,8 @@ class _ReportScreenState extends State<ReportScreen> { ...@@ -33,8 +33,8 @@ class _ReportScreenState extends State<ReportScreen> {
List<SplineAreaWeightData> _chartGlucoseData = <SplineAreaWeightData>[]; List<SplineAreaWeightData> _chartGlucoseData = <SplineAreaWeightData>[];
List<SplineAreaWeightData> _chartCarbData = <SplineAreaWeightData>[]; List<SplineAreaWeightData> _chartCarbData = <SplineAreaWeightData>[];
final _currentUser = FirebaseAuth.instance.currentUser; final _currentUser = FirebaseAuth.instance.currentUser;
int _gselectedIndex = 0; int _gselectedIndex = 2;
int _cselectedIndex = 0; int _cselectedIndex = 2;
void getChartGlucoseDataByTimeFrame() async { void getChartGlucoseDataByTimeFrame() async {
List<SplineAreaWeightData> _data = <SplineAreaWeightData>[]; List<SplineAreaWeightData> _data = <SplineAreaWeightData>[];
......
import 'package:flutter/material.dart';
class SubscribeScreen extends StatelessWidget {
const SubscribeScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0.5,
centerTitle: true,
actions: [
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Icons.close,
color: Colors.black87,
size: 20,
))
],
title: const Text(
"Subscribe",
style: TextStyle(color: Colors.black87, fontSize: 16),
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
SizedBox(
width: double.infinity,
child: const Text(
"Choose your favourite plan and do something good for you and your diabetes.",
textAlign: TextAlign.center,
),
),
Card()
],
),
),
),
);
}
}
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:diabeta_app/model/account_info.dart';
class AccountService {
static final CollectionReference _records =
FirebaseFirestore.instance.collection('account_info');
static Future<String> addRecord(AccountInfo accountInfo) {
return _records.add({
'uid': accountInfo.uid,
'fullname': accountInfo.fullname,
'email': accountInfo.email,
'mobile': accountInfo.mobile,
'diabetesType': accountInfo.diabetesType,
'gender': accountInfo.gender,
'dob': accountInfo.dob,
'yod': accountInfo.yod
}).then((value) {
return value.id;
}).catchError((error) {
return "";
});
}
static Future<bool> editRecord(AccountInfo accountInfo, String? id) {
return _records
.doc(id)
.update({
'fullname': accountInfo.fullname,
'email': accountInfo.email,
'mobile': accountInfo.mobile,
'diabetesType': accountInfo.diabetesType,
'gender': accountInfo.gender,
'dob': accountInfo.dob,
'yod': accountInfo.yod
})
.then((value) => true)
.catchError((error) => false);
}
static Future<AccountInfo> getAccountInfoByID(String id) async {
AccountInfo accountInfo = new AccountInfo();
await _records
.where("uid", isEqualTo: id)
.get()
.then((QuerySnapshot querySnapshot) {
querySnapshot.docs.forEach((doc) {
accountInfo = AccountInfo(
id: doc.id,
uid: doc["uid"],
dob: doc["dob"] !=null ? DateTime.parse(doc["dob"].toDate().toString()): null,
yod: doc["yod"] != null ? DateTime.parse(doc["yod"].toDate().toString()): null,
diabetesType: doc["diabetesType"],
email: doc["email"],
fullname: doc["fullname"],
gender: doc["gender"],
mobile: doc["mobile"],
);
});
}).catchError((error) {
print(error);
});
return accountInfo;
}
}
...@@ -265,6 +265,13 @@ packages: ...@@ -265,6 +265,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.1" version: "1.5.1"
flutter_email_sender:
dependency: "direct main"
description:
name: flutter_email_sender
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
...@@ -471,6 +478,13 @@ packages: ...@@ -471,6 +478,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
outline_search_bar: outline_search_bar:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -604,6 +618,13 @@ packages: ...@@ -604,6 +618,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.27.5" version: "0.27.5"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -672,6 +693,13 @@ packages: ...@@ -672,6 +693,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
smooth_star_rating_nsafe:
dependency: "direct main"
description:
name: smooth_star_rating_nsafe
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0+1"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
...@@ -742,6 +770,62 @@ packages: ...@@ -742,6 +770,62 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.6"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.21"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
......
...@@ -61,6 +61,10 @@ dependencies: ...@@ -61,6 +61,10 @@ dependencies:
google_fonts: ^3.0.1 google_fonts: ^3.0.1
firebase_database: ^9.1.7 firebase_database: ^9.1.7
local_auth: ^2.1.2 local_auth: ^2.1.2
smooth_star_rating_nsafe: 1.0.0+1
flutter_email_sender: ^5.1.0
share: ^2.0.4
url_launcher: ^6.1.6
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:diabeta_app/main.dart'; import 'package:diabeta_app/main.dart';
void main() { void main() {
......
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