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 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- For apps with targetSDK=31 (Android 12) -->
<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
android:label="DiaBeta"
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/screens/auth_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_core/firebase_core.dart';
import 'package:flutter/material.dart';
......@@ -13,7 +13,7 @@ void main() async {
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var _currentUser = FirebaseAuth.instance.currentUser;
......@@ -24,8 +24,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: kPrimaryColor,
),
home: LoginScreen(),
// home: _currentUser != null ? MainScreen() : const LoginScreen(),
home: _currentUser != null ? const AuthScreen() : 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 {
question: "What is your hieght?",
type: QuesType.withSlider,
minValue: 1,
maxValue: 120,
maxValue: 200,
defaultValue: 20,
unit: "cm",
subText: "Your Height"),
......@@ -32,8 +32,8 @@ class HealthQuestions {
question: "What is your weight?",
type: QuesType.withSlider,
minValue: 1,
maxValue: 100,
defaultValue: 20,
maxValue: 200,
defaultValue: 60,
unit: "Kg",
subText: "Your Weight"),
DiabetesQues(
......@@ -143,7 +143,7 @@ class HealthQuestions {
type: QuesType.withSlider,
minValue: 80,
maxValue: 300,
defaultValue: 20,
defaultValue: 100,
unit: "mg/dL",
subText: "Your Cholesterol"),
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/model/log_entry.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:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
......@@ -11,8 +12,9 @@ import '../../../components/yes_no_model.dart';
class GlucoseLogScreen extends StatefulWidget {
final String title;
final String? glucose;
final LogEntry? logEntry;
const GlucoseLogScreen({Key? key, this.title = "", this.logEntry})
const GlucoseLogScreen({Key? key, this.title = "", this.logEntry, this.glucose})
: super(key: key);
@override
......@@ -55,20 +57,13 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
@override
void initState() {
DatabaseReference starCountRef = FirebaseDatabase.instance.ref('2/Glucose');
starCountRef.onValue.listen((DatabaseEvent event) {
final data = event.snapshot.value;
print(data);
if (mounted) {
setState(() {
if (data != 0) {
_glucoseController.text = data.toString();
}
});
}
});
if(widget.glucose != null){
_glucoseController.text = widget.glucose!;
_changeGlucoseColor(int.parse(widget.glucose!));
}
if (widget.title != "") {
if (widget.logEntry!.glucoseLevel != null) {
_changeGlucoseColor(widget.logEntry!.glucoseLevel!.toInt());
_glucoseController.text = widget.logEntry!.glucoseLevel.toString();
}
if (widget.logEntry!.carbs != null) {
......@@ -244,15 +239,14 @@ class _GlucoseLogScreenState extends State<GlucoseLogScreen> {
? <Widget>[
IconButton(
onPressed: () async {
FirebaseDatabase.instance.ref('2/Glucose').set(0).then((_) {
// Data saved successfully!
}).catchError((error) {
// The write failed...
});
if (_formKey.currentState!.validate()) {
bool result = await _addRecord();
if (result) {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MainScreen()),
);
}
}
},
......
......@@ -404,6 +404,10 @@ class _FoodRecommendationScreenState extends State<FoodRecommendationScreen> {
clean_input += "notdesert ";
}
if(vegNonVeg == "Non Veg"){
vegNonVeg = "non";
}
clean_input += foodType+' ';
clean_input += vegNonVeg+ ' ';
......
......@@ -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/kidney_risk_screen.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'diabetes/screens/quiz_screen1.dart';
......@@ -16,6 +17,12 @@ class HealthCheckScreen extends StatefulWidget {
}
class _HealthCheckScreenState extends State<HealthCheckScreen> {
Future<void> _launchUrl(_url) async {
if (!await launchUrl(Uri.parse(_url))) {
throw 'Could not launch $_url';
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
......@@ -43,27 +50,27 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
topLeft: Radius.circular(40.0),
topRight: Radius.circular(40.0),
)),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const QuizScreen1()),
);
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 32, vertical: 32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Could You Have Prediabetes?',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
Padding(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 32, vertical: 32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Could You Have Prediabetes?',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const QuizScreen1()),
);
},
child: Padding(
padding: const EdgeInsets.only(
top: 8.0, bottom: 16.0),
child: Container(
......@@ -83,44 +90,44 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
)),
),
),
const Text(
'Could You Have Type 2 Diabetes?',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold),
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const QuizScreen()),
);
},
child: Padding(
padding: const EdgeInsets.only(
top: 8.0, bottom: 16.0),
child: Container(
height: 40,
width: 200,
decoration: const BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
)),
child: const Center(
child: Text(
'TAKE THE TEST',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),
)),
),
),
const Text(
'Could You Have Type 2 Diabetes?',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
InkWell(
onTap: () {
_launchUrl("https://diabeta.000webhostapp.com/educations.html");
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// const QuizScreen()),
// );
},
child: Padding(
padding: const EdgeInsets.only(
top: 8.0, bottom: 16.0),
child: Container(
height: 40,
width: 200,
decoration: const BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
)),
child: const Center(
child: Text(
'TAKE THE TEST',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),
)),
),
),
],
),
),
],
),
));
});
......@@ -143,7 +150,8 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const HeartRiskScreen()),
MaterialPageRoute(
builder: (context) => const HeartRiskScreen()),
);
},
),
......@@ -167,7 +175,8 @@ class _HealthCheckScreenState extends State<HealthCheckScreen> {
onTap: () {
Navigator.push(
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/register_screen.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:local_auth/local_auth.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({Key? key}) : super(key: key);
......@@ -13,19 +10,7 @@ class LoginScreen extends StatefulWidget {
State<LoginScreen> createState() => _LoginScreenState();
}
enum _SupportState {
unknown,
supported,
unsupported,
}
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 TextEditingController _userNameController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
......@@ -35,52 +20,6 @@ class _LoginScreenState extends State<LoginScreen> {
@override
void 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
......@@ -96,7 +35,7 @@ class _LoginScreenState extends State<LoginScreen> {
child: Image.asset(
"assets/images/frontlogo.png",
width: 300,
height: 350,
height: 300,
),
),
const Center(
......@@ -176,20 +115,6 @@ class _LoginScreenState extends State<LoginScreen> {
if (_formKey.currentState!.validate()) {
_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(
'Login',
......@@ -203,9 +128,7 @@ class _LoginScreenState extends State<LoginScreen> {
),
),
),
SizedBox(
height: 16,
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Center(
......@@ -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/print_log_screen.dart';
import 'package:diabeta_app/screens/exercise/exercise_main_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/reports/report_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:flutter/material.dart';
import '../components/constants.dart';
......@@ -24,6 +26,21 @@ class _MainScreenState extends State<MainScreen> {
String period = "All records";
String _title = "DiaBeta";
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
Widget build(BuildContext context) {
......@@ -88,7 +105,7 @@ class _MainScreenState extends State<MainScreen> {
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
children: [
const Padding(
padding: EdgeInsets.all(4.0),
child: CircleAvatar(
......@@ -100,7 +117,7 @@ class _MainScreenState extends State<MainScreen> {
Padding(
padding: const EdgeInsets.all(4.0),
child: Text(
_currentUser!.displayName.toString(),
fullname,
style: const TextStyle(color: Colors.white),
),
),
......@@ -282,30 +299,23 @@ class _MainScreenState extends State<MainScreen> {
Navigator.pop(context);
},
),
ListTile(
title: Row(
children: const [
Icon(
Icons.exit_to_app,
color: kPrimaryColor,
),
SizedBox(
width: 8,
),
Text('Logout')
],
),
onTap: () async {
try {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) => const LoginScreen(),
),
);
} on FirebaseAuthException catch (e) {}
},
),
// ListTile(
// title: Row(
// children: const [
// Icon(
// Icons.exit_to_app,
// color: kPrimaryColor,
// ),
// SizedBox(
// width: 8,
// ),
// Text('Logout')
// ],
// ),
// onTap: () async {
// },
// ),
],
),
),
......@@ -335,42 +345,44 @@ class _MainScreenState extends State<MainScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
child: const Text(
'Close',
style: TextStyle(
fontSize: 16,
color: Colors.teal,
fontWeight: FontWeight.bold),
Container(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
child: const Text(
'Close',
style: TextStyle(
fontSize: 16,
color: Colors.teal,
fontWeight: FontWeight.bold),
),
onTap: () {
Navigator.pop(context);
},
),
onTap: () {
Navigator.pop(context);
},
),
const Text(
'Filter',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold),
),
InkWell(
child: const Text(
'Done',
const Text(
'Filter',
style: TextStyle(
fontSize: 16,
color: Colors.teal,
fontWeight: FontWeight.bold),
fontSize: 18, fontWeight: FontWeight.bold),
),
onTap: () {
callBack(period);
Navigator.pop(context);
},
),
],
InkWell(
child: const Text(
'Done',
style: TextStyle(
fontSize: 16,
color: Colors.teal,
fontWeight: FontWeight.bold),
),
onTap: () {
callBack(period);
Navigator.pop(context);
},
),
],
),
),
),
const Divider(),
......
......@@ -46,7 +46,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
child: Image.asset(
"assets/images/frontlogo.png",
width: 300,
height: 350,
height: 300,
),
),
const Padding(
......
......@@ -73,8 +73,7 @@ class _ReminderDetailsState extends State<ReminderDetails> {
return Scaffold(
appBar: AppBar(
elevation: 0,
title: const Text("Reminder Details"),
centerTitle: true,
title: const Text("Add Reminder"),
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: () {
......@@ -119,15 +118,12 @@ class _ReminderDetailsState extends State<ReminderDetails> {
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(17.0),
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40,
),
Padding(
padding: EdgeInsets.only(left: 12.0, bottom: 0),
child: Text(
......
......@@ -33,8 +33,8 @@ class _ReportScreenState extends State<ReportScreen> {
List<SplineAreaWeightData> _chartGlucoseData = <SplineAreaWeightData>[];
List<SplineAreaWeightData> _chartCarbData = <SplineAreaWeightData>[];
final _currentUser = FirebaseAuth.instance.currentUser;
int _gselectedIndex = 0;
int _cselectedIndex = 0;
int _gselectedIndex = 2;
int _cselectedIndex = 2;
void getChartGlucoseDataByTimeFrame() async {
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:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct dev"
description:
......@@ -471,6 +478,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
outline_search_bar:
dependency: "direct main"
description:
......@@ -604,6 +618,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.27.5"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences:
dependency: "direct main"
description:
......@@ -672,6 +693,13 @@ packages:
description: flutter
source: sdk
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:
dependency: transitive
description:
......@@ -742,6 +770,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
......
......@@ -61,6 +61,10 @@ dependencies:
google_fonts: ^3.0.1
firebase_database: ^9.1.7
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:
flutter_test:
......
......@@ -7,7 +7,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:diabeta_app/main.dart';
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