-Empowering Your Health Journey with Predictive Insights and Informed Wellness Choices-
SymptoScan- your health guardian, seamlessly predicting diseases, offering personalized health insights, and fostering a proactive well-being revolution through cutting-edge technology and user-centric design.
lib
for Flutter code and
functions
for Firebase Cloud Functions.lib
further divided into logical sections like screens
,
widgets
, and services
for clarity.
import 'dart:io';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:symptoscan/onboard.dart';
import 'package:symptoscan/healthTips.dart';
import 'LoginScreen.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
Platform.isAndroid
? await Firebase.initializeApp(
options: const FirebaseOptions(
apiKey: "AIzaSyDIH2j0aCaGsPKia4Eyxt8RJ4SKS0N3I3Y",
appId: "1:65940199642:android:ef2aad26c56a2baeeeade3",
messagingSenderId: "65940199642",
projectId: "symptoscan-3fa23"),
)
: Firebase.initializeApp(); // Initialize Firebase
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: onBoard(),
);
}
}
import 'package:flutter/material.dart';
void main() {
runApp(MainHomeScreen());
}
class MainHomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Health App',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State {
int _currentIndex = 0;
final List _tabs = [
HealthTipsPage(),
ChatbotPage(),
ProfilePage(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Health App'),
),
body: _tabs[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.lightbulb_outline),
label: 'Health Tips',
),
BottomNavigationBarItem(
icon: Icon(Icons.chat),
label: 'Chatbot',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
],
),
);
}
}
class HealthTipsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text('Health Tips Page'),
);
}
}
class ChatbotPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text('Chatbot Page'),
);
}
}
class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text('Profile Page'),
);
}
}
import 'package:flutter/material.dart';
import 'package:symptoscan/CreateAccount.dart';
import 'package:symptoscan/HomeScreen.dart';
import 'package:symptoscan/Methods.dart';
import 'package:symptoscan/LoginScreen.dart';
import 'HomeScreen.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State createState() => _LoginScreenState();
}
class _LoginScreenState extends State {
final TextEditingController _email = TextEditingController();
final TextEditingController _password = TextEditingController();
bool isLoading = false;
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Scaffold(
body: isLoading
? Center(
child: Container(
height: size.height / 20,
width: size.height / 20,
child: CircularProgressIndicator(),
),
)
: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: size.height / 20,
),
Container(
alignment: Alignment.centerLeft,
height: size.height / 10,
width: size.width / 1.2,
),
SizedBox(
height: size.height / 50,
),
Container(
width: size.width / 1.3,
child: Text(
"Welcome",
style:
TextStyle(fontSize: 34, fontWeight: FontWeight.bold),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Container(
width: size.width / 1.3,
child: Text(
"Sign In to Continue!",
style: TextStyle(
color: Colors.grey[700],
fontSize: 22,
fontWeight: FontWeight.w300,
),
),
),
),
SizedBox(
height: size.height / 10,
),
Container(
width: size.width,
alignment: Alignment.center,
child: field(
size, "E-mail Address", Icons.account_box, _email),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 18.0),
child: Container(
width: size.width,
alignment: Alignment.center,
child: field(size, "Password", Icons.lock, _password),
),
),
SizedBox(
height: size.height / 10,
),
customButton(size),
SizedBox(
height: size.height / 40,
),
GestureDetector(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(builder: (_) => CreateAccount())),
child: Text(
"Create Account!",
style: TextStyle(
color: Colors.blue,
fontSize: 16,
fontWeight: FontWeight.w400,
),
),
)
],
),
),
);
}
Widget customButton(Size size) {
return GestureDetector(
onTap: () {
if (_email.text.isNotEmpty && _password.text.isNotEmpty) {
setState(() {
isLoading = true;
});
logIn(_email.text, _password.text).then((user) {
if (user != null) {
print("Login Successful!!!");
setState(() {
isLoading = false;
});
Navigator.push(
context, MaterialPageRoute(builder: (_) => HomeScreen()));
} else {
print("Login Failed.");
setState(() {
isLoading = false;
});
// Show a dialog with an error message
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Login Failed'),
content: Text('Please enter correct Email Address and Password.'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
child: Text('OK'),
),
],
);
},
);
}
});
} else {
print("Please fill up all details!");
setState(() {
isLoading = false;
});
// Show a dialog with an error message
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Validation Error'),
content: Text('Please fill up all details!'),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
child: Text('OK'),
),
],
);
},
);
}
},
child: Container(
height: size.height / 14,
width: size.width / 1.3,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5), color: Colors.blue),
child: Text("Sign In",
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
)),
),
);
}
Widget field(
Size size, String hintText, IconData icon, TextEditingController cont) {
return Container(
height: size.height / 15,
width: size.width / 1.3,
child: TextField(
controller: cont,
decoration: InputDecoration(
prefixIcon: Icon(icon),
hintText: hintText,
hintStyle: TextStyle(color: Colors.grey),
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(10))),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:symptoscan/HomeScreen.dart';
import 'package:symptoscan/LoginScreen.dart';
import 'package:symptoscan/Methods.dart';
class CreateAccount extends StatefulWidget {
const CreateAccount({super.key});
@override
State createState() => _CreateAccountState();
}
class _CreateAccountState extends State {
final TextEditingController _name = TextEditingController();
final TextEditingController _email = TextEditingController();
final TextEditingController _password = TextEditingController();
bool isLoading = false;
@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Scaffold(
body: isLoading
? Center(
child: Container(
height: size.height / 20,
width: size.height / 20,
foregroundDecoration: null,
child: CircularProgressIndicator(),
),
)
: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: size.height / 20,
),
Container(
alignment: Alignment.centerLeft,
height: size.height / 10,
width: size.width / 1.2,
),
SizedBox(
height: size.height / 50,
),
Container(
width: size.width / 1.3,
child: Text(
"Welcome",
style:
TextStyle(fontSize: 34, fontWeight: FontWeight.bold),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Container(
width: size.width / 1.3,
child: Text(
"Sign Up to Continue!",
style: TextStyle(
color: Colors.grey[700],
fontSize: 22,
fontWeight: FontWeight.w300,
),
),
),
),
SizedBox(
height: size.height / 20,
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 18.0),
child: Container(
width: size.width,
alignment: Alignment.center,
child: field(size, "Full Name", Icons.account_box, _name),
),
),
Container(
width: size.width,
alignment: Alignment.center,
child: field(
size, "E-mail Address", Icons.account_box, _email),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 18.0),
child: Container(
width: size.width,
alignment: Alignment.center,
child: field(size, "Password", Icons.lock, _password),
),
),
SizedBox(
height: size.height / 20,
),
customButton(size),
GestureDetector(
onTap: () => Navigator.pop(context),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Text(
"Already have an account?",
style: TextStyle(
color: Colors.red,
fontSize: 16,
fontWeight: FontWeight.w400,
),
),
),
),
],
),
),
);
}
Widget customButton(Size size) {
return GestureDetector(
onTap: () {
if (_name.text.isNotEmpty &&
_email.text.isNotEmpty &&
_password.text.isNotEmpty) {
setState(() {
isLoading = true;
});
createAccount(_name.text, _email.text, _password.text).then((user) {
if (user != null) {
setState(() {
isLoading = false;
});
Navigator.push(
context, MaterialPageRoute(builder: (_) => HomeScreen()));
} else {
print("Account Creation Failed!!!");
setState(() {
isLoading = false;
});
}
});
} else {
print("Please enter your credentials.");
}
},
child: Container(
height: size.height / 14,
width: size.width / 1.3,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5), color: Colors.blue),
child: Text("Create Account",
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
)),
),
);
}
Widget field(
Size size, String hintText, IconData icon, TextEditingController cont) {
return Container(
height: size.height / 15,
width: size.width / 1.3,
child: TextField(
controller: cont,
decoration: InputDecoration(
prefixIcon: Icon(icon),
hintText: hintText,
hintStyle: TextStyle(color: Colors.grey),
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(10))),
),
);
}
}