Commit 9063bd34 authored by Wickramasinghe R.J.P's avatar Wickramasinghe R.J.P

mobile app administrator & doctor related functionalities

parent 841e6056
......@@ -24,9 +24,10 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 32
ndkVersion flutter.ndkVersion
compileOptions {
......@@ -47,8 +48,8 @@ android {
applicationId "com.example.canis_care"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
minSdkVersion 20
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
......@@ -68,4 +69,6 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:30.4.1')
implementation 'com.google.firebase:firebase-analytics'
}
{
"project_info": {
"project_number": "315503392169",
"project_id": "caniscare-2033a",
"storage_bucket": "caniscare-2033a.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:315503392169:android:0f2d891b40cf7c3780c0b8",
"android_client_info": {
"package_name": "com.example.canis_care"
}
},
"oauth_client": [
{
"client_id": "315503392169-cr01f1pfqrocvm0d8bribiqrtce9vup6.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCscmFzISq6qV8m-Q5Z1D0kgdsyrxIMBlQ"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "315503392169-cr01f1pfqrocvm0d8bribiqrtce9vup6.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
// Generated file.
//
// If you wish to remove Flutter's multidex support, delete this entire file.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.
package io.flutter.app;
import android.app.Application;
import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.multidex.MultiDex;
/**
* Extension of {@link android.app.Application}, adding multidex support.
*/
public class FlutterMultiDexApplication extends Application {
@Override
@CallSuper
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
......@@ -8,6 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.13'
}
}
......
Dandruff
Invalid_images
Ring_Worm
Yeast_Infection
\ No newline at end of file
Invalid images
Ringworm
YeastInfection
\ No newline at end of file
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import '../models/category.dart';
import '../models/component.dart';
......
import 'package:canis_care/screens/splash_screen.dart';
import 'package:canis_care/screens/welcome_screen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
void main() {
void main() async{
runApp(const MyApp());
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
}
class MyApp extends StatelessWidget {
......
This diff is collapsed.
import 'dart:convert';
import 'package:bubble/bubble.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class ChatBot extends StatefulWidget {
@override
_ChatBotState createState() => _ChatBotState();
}
class _ChatBotState extends State<ChatBot> {
final GlobalKey<AnimatedListState> _listKey = GlobalKey();
List<String> _data = [];
static const String BOT_URL = "http://52.38.189.55:5000/predict/";
TextEditingController queryController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
appBar: AppBar(
backgroundColor: Colors.blue,
centerTitle: true,
title: Text("Vet Bot"),
automaticallyImplyLeading: false,
leading: new IconButton(
icon: new Icon(Icons.arrow_back, color: Colors.orange),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Stack(
children: <Widget>[
AnimatedList(
key: _listKey,
initialItemCount: _data.length,
itemBuilder:
(BuildContext context, int index, Animation<double> animation) {
return buildItem(_data[index], animation, index);
},
),
Align(
alignment: Alignment.bottomCenter,
child: ColorFiltered(
colorFilter: ColorFilter.linearToSrgbGamma(),
child: Container(
color: Colors.white,
child: Padding(
padding: EdgeInsets.only(left: 20, right: 20),
child: TextField(
decoration: InputDecoration(
icon: Icon(
Icons.message,
color: Colors.blue,
),
hintText: "Hello",
fillColor: Colors.white12,
),
controller: queryController,
textInputAction: TextInputAction.send,
onSubmitted: (msg) {
this.getResponse();
},
),
),
),
),
)
],
),
);
}
void getResponse() {
if (queryController.text.length > 0) {
this.insertSingleItem(queryController.text);
var client = getClient();
try {
client.post(
Uri.parse(BOT_URL),
body: {"message": queryController.text},
)..then((response) {
print(response.body);
String data = jsonDecode(response.body);
insertSingleItem(data + "<bot>");
});
} finally {
client.close();
queryController.clear();
}
}
}
void insertSingleItem(String message) {
_data.add(message);
_listKey.currentState?.insertItem(_data.length - 1);
}
http.Client getClient() {
return http.Client();
}
}
Widget buildItem(String item, Animation<double> animation, int index) {
bool mine = item.endsWith("<bot>");
return SizeTransition(
sizeFactor: animation,
child: Padding(
padding: EdgeInsets.only(top: 10),
child: Container(
alignment: mine ? Alignment.topLeft : Alignment.topRight,
child: Bubble(
child: Text(
item.replaceAll("<bot>", ""),
style: TextStyle(color: mine ? Colors.white : Colors.black),
),
color: mine ? Colors.blue : Colors.grey[200],
padding: BubbleEdges.all(10),
),
),
),
);
}
This diff is collapsed.
This diff is collapsed.
import 'dart:convert';
import 'package:canis_care/screens/web_view_screen.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:http/http.dart' as http;
......@@ -33,6 +34,9 @@ class _DiseaseIndividualTopicInfoState
List<DiseaseIndividualSubTopicInfo> subTopicInfoList = [];
int pageIndex = 0;
PageController? _pageController;
late String link;
String url = "https://canis-care-auto.herokuapp.com";
// String url = "http://192.168.1.101:8000";
@override
void dispose() {
......@@ -42,32 +46,39 @@ class _DiseaseIndividualTopicInfoState
@override
void initState() {
_retrieveSeeAlsoLink();
_retrieveSubTopicsDetails();
super.initState();
_pageController = PageController();
}
_retrieveSeeAlsoLink() async {
String retrieveUri = "$url/diseaselink/${widget.disease.diseaseName}/";
List responses = json.decode(
utf8.decode((await client.get(Uri.parse(retrieveUri))).bodyBytes));
setState(() {
link = responses[0];
});
}
_retrieveSubTopicsDetails() async {
subTopicsInfo = [];
String retrieveUri = "http://192.168.1.102:8000/disease/" +
widget.disease.diseaseName +
"/" +
widget.category.topic +
"/" +
widget.diseaseIndividualTopic.individualTopic +
"/";
String retrieveUri =
"$url/disease/${widget.disease.diseaseName}/${widget.category.topic}/${widget.diseaseIndividualTopic.individualTopic}/";
List responses = json.decode(
utf8.decode((await client.get(Uri.parse(retrieveUri))).bodyBytes));
for (var element in responses) {
// String res = element.substring(element.indexOf('#'));
// String res2 = res.replaceAll("#", "");
var encoded = utf8.encode(element);
var decoded = utf8.decode(encoded);
var formatted = decoded.substring(1);
subTopicsInfo.add(formatted);
if (decoded.startsWith(RegExp(r'[A-Z][a-z]'))) {
subTopicsInfo.add(decoded);
} else {
var formatted = decoded.substring(1);
subTopicsInfo.add(formatted);
}
}
// var newDiseases = List<String>.from(diseases);
subTopicInfoList = List.generate(
subTopicsInfo.length,
(index) => DiseaseIndividualSubTopicInfo(
......@@ -141,13 +152,14 @@ class _DiseaseIndividualTopicInfoState
BorderRadius.circular(16),
color: Colors.blue,
),
margin: EdgeInsets.only(
margin: const EdgeInsets.only(
top: 5.0, bottom: 15),
child: Card(
child: Container(
margin: EdgeInsets.only(
margin: const EdgeInsets.only(
bottom: 30),
padding: EdgeInsets.all(5.0),
padding:
const EdgeInsets.all(5.0),
child: Text(
subTopicInfoList[index]
.individualTopicInfo,
......@@ -169,27 +181,44 @@ class _DiseaseIndividualTopicInfoState
visible: index == subTopicInfoList.length - 1,
child: Padding(
padding: const EdgeInsets.only(top: 10),
child: FlatButton(
onPressed: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) =>
// DiseaseDetails(
// disease: diseaseList[index],
// )),
// );
},
color: Colors.cyan,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(50)),
padding: const EdgeInsets.all(15),
child: const Text(
"See Also",
style: TextStyle(
color: Colors.black,
fontSize: 15,
fontWeight: FontWeight.bold),
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.greenAccent,
child: InkWell(
splashColor:
Colors.cyan.withOpacity(0.2),
highlightColor:
Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
DiseaseWebView(
link: link,
disease:
widget.disease,
)));
},
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(50),
color: Colors.transparent,
border: Border.all(
color: Colors.cyan,
width: 4)),
child: const Text(
"See Also",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15,
color: Colors.black),
),
),
),
),
),
),
......@@ -201,7 +230,7 @@ class _DiseaseIndividualTopicInfoState
),
RawScrollbar(
thumbColor: Colors.redAccent,
radius: Radius.circular(20),
radius: const Radius.circular(20),
thickness: 10,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
......@@ -219,7 +248,7 @@ class _DiseaseIndividualTopicInfoState
child: Container(
width: 20,
height: 20,
margin: EdgeInsets.all(10),
margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.cyan,
borderRadius: BorderRadius.circular(50),
......@@ -240,7 +269,7 @@ class _DiseaseIndividualTopicInfoState
),
],
),
Positioned(bottom: 0, left: 0, right: 0, child: BotBar())
const Positioned(bottom: 0, left: 0, right: 0, child: BotBar())
]),
),
);
......
......@@ -6,6 +6,7 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart';
import 'package:http/http.dart' as http;
import 'package:localstorage/localstorage.dart';
import '../models/category.dart';
import '../models/disease.dart';
......@@ -30,20 +31,30 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
Client client = http.Client();
List<String> subTopics = [];
List<DiseaseIndividualTopic> subTopicList = [];
String status = "true";
final LocalStorage storage = LocalStorage('local_storage_app');
String? infoRole, infoEmail;
String url = "https://canis-care-auto.herokuapp.com";
// String url = "http://192.168.1.101:8000";
@override
void initState() {
_retrieveSubTopics();
getItemFromLocalStorage();
super.initState();
}
void getItemFromLocalStorage() {
Map<String, dynamic> info = json.decode(storage.getItem('info'));
infoEmail = info['email'];
infoRole = info['role'];
}
_retrieveSubTopics() async {
subTopics = [];
String retrieveUri = "http://192.168.1.102:8000/disease/" +
widget.disease.diseaseName +
"/" +
widget.category.topic +
"/";
String retrieveUri =
"$url/disease/${widget.disease.diseaseName}/${widget.category.topic}/";
List responses =
json.decode((await client.get(Uri.parse(retrieveUri))).body);
......@@ -52,7 +63,6 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
String res2 = res.replaceAll("#", "");
subTopics.add(res2);
}
// var newDiseases = List<String>.from(diseases);
subTopicList = List.generate(subTopics.length,
(index) => DiseaseIndividualTopic(individualTopic: subTopics[index]));
setState(() {});
......@@ -63,7 +73,7 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
return Scaffold(
appBar: AppBar(
title:
Text(widget.disease.diseaseName + " " + widget.category.topic)),
Text("${widget.disease.diseaseName} ${widget.category.topic}")),
body: Stack(children: [
Container(
color: Colors.blue[100],
......@@ -122,8 +132,8 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
const SizedBox(width: 8),
children: const [
SizedBox(width: 8),
],
),
const SizedBox(height: 12),
......@@ -137,49 +147,23 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
width: 1,
color: Colors.grey[200]!.withOpacity(0.7),
),
/* RotatedBox(
quarterTurns: 3,
child: Text(
reminder!.isCompleted == 1 ? "NOTED" : "WAITING",
style: GoogleFonts.lato(
textStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),*/
RotatedBox(
quarterTurns: 3,
child: Text(
status == "true" && infoRole == "User"
? "Verified"
: " ",
style: GoogleFonts.lato(
textStyle: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.lightGreenAccent),
),
),
)
]),
),
),
// child: Container(
// width: MediaQuery.of(context).size.width,
// padding: const EdgeInsets.all(15.0),
// child: ListTile(
// title: Text(
// diseaseList[index].diseaseName,
// style: const TextStyle(
// fontSize: 20, fontWeight: FontWeight.w600),
// ),
// onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => DiseaseDetails(
// disease: diseaseList[index],
// )),
// );
// },
// trailing: IconButton(
// icon: const Icon(Icons.view_headline_sharp),
// // onPressed: () => {_deleteNote((notes[index].id).toString())},
// onPressed: () => {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => OnBoarding()),
// )
// }),
// ),
// ),
),
),
),
......@@ -189,7 +173,7 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
),
),
),
Positioned(bottom: 0, left: 0, right: 0, child: BotBar())
const Positioned(bottom: 0, left: 0, right: 0, child: BotBar())
]),
);
}
......
import 'dart:convert';
import 'package:canis_care/screens/disease_screen.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:localstorage/localstorage.dart';
import '../data/disease_sub_topics.dart';
import '../models/component.dart';
......@@ -20,10 +23,10 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: SideDrawer(),
drawer: const SideDrawer(),
appBar: AppBar(
title: Text(
"Home Page",
title: const Text(
"Disease Intelligence",
textAlign: TextAlign.center,
),
),
......@@ -33,7 +36,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(60),
bottomRight: Radius.circular(60),
),
......@@ -44,7 +47,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
'images/symbols/dogvet2.jpg',
'images/symbols/dogs.jpg',
),
fit: BoxFit.cover)),
),
......@@ -67,7 +70,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(bottom: 10),
padding: const EdgeInsets.only(bottom: 10),
child: Text(
"CANIS CARE",
style: GoogleFonts.bungeeShade(
......@@ -83,12 +86,12 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
],
),
),
SizedBox(
const SizedBox(
height: 20,
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.only(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(60),
topRight: Radius.circular(60),
),
......@@ -110,7 +113,8 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DiseaseList(
title: 'All Diseases',
title: componentCategories[index]
.categoryName,
)),
);
},
......@@ -137,7 +141,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
Text(
componentCategories[index]
.categoryName,
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
......
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
class ResetPassword extends StatefulWidget {
const ResetPassword({Key? key}) : super(key: key);
@override
_ResetPasswordState createState() => _ResetPasswordState();
}
class _ResetPasswordState extends State<ResetPassword> {
@override
Widget build(BuildContext context) {
// TODO: implement build
throw UnimplementedError();
}
// TextEditingController _emailTextController = TextEditingController();
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// extendBodyBehindAppBar: true,
// appBar: AppBar(
// backgroundColor: Colors.transparent,
// elevation: 0,
// title: const Text(
// "Reset Password",
// style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
// ),
// ),
// body: Container(
// width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height,
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [
// hexStringToColor("CB2B93"),
// hexStringToColor("9546C4"),
// hexStringToColor("5E61F4")
// ], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
// child: SingleChildScrollView(
// child: Padding(
// padding: EdgeInsets.fromLTRB(20, 120, 20, 0),
// child: Column(
// children: <Widget>[
// const SizedBox(
// height: 20,
// ),
// reusableTextField("Enter Email Id", Icons.person_outline, false,
// _emailTextController),
// const SizedBox(
// height: 20,
// ),
// firebaseUIButton(context, "Reset Password", () {
// FirebaseAuth.instance
// .sendPasswordResetEmail(email: _emailTextController.text)
// .then((value) => Navigator.of(context).pop());
// })
// ],
// ),
// ))),
// );
// }
}
This diff is collapsed.
// import 'package:canis_care/screens//firebase_auth.dart';
import 'dart:convert';
import 'package:canis_care/screens/admin_screen.dart';
import 'package:canis_care/screens/disease_screen.dart';
import 'package:canis_care/widgets/reusable_widget.dart';
import 'package:canis_care/screens/home_screen.dart';
import 'package:canis_care/screens/reset_password.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
// import 'package:firebase_signin/screens/signup_screen.dart';
// import 'package:canis_care/utils/color_utils.dart';
import 'package:flutter/material.dart';
import 'package:localstorage/localstorage.dart';
class SignInScreen extends StatefulWidget {
const SignInScreen({Key? key}) : super(key: key);
@override
_SignInScreenState createState() => _SignInScreenState();
}
class _SignInScreenState extends State<SignInScreen> {
final _auth = FirebaseAuth.instance;
final _formkey = GlobalKey<FormState>();
TextEditingController _passwordTextController = TextEditingController();
TextEditingController _emailTextController = TextEditingController();
final LocalStorage storage = LocalStorage('local_storage_app');
void addItemsToLocalStorage(String email, String role) {
final info = json.encode({'email': email, 'role': role});
storage.setItem('info', info);
}
void getItemFromLocalStorage() {
Map<String, dynamic> info = json.decode(storage.getItem('info'));
final infoEmail = info['email'];
final infoRole = info['role'];
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.cyan.withOpacity(0.8), Colors.transparent],
begin: Alignment.topCenter,
end: Alignment.bottomCenter)),
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.fromLTRB(
20, MediaQuery.of(context).size.height * 0.2, 20, 0),
child: Column(
children: <Widget>[
logoWidget("images/dog_infection-removebg.png"),
const SizedBox(
height: 30,
),
reusableTextField("Enter Username", Icons.person_outline, false,
_emailTextController),
const SizedBox(
height: 20,
),
reusableTextField("Enter Password", Icons.lock_outline, true,
_passwordTextController),
const SizedBox(
height: 5,
),
forgetPassword(context),
firebaseUIButton(context, "Sign In", () {
signIn(
_emailTextController.text, _passwordTextController.text);
}),
// signUpOption()
],
),
),
),
),
);
}
// Row signUpOption() {
// return Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// const Text("Don't have account?",
// style: TextStyle(color: Colors.white70)),
// GestureDetector(
// onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => SignUpScreen()));
// },
// child: const Text(
// " Sign Up",
// style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
// ),
// )
// ],
// );
// }
Widget forgetPassword(BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
height: 35,
alignment: Alignment.bottomRight,
child: TextButton(
child: const Text(
"Forgot Password?",
style: TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
textAlign: TextAlign.right,
),
onPressed: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => ResetPassword())),
),
);
}
void route(String email) {
User? user = FirebaseAuth.instance.currentUser;
var kk = FirebaseFirestore.instance
.collection('users')
.doc(user!.uid)
.get()
.then((DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists) {
String getRole = documentSnapshot.get('role');
addItemsToLocalStorage(email, getRole);
getItemFromLocalStorage();
if (getRole == "Doctor") {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const HomePage(),
),
);
} else if (getRole == "Admin") {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const AdminScreen(),
),
);
} else {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const HomePage(),
),
);
}
} else {
print('Document does not exist on the database');
}
});
}
void signIn(String email, String password) async {
const CircularProgressIndicator();
if (_formkey.currentState?.validate() ?? true) {
try {
UserCredential userCredential =
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: email,
password: password,
);
route(email);
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
print('No user found for that email.');
} else if (e.code == 'wrong-password') {
print('Wrong password provided for that user.');
}
}
}
}
}
// import 'package:firebase_auth/firebase_auth.dart';
// import 'package:firebase_signin/reusable_widgets/reusable_widget.dart';
// import 'package:firebase_signin/screens/home_screen.dart';
// import 'package:firebase_signin/utils/color_utils.dart';
import 'package:canis_care/screens/signin_screen.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
class SignUpScreen extends StatelessWidget {
import '../utils/color_utils.dart';
import '../widgets/reusable_widget.dart';
class SignUpScreen extends StatefulWidget {
const SignUpScreen({Key? key}) : super(key: key);
@override
_SignUpScreenState createState() => _SignUpScreenState();
}
class _SignUpScreenState extends State<SignUpScreen> {
bool showProgress = false;
bool visible = false;
final _formkey = GlobalKey<FormState>();
final _auth = FirebaseAuth.instance;
String role = "Admin";
TextEditingController _passwordTextController = TextEditingController();
TextEditingController _emailTextController = TextEditingController();
TextEditingController _userNameTextController = TextEditingController();
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(child: Text("Sign Up Page")),
return Scaffold(
// extendBodyBehindAppBar: true,
// appBar: AppBar(
// backgroundColor: Colors.transparent,
// elevation: 0,
// // title: const Text(
// // "Sign Up",
// // style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
// // ),
// ),
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.cyan.withOpacity(0.8), Colors.transparent],
begin: Alignment.topCenter,
end: Alignment.bottomCenter)),
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 200, 20, 0),
child: Column(
children: <Widget>[
Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(40)),
),
child: const Text("Sign Up",
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Colors.white)),
),
const SizedBox(
height: 50,
),
reusableTextField("Enter Username", Icons.person_outline, false,
_userNameTextController),
const SizedBox(
height: 20,
),
reusableTextField("Enter Email ID", Icons.person_outline, false,
_emailTextController),
const SizedBox(
height: 20,
),
reusableTextField("Enter Password", Icons.lock_outlined, true,
_passwordTextController),
const SizedBox(
height: 20,
),
firebaseUIButton(context, "Sign Up", () {
signUp(_emailTextController.text,
_passwordTextController.text, role);
})
],
),
))),
);
}
void signUp(String email, String password, String role) async {
const CircularProgressIndicator();
if (_formkey.currentState?.validate() ?? true) {
await _auth
.createUserWithEmailAndPassword(
email: _emailTextController.text,
password: _passwordTextController.text)
.then((value) => {postDetailsToFirestore(email, role)})
.catchError((e) {});
}
}
postDetailsToFirestore(String email, String role) async {
FirebaseFirestore firebaseFirestore = FirebaseFirestore.instance;
var user = _auth.currentUser;
CollectionReference ref = firebaseFirestore.collection('users');
ref.doc(user!.uid).set({'email': email, 'role': role});
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => const SignInScreen()));
}
}
......@@ -19,11 +19,6 @@ class SplashScreen extends StatelessWidget {
color: Colors.cyan,
alignment: Alignment.center,
child: Image.asset("images/logo.png"),
// child: const IconFont(
// color: Colors.white,
// size: 100,
// iconName: 'a',
// ),
),
);
}
......
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:http/http.dart';
import 'package:http/http.dart' as http;
import '../models/disease.dart';
import '../widgets/navigation_controller.dart';
import '../widgets/web_view_menu.dart';
import '../widgets/web_view_stack.dart';
class DiseaseWebView extends StatefulWidget {
const DiseaseWebView({Key? key, required this.link, required this.disease})
: super(key: key);
final String link;
final Disease disease;
@override
State<DiseaseWebView> createState() => _DiseaseWebViewState();
}
class _DiseaseWebViewState extends State<DiseaseWebView> {
final controller =
Completer<WebViewController>(); // Instantiate the controller
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('WebView'),
actions: [
NavigationControls(controller: controller),
// Menu(controller: controller),
],
),
body: WebViewStack(
link: widget.link,
controller: controller,
disease: widget.disease,
));
}
}
import 'package:canis_care/screens/admin_screen.dart';
import 'package:canis_care/screens/home_screen.dart';
import 'package:canis_care/screens/login_screen.dart';
import 'package:canis_care/screens/signin_screen.dart';
import 'package:canis_care/screens/signup_screen.dart';
import 'package:flutter/material.dart';
......@@ -41,25 +43,40 @@ class WelcomeScreen extends StatelessWidget {
const SizedBox(
height: 50,
),
Padding(
padding: const EdgeInsets.all(20),
child: FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginScreen()));
},
color: Colors.cyan,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
padding: const EdgeInsets.all(25),
child: const Text(
"Log In",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold),
Container(
margin:
const EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.transparent,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor: Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const SignInScreen()));
},
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Colors.cyan,
border: Border.all(
color: Colors.transparent, width: 4)),
child: const Text(
"Log In",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.black),
),
),
),
),
),
),
......@@ -100,26 +117,39 @@ class WelcomeScreen extends StatelessWidget {
),
),
),
Padding(
padding:
Container(
margin:
const EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: FlatButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const HomePage()));
},
color: Colors.cyan,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
padding: const EdgeInsets.all(25),
child: const Text(
"Get Started",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold),
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.transparent,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor: Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AdminScreen()));
},
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Colors.transparent,
border:
Border.all(color: Colors.cyan, width: 4)),
child: const Text(
"Admin",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.black),
),
),
),
),
),
),
......
import 'package:flutter/material.dart';
hexStringToColor(String hexColor) {
hexColor = hexColor.toUpperCase().replaceAll("#", "");
if (hexColor.length == 6) {
hexColor = "FF$hexColor";
}
return Color(int.parse(hexColor, radix: 6));
}
import 'package:canis_care/screens/chat_bot.dart';
import 'package:canis_care/screens/disease_intelligence_screen.dart';
import 'package:flutter/material.dart';
import '../screens/home_screen.dart';
class BotBar extends StatelessWidget {
const BotBar({Key? key}) : super(key: key);
......@@ -25,7 +29,11 @@ class BotBar extends StatelessWidget {
size: 30,
color: Colors.blue,
),
onPressed: () {},
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const HomePage()),
);
},
),
),
),
......@@ -33,11 +41,15 @@ class BotBar extends StatelessWidget {
child: Material(
child: IconButton(
icon: const Icon(
Icons.add_a_photo,
Icons.camera_alt,
size: 30,
color: Colors.blue,
),
onPressed: () {},
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const HomePage()),
);
},
),
),
),
......@@ -45,11 +57,16 @@ class BotBar extends StatelessWidget {
child: Material(
child: IconButton(
icon: const Icon(
Icons.account_circle,
Icons.info_rounded,
size: 30,
color: Colors.blue,
),
onPressed: () {},
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const DiseaseIntelligence()),
);
},
),
),
),
......@@ -57,11 +74,15 @@ class BotBar extends StatelessWidget {
child: Material(
child: IconButton(
icon: const Icon(
Icons.ac_unit_rounded,
Icons.chat_rounded,
size: 30,
color: Colors.blue,
),
onPressed: () {},
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => ChatBot()),
);
},
),
),
),
......
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart';
class LoadingPage extends StatelessWidget {
const LoadingPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.indigo,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SpinKitFadingCircle(
color: Colors.cyan,
size: 100.0,
),
Text(
"Please Wait...",
style: GoogleFonts.lato(
textStyle: const TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: Colors.lightGreenAccent),
),
),
]),
),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class NavigationControls extends StatelessWidget {
const NavigationControls({required this.controller, super.key});
final Completer<WebViewController> controller;
@override
Widget build(BuildContext context) {
return FutureBuilder<WebViewController>(
future: controller.future,
builder: (context, snapshot) {
final WebViewController? controller = snapshot.data;
if (snapshot.connectionState != ConnectionState.done ||
controller == null) {
return Row(
children: const <Widget>[
Icon(Icons.arrow_back_ios),
Icon(Icons.arrow_forward_ios),
Icon(Icons.replay),
],
);
}
return Row(
children: <Widget>[
IconButton(
icon: const Icon(Icons.arrow_back_ios),
onPressed: () async {
if (await controller.canGoBack()) {
await controller.goBack();
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('No back history item')),
);
return;
}
},
),
IconButton(
icon: const Icon(Icons.arrow_forward_ios),
onPressed: () async {
if (await controller.canGoForward()) {
await controller.goForward();
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('No forward history item')),
);
return;
}
},
),
IconButton(
icon: const Icon(Icons.replay),
onPressed: () {
controller.reload();
},
),
],
);
},
);
}
}
This diff is collapsed.
import 'package:canis_care/screens/chat_bot.dart';
import 'package:canis_care/widgets/side_drawer_tile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ternav_icons/ternav_icons.dart';
import '../screens/disease_intelligence_screen.dart';
import '../screens/home_screen.dart';
class SideDrawer extends StatelessWidget {
......@@ -42,15 +44,17 @@ class SideDrawer extends StatelessWidget {
icon: TernavIcons.lightOutline.info_1,
title: "Disease Information",
onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(builder: (context) => const HomePage()),
// );
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const DiseaseIntelligence()));
},
),
DrawerListTile(
icon: TernavIcons.lightOutline.message,
title: "Chat Service",
onTap: () {},
onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => ChatBot()));
},
),
const SizedBox(
height: 10,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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