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) { ...@@ -24,9 +24,10 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion 32
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
compileOptions { compileOptions {
...@@ -47,8 +48,8 @@ android { ...@@ -47,8 +48,8 @@ android {
applicationId "com.example.canis_care" applicationId "com.example.canis_care"
// You can update the following values to match your application needs. // 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. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19 minSdkVersion 20
targetSdkVersion flutter.targetSdkVersion targetSdkVersion 33
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
...@@ -68,4 +69,6 @@ flutter { ...@@ -68,4 +69,6 @@ flutter {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 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 { ...@@ -8,6 +8,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.2' classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.13'
} }
} }
......
Dandruff Dandruff
Invalid_images Invalid images
Ring_Worm Ringworm
Yeast_Infection YeastInfection
\ No newline at end of file \ No newline at end of file
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import '../models/category.dart'; import '../models/category.dart';
import '../models/component.dart'; import '../models/component.dart';
......
import 'package:canis_care/screens/splash_screen.dart'; import 'package:canis_care/screens/splash_screen.dart';
import 'package:canis_care/screens/welcome_screen.dart'; import 'package:canis_care/screens/welcome_screen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { void main() async{
runApp(const MyApp()); runApp(const MyApp());
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
......
import 'dart:convert';
import 'package:canis_care/screens/disease_intelligence_screen.dart';
import 'package:canis_care/widgets/loading_page.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http;
import 'package:http/http.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import '../widgets/side_drawer.dart';
import 'chat_bot.dart';
import 'disease_screen.dart';
class AdminScreen extends StatefulWidget {
const AdminScreen({Key? key}) : super(key: key);
@override
State<AdminScreen> createState() => _AdminScreenState();
}
class _AdminScreenState extends State<AdminScreen> {
// String url = "https://canis-care-auto.herokuapp.com";
String url = "http://192.168.1.101:8000";
Client client = http.Client();
int? status;
bool isLoading = false;
_runCrawlers() async {
String getStatusUri = "$url/data/crawl/";
int response = json.decode(
utf8.decode((await client.get(Uri.parse(getStatusUri))).bodyBytes));
setState(() {
status = response;
if (status == 0) {
isLoading = false;
}
});
}
_preprocessData() async {
String getStatusUri = "$url/data/preprocess/";
int response = json.decode(
utf8.decode((await client.get(Uri.parse(getStatusUri))).bodyBytes));
setState(() {
status = response;
if (status == 0) {
isLoading = false;
}
});
}
_buildOntology() async {
String getStatusUri = "$url/data/build/ontology/";
int response = json.decode(
utf8.decode((await client.get(Uri.parse(getStatusUri))).bodyBytes));
setState(() {
status = response;
if (status == 0) {
isLoading = false;
}
});
}
_showDialog(BuildContext context, String s) async {
return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: Colors.blue[100],
elevation: 50.0,
contentPadding: const EdgeInsets.only(left: 25, right: 25),
title: Center(
child: Text(
s,
style: GoogleFonts.lato(
textStyle: const TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
color: Colors.blue),
),
textAlign: TextAlign.center,
),
),
content: const Icon(
Icons.check_circle,
color: Colors.green,
size: 80,
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))),
actions: <Widget>[
Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.20,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.lightBlueAccent,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor: Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.of(context).pop();
},
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(
"OK",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
),
),
)),
],
);
});
}
@override
Widget build(BuildContext context) => isLoading
? const LoadingPage()
:
// : Scaffold(
// body: Container(
// color: Colors.black,
// child: Stack(
// children: [
// Positioned.fill(
// child: Opacity(
// opacity: 0.4,
// child: Image.asset(
// "images/main_back_5.jpg",
// fit: BoxFit.cover,
// ),
// )),
// Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.stretch,
// children: [
// Center(
// child: CircleAvatar(
// backgroundColor: Colors.cyan,
// radius: 80.0,
// child: CircleAvatar(
// radius: 70.0,
// child: ClipOval(
// child: Image.asset("images/logo1.png")),
// ),
// ),
// ),
// const SizedBox(
// height: 50,
// ),
// 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: () async {
// setState(() {
// isLoading = true;
// });
// await _runCrawlers();
// await _showDialog(context);
// },
// child: Container(
// padding: const EdgeInsets.all(20),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// color: Colors.blueAccent,
// border: Border.all(
// color: Colors.transparent, width: 4)),
// child: const Text(
// "Crawl",
// textAlign: TextAlign.center,
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 20,
// color: Colors.black),
// ),
// ),
// ),
// ),
// ),
// ),
// 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: () async {
// setState(() {
// isLoading = true;
// });
// await _preprocessData();
// await _showDialog(context);
// },
// child: Container(
// padding: const EdgeInsets.all(20),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// color: Colors.blueGrey,
// border: Border.all(
// color: Colors.transparent, width: 4)),
// child: const Text(
// "Pre-Process",
// textAlign: TextAlign.center,
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 20,
// color: Colors.black),
// ),
// ),
// ),
// ),
// ),
// ),
// 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: () async {
// setState(() {
// isLoading = true;
// });
// await _buildOntology();
// await _showDialog(context);
// },
// child: Container(
// padding: const EdgeInsets.all(20),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// color: Colors.blueAccent,
// border: Border.all(
// color: Colors.transparent, width: 4)),
// child: const Text(
// "Build Ontology",
// textAlign: TextAlign.center,
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 20,
// color: Colors.black),
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// )
// ],
// ),
// ),
// );
Scaffold(
drawer: const SideDrawer(),
body: Container(
color: Colors.blue[100],
alignment: Alignment.center,
child: Column(
children: [
ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(60),
bottomRight: Radius.circular(60),
),
child: Stack(
children: [
Container(
height: 350,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
'images/symbols/Admin1.jpg',
),
fit: BoxFit.cover)),
),
Positioned.fill(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Colors.black.withOpacity(0.6),
Colors.transparent
])),
)),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
"CANIS CARE",
style: GoogleFonts.bungeeShade(
textStyle: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.cyan),
),
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
"Administrator",
style: GoogleFonts.oswald(
textStyle: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: Colors.cyanAccent),
),
),
)
],
),
]))
],
),
),
const SizedBox(
height: 20,
),
Expanded(
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(60),
topRight: Radius.circular(60),
),
child: Stack(children: [
Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
'images/symbols/Admin2.jpg',
),
fit: BoxFit.cover,
opacity: 0.2)),
child: GridView.extent(
padding: const EdgeInsets.all(16),
crossAxisSpacing: 5,
mainAxisSpacing: 5,
maxCrossAxisExtent: 280.0,
children: [
GestureDetector(
onTap: () async {
setState(() {
isLoading = true;
});
await _runCrawlers();
await _showDialog(context,
"Information Extracted Successfully!");
},
child: Container(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10),
child: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: Container(
decoration: BoxDecoration(
color: Colors.blueGrey.withOpacity(0.6)),
child: Column(
children: [
Image.asset(
"images/symbols/extract5.png",
fit: BoxFit.cover,
width: 100,
height: 100,
),
const SizedBox(
height: 10,
),
const Text(
"Extract Data",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
)
],
),
),
),
),
),
GestureDetector(
onTap: () async {
setState(() {
isLoading = true;
});
await _preprocessData();
await _showDialog(
context, "Data Processed Successfully!");
},
child: Container(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10),
child: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: Container(
decoration: BoxDecoration(
color: Colors.blueGrey.withOpacity(0.6)),
child: Column(
children: [
const SizedBox(
height: 20,
),
Image.asset(
"images/symbols/preprocess.png",
fit: BoxFit.cover,
width: 80,
height: 80,
),
const SizedBox(
height: 10,
),
const Text(
"Preprocess Data",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
)
],
),
),
),
),
),
GestureDetector(
onTap: () async {
setState(() {
isLoading = true;
});
await _buildOntology();
await _showDialog(context,
"Ontology Constructed Successfully!");
},
child: Container(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10),
child: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: Container(
decoration: BoxDecoration(
color: Colors.blueGrey.withOpacity(0.6)),
child: Column(
children: [
SizedBox(
height: 20,
),
Image.asset(
"images/symbols/onto2.png",
fit: BoxFit.cover,
width: 80,
height: 80,
),
const SizedBox(
height: 10,
),
const Text(
"Build Ontology",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
)
],
),
),
),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
const DiseaseIntelligence()));
},
child: Container(
padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10),
child: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: Container(
decoration: BoxDecoration(
color: Colors.blueGrey.withOpacity(0.6)),
child: Column(
children: [
SizedBox(
height: 20,
),
Image.asset(
"images/symbols/userm.png",
fit: BoxFit.cover,
width: 80,
height: 80,
),
const SizedBox(
height: 10,
),
const Text(
"View Information",
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
)
],
),
),
),
),
),
],
),
),
]),
))
],
),
),
);
}
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),
),
),
),
);
}
import 'dart:convert';
import 'package:badges/badges.dart';
import 'package:canis_care/screens/disease_individual_screen.dart'; import 'package:canis_care/screens/disease_individual_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:http/http.dart';
import 'package:localstorage/localstorage.dart';
import '../data/disease_sub_topics.dart'; import '../data/disease_sub_topics.dart';
import '../models/category.dart'; import '../models/category.dart';
import '../models/disease.dart'; import '../models/disease.dart';
class DiseaseDetails extends StatelessWidget { class DiseaseDetails extends StatefulWidget {
final Disease disease; final Disease disease;
DiseaseDetails({Key? key, required this.disease}) : super(key: key); const DiseaseDetails({Key? key, required this.disease}) : super(key: key);
@override
State<DiseaseDetails> createState() => _DiseaseDetailsState();
}
class _DiseaseDetailsState extends State<DiseaseDetails> {
Client client = http.Client();
final List<Category> categories = Utils.getMockedCategories(); final List<Category> categories = Utils.getMockedCategories();
String url = "https://canis-care-auto.herokuapp.com";
// String url = "http://192.168.1.101:8000";
String? status;
final LocalStorage storage = LocalStorage('local_storage_app');
String? infoRole, infoEmail;
@override
void initState() {
getItemFromLocalStorage();
super.initState();
}
void getItemFromLocalStorage() {
Map<String, dynamic> info = json.decode(storage.getItem('info'));
infoEmail = info['email'];
infoRole = info['role'];
}
_updateStatus(disease, stat, cat) async {
String updateUri = "$url/disease/sub/status/$disease/$stat/$cat";
json.decode(
utf8.decode((await client.get(Uri.parse(updateUri))).bodyBytes));
}
_retrieveApprovedStatus(disease, subtopic) async {
String getStatusUri = "$url/disease/sub/get/status/$disease/$subtopic";
List responses = json.decode(
utf8.decode((await client.get(Uri.parse(getStatusUri))).bodyBytes));
if (responses.isNotEmpty) {
setState(() {
status = responses[0];
});
} else {
setState(() {
status = "false";
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -17,30 +70,35 @@ class DiseaseDetails extends StatelessWidget { ...@@ -17,30 +70,35 @@ class DiseaseDetails extends StatelessWidget {
appBar: AppBar(title: const Text('Disease Information')), appBar: AppBar(title: const Text('Disease Information')),
body: Container( body: Container(
color: Colors.blue[100], color: Colors.blue[100],
padding: EdgeInsets.only(bottom: 30), padding: const EdgeInsets.only(bottom: 30),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
const Padding( const Padding(
padding: EdgeInsets.only(top: 10, bottom: 10), padding: EdgeInsets.only(top: 10, bottom: 10),
// child: Text(
// disease.diseaseName,
// textAlign: TextAlign.center,
// ),
), ),
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: categories.length, itemCount: categories.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () async {
Navigator.of(context).push( await _retrieveApprovedStatus(
MaterialPageRoute( widget.disease.diseaseName,
builder: (context) => DiseaseIndividual( categories[index].topic);
disease: disease, status == "true" && infoRole == "User"
category: categories[index], ? Navigator.of(context).push(
)), MaterialPageRoute(
); builder: (context) => DiseaseIndividual(
disease: widget.disease,
category: categories[index],
)),
)
: _showTestDialog(
context,
widget.disease.diseaseName,
categories[index].topic,
categories[index]);
}, },
child: Container( child: Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
...@@ -101,7 +159,7 @@ class DiseaseDetails extends StatelessWidget { ...@@ -101,7 +159,7 @@ class DiseaseDetails extends StatelessWidget {
width: 10, width: 10,
), ),
Text( Text(
"${disease.diseaseName} ${categories[index].topic}", "${widget.disease.diseaseName} ${categories[index].topic}",
style: const TextStyle( style: const TextStyle(
fontSize: 20, color: Colors.white), fontSize: 20, color: Colors.white),
) )
...@@ -119,4 +177,290 @@ class DiseaseDetails extends StatelessWidget { ...@@ -119,4 +177,290 @@ class DiseaseDetails extends StatelessWidget {
), ),
); );
} }
void _showTestDialog(
BuildContext context,
String diseaseName,
String category,
Category categori,
) {
showDialog(
context: context,
barrierDismissible: false,
//context: _scaffoldKey.currentContext,
builder: (context) {
return StatefulBuilder(builder: (context, setState) {
return AlertDialog(
backgroundColor: Colors.blue[100],
elevation: 50.0,
contentPadding: const EdgeInsets.only(left: 25, right: 25),
title: infoRole == "Doctor"
? Center(
child: Badge(
shape: BadgeShape.square,
badgeColor:
status == "false" ? Colors.red : Colors.green,
animationDuration: const Duration(milliseconds: 300),
animationType: BadgeAnimationType.scale,
borderRadius: BorderRadius.circular(5),
position: BadgePosition.topEnd(top: -12, end: -20),
padding: const EdgeInsets.all(2),
badgeContent: status == "false"
? const Text(
'Not Accepted',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.bold),
)
: const Text(
'Accepted',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.bold),
),
child: Container(
margin: const EdgeInsets.only(top: 5),
child: Text(
"$diseaseName $category",
style: TextStyle(
color: Colors.grey[600], fontSize: 22),
),
),
),
)
: Center(
child: Badge(
shape: BadgeShape.square,
badgeColor: status == "false"
? Colors.yellowAccent
: Colors.green,
animationDuration: const Duration(milliseconds: 300),
animationType: BadgeAnimationType.scale,
borderRadius: BorderRadius.circular(5),
position: BadgePosition.topEnd(top: -10, end: -20),
padding: const EdgeInsets.all(2),
badgeContent: status == "false"
? const Text(
'Pending',
style: TextStyle(
color: Colors.black,
fontSize: 13,
fontWeight: FontWeight.bold),
)
: const Text(
'Verified',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.bold),
),
child: Container(
margin: const EdgeInsets.only(top: 5),
child: Text(
"$diseaseName $category",
style: TextStyle(
color: Colors.grey[600], fontSize: 22),
),
),
),
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))),
content: status == "false" && infoRole == "User"
? SizedBox(
height: 300,
width: 600,
child: Column(children: <Widget>[
Container(
margin: const EdgeInsets.only(top: 50),
child: const Text(
"Information is in verifying process!",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold))),
Container(
margin: const EdgeInsets.only(top: 50),
child: const Icon(Icons.pending_actions, size: 100.0),
)
]))
: SizedBox(
height: 300,
width: 600,
child: Column(children: <Widget>[
Container(
margin: const EdgeInsets.only(top: 50),
child: const Text(
"Please go through the information and give your evaluation!",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold))),
Container(
margin: const EdgeInsets.only(
left: 30.0, right: 30.0, top: 40.0),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
width: MediaQuery.of(context).size.width * 0.60,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.cyan,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor:
Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
DiseaseIndividual(
disease: widget.disease,
category: categori,
)),
);
},
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(50),
color: Colors.transparent,
border: Border.all(
color: Colors.black, width: 2)),
child: const Text(
"View Information",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black),
),
),
),
),
),
),
),
)
])),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 5.0),
child: infoRole == "Doctor"
? Container(
width: MediaQuery.of(context).size.width * 0.25,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: status == "false"
? Colors.green
: Colors.red,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor:
Colors.cyan.withOpacity(0.2),
onTap: () {
if (status == "false") {
_updateStatus(
diseaseName, "true", category);
setState(() {
status = "true";
});
} else {
_updateStatus(
diseaseName, "false", category);
setState(() {
status = "false";
});
}
},
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: status == "false"
? const Text(
"Approve",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
)
: const Text(
"Reject",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
),
),
)
: SizedBox(
width: MediaQuery.of(context).size.width * 0.1),
),
Padding(
padding: infoRole == "Doctor"
? const EdgeInsets.only(right: 10.0)
: const EdgeInsets.only(right: 40.0),
child: Container(
width: MediaQuery.of(context).size.width * 0.20,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.redAccent,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor: Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.of(context).pop();
},
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(
"Close",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.02,
),
],
)
],
);
});
});
}
} }
import 'dart:io'; // import 'dart:convert';
// import 'dart:io';
import 'package:flutter/material.dart'; // import 'package:basic_utils/basic_utils.dart';
import 'package:flutter/services.dart'; // import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:image_picker/image_picker.dart'; // import 'package:google_fonts/google_fonts.dart';
import 'package:tflite/tflite.dart'; // import 'package:http/http.dart' as http;
// import 'package:http/http.dart';
class DiseaseIdentification extends StatefulWidget { //
const DiseaseIdentification({Key? key}) : super(key: key); // import 'package:flutter/material.dart';
// import 'package:flutter/services.dart';
@override // import 'package:image_picker/image_picker.dart';
State<DiseaseIdentification> createState() => _DiseaseIdentificationState(); // import 'package:tflite/tflite.dart';
} //
// import '../models/disease.dart';
class _DiseaseIdentificationState extends State<DiseaseIdentification> { // import '../models/disease_description_point.dart';
// import 'disease_details_screen.dart';
late File pickedImage; //
bool _busy = false; // class DiseaseIdentification extends StatefulWidget {
late List _recognitions; // const DiseaseIdentification({Key? key}) : super(key: key);
bool isImageLoaded = false; //
late List resultList; // @override
String _confidence = ""; // State<DiseaseIdentification> createState() => _DiseaseIdentificationState();
String _name = ""; // }
String numbers = ""; //
// class _DiseaseIdentificationState extends State<DiseaseIdentification> {
getImageFromGallery() async { //
var image = // late File pickedImage;
await ImagePicker.platform.getImage(source: ImageSource.gallery); // bool _busy = false;
print("11111:"); // late List _recognitions;
setState(() { // bool isImageLoaded = false;
_busy = true; // late List resultList;
}); // String _confidence = "";
// String _name = "";
pickedImage = File(image!.path); // String numbers = "";
isImageLoaded = true; // String capitalized = " ";
predictImage(pickedImage); // late Disease disease;
} //
// Client client = http.Client();
getImageFromCamera() async { //
var image = await ImagePicker.platform.getImage(source: ImageSource.camera); // List<String> diseases = [];
setState(() { // List<Disease> diseaseList = [];
_busy = true; // List<String> diseaseDescriptions = [];
}); // List<Disease> allDiseaseList = [];
// List<DiseaseDescriptionPoint> diseaseDescriptionsList = [];
pickedImage = File(image!.path); // String url = "https://canis-care-mobile.herokuapp.com";
isImageLoaded = true; // String dis = " ";
predictImage(pickedImage); //
} // getImageFromGallery() async {
// var image =
void predictImage(File image) async { // await ImagePicker.platform.getImage(source: ImageSource.gallery);
await applyModelOnImage(image); // print("11111:");
} // setState(() {
// _busy = true;
loadDetectionModel() async { // });
try { //
String? res = await Tflite.loadModel( // pickedImage = File(image!.path);
model: "assets/newdog1model1.tflite", // isImageLoaded = true;
labels: "assets/labels.txt", // predictImage(pickedImage);
numThreads: 1, // }
// defaults to 1 //
isAsset: true, // getImageFromCamera() async {
// defaults to true, set to false to load resources outside assets // var image = await ImagePicker.platform.getImage(source: ImageSource.camera);
useGpuDelegate: // setState(() {
false // defaults to false, set to true to use GPU delegate // _busy = true;
); // });
print("Model Result : $res"); //
} on PlatformException { // pickedImage = File(image!.path);
print('Failed to load model.'); // isImageLoaded = true;
} // predictImage(pickedImage);
} // }
//
applyModelOnImage(File image) async { // void predictImage(File image) async {
int startTime = new DateTime.now().millisecondsSinceEpoch; // await applyModelOnImage(image);
// }
var recognitions = await Tflite.runModelOnImage( //
path: image.path, // loadDetectionModel() async {
// required // try {
imageMean: 0.0, // String? res = await Tflite.loadModel(
// defaults to 117.0 // model: "assets/newdog1model1.tflite",
imageStd: 255.0, // labels: "assets/labels.txt",
// defaults to 1.0 // numThreads: 1,
numResults: 2, // // defaults to 1
// defaults to 5 // isAsset: true,
threshold: 0.2, // // defaults to true, set to false to load resources outside assets
// defaults to 0.1 // useGpuDelegate:
asynch: true // defaults to true // false // defaults to false, set to true to use GPU delegate
); // );
setState(() { // print("Model Result : $res");
_recognitions = recognitions!; // } on PlatformException {
print("res result : $_recognitions"); // print('Failed to load model.');
String str = _recognitions[0]["label"]; // }
_name = str.substring(2); // }
print("Detected Disease: $_name"); //
_confidence = _recognitions != null // applyModelOnImage(File image) async {
? (_recognitions[0]["confidence"] * 100.0) // int startTime = new DateTime.now().millisecondsSinceEpoch;
.toString() //
.substring(0, 2) + // var recognitions = await Tflite.runModelOnImage(
"%" // path: image.path,
: ""; // // required
print("Confidence: $_confidence"); // imageMean: 0.0,
}); // // defaults to 117.0
int endTime = new DateTime.now().millisecondsSinceEpoch; // imageStd: 255.0,
print("Inference took ${endTime - startTime}ms"); // setState(() { // // defaults to 1.0
} // numResults: 2,
// // defaults to 5
@override // threshold: 0.2,
void initState() { // // defaults to 0.1
super.initState(); // asynch: true // defaults to true
loadDetectionModel(); // );
} // setState(() {
// _recognitions = recognitions!;
void objectRecocnition() async {} // print("res result : $_recognitions");
// String str = _recognitions[0]["label"];
@override // _name = str.substring(2);
Widget build(BuildContext context) { //
return Scaffold( // print("Detected Disease: $_name");
appBar: AppBar(title: const Text("Skin Diseases Identification")), // dis = _name.toLowerCase();
body: SingleChildScrollView( // capitalized = StringUtils.capitalize(dis);
child: Column( // print(capitalized);
crossAxisAlignment: CrossAxisAlignment.start, // _confidence = _recognitions != null
children: [ // ? (_recognitions[0]["confidence"] * 100.0)
Padding( // .toString()
padding: const EdgeInsets.only( // .substring(0, 2) +
left: 20, // "%"
right: 20, // : "";
top: 35, // print("Confidence: $_confidence");
), // });
child: Column( // _retrieveDiseases(capitalized);
crossAxisAlignment: CrossAxisAlignment.start, // int endTime = new DateTime.now().millisecondsSinceEpoch;
children: [ // print("Inference took ${endTime - startTime}ms"); // setState(() {
Row( // }
mainAxisAlignment: MainAxisAlignment.spaceBetween, //
children: [ // _retrieveDiseaseDescription(disease) async {
SizedBox(height: 350), // diseaseDescriptions = [];
isImageLoaded // String retrieveUri = "${"$url/disease/" + disease}/";
? Center( // print(retrieveUri);
child: Container( // List responses = json.decode(
height: 350, // utf8.decode((await client.get(Uri.parse(retrieveUri))).bodyBytes));
width: 350, // print(responses);
decoration: BoxDecoration( // for (var element in responses) {
image: DecorationImage( // var encoded = utf8.encode(element);
image: FileImage( // var decoded = utf8.decode(encoded);
File(pickedImage.path)), // if (decoded.startsWith(RegExp(r'[A-Z][a-z]'))) {
fit: BoxFit.contain)), // diseaseDescriptions.add(decoded);
), // } else {
) // var formatted = decoded.substring(1);
: Container(), // diseaseDescriptions.add(formatted);
]), // }
Padding( // }
padding: const EdgeInsets.only( // var newDiseases = List<String>.from(diseaseDescriptions);
left: 20, // diseaseDescriptionsList = List.generate(
right: 20, // diseaseDescriptions.length,
top: 100, // (index) => DiseaseDescriptionPoint(
), // descriptionPoint: diseaseDescriptions[index]));
child: Column( // setState(() {});
crossAxisAlignment: CrossAxisAlignment.center, // }
children: [ //
Text( // _retrieveDiseases(nme) {
"Identified Disease: $_name \n Confidence: $_confidence" // disease = Disease(diseaseName: nme);
// style: TextStyle( // // diseases = [];
// color: Color(0xFFF05A22), // // diseases.add(nme);
// fontFamily: 'Montserrat', // // print(diseases);
// fontSize: 16, // // allDiseaseList = List.generate(
// fontWeight: FontWeight.w600, // // diseases.length, (index) => Disease(diseaseName: diseases[index]));
// letterSpacing: 1, // // diseaseList = List.from(allDiseaseList);
// ), // // print(diseaseList[0]);
), // // setState(() {});
Row( // }
mainAxisAlignment: //
MainAxisAlignment.spaceBetween, // @override
children: [ // void initState() {
SizedBox( // super.initState();
width: 331.4, // loadDetectionModel();
height: 50.0, // }
child: GestureDetector( //
onTap: () { // void objectRecocnition() async {}
getImageFromGallery(); //
}, // @override
child: Container( // Widget build(BuildContext context) {
// padding: EdgeInsets.fromLTRB(20, 30, 10, 15), // return Scaffold(
decoration: BoxDecoration( // appBar: AppBar(title: const Text("Skin Diseases Identification")),
border: Border.all( // body: SingleChildScrollView(
// color: const Color(0xFFF05A22), // child: Column(
style: BorderStyle.none, // crossAxisAlignment: CrossAxisAlignment.start,
width: 1.0, // children: [
), // Padding(
color: Colors.blue[200], // padding: const EdgeInsets.only(
borderRadius: // left: 20,
BorderRadius.circular(10.0), // right: 20,
), // top: 35,
child: Row( // ),
mainAxisAlignment: // child: Column(
MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.start,
children: const <Widget>[ // children: [
Center( // Row(
child: Text( // mainAxisAlignment: MainAxisAlignment.spaceBetween,
"Launch Gallery", // children: [
style: TextStyle( // SizedBox(height: 350),
color: Color(0xFFFFFFFF), // isImageLoaded
fontFamily: 'Montserrat', // ? Center(
fontSize: 16, // child: Container(
fontWeight: FontWeight.w600, // height: 350,
letterSpacing: 1, // width: 350,
), // decoration: BoxDecoration(
), // image: DecorationImage(
) // image: FileImage(
], // File(pickedImage.path)),
), // fit: BoxFit.contain)),
), // ),
), // )
), // : Container(),
]), // ]),
Padding( // Padding(
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
// left: 20, // left: 20,
// right: 20, // right: 20,
top: 30, // top: 50,
), // bottom: 20
child: Column( // ),
crossAxisAlignment: CrossAxisAlignment.center, // child: Column(
children: [ // crossAxisAlignment: CrossAxisAlignment.center,
Row( // children: [
mainAxisAlignment: // Text(
MainAxisAlignment.spaceBetween, // "Identified Disease: $_name \n\n Confidence: $_confidence \n\n"
children: [ // // style: TextStyle(
SizedBox( // // color: Color(0xFFF05A22),
width: 331.4, // // fontFamily: 'Montserrat',
height: 50.0, // // fontSize: 16,
child: GestureDetector( // // fontWeight: FontWeight.w600,
onTap: () { // // letterSpacing: 1,
getImageFromCamera(); // // ),
}, // ),
child: Container( // Row(
// padding: EdgeInsets.fromLTRB(20, 30, 10, 15), // mainAxisAlignment:
decoration: BoxDecoration( // MainAxisAlignment.spaceBetween,
border: Border.all( // children: [
// color: const Color(0xFFF05A22), // SizedBox(
style: BorderStyle.none, // width: 331.4,
width: 1.0, // height: 50.0,
), // child: GestureDetector(
color: Colors.blue[200], // onTap: () {
borderRadius: // getImageFromGallery();
BorderRadius.circular( // },
10.0), // child: Container(
), // // padding: EdgeInsets.fromLTRB(20, 30, 10, 15),
child: Row( // decoration: BoxDecoration(
mainAxisAlignment: // border: Border.all(
MainAxisAlignment.center, // // color: const Color(0xFFF05A22),
children: const <Widget>[ // style: BorderStyle.none,
Center( // width: 1.0,
child: Text( // ),
"Take a Picture ", // color: Colors.blue[200],
style: TextStyle( // borderRadius:
color: // BorderRadius.circular(10.0),
Color(0xFFFFFFFF), // ),
fontFamily: // child: Row(
'Montserrat', // mainAxisAlignment:
fontSize: 16, // MainAxisAlignment.center,
fontWeight: // children: const <Widget>[
FontWeight.w600, // Center(
letterSpacing: 1, // child: Text(
), // "Launch Gallery",
), // style: TextStyle(
) // color: Color(0xFFFFFFFF),
], // fontFamily: 'Montserrat',
), // fontSize: 16,
), // fontWeight: FontWeight.w600,
), // letterSpacing: 1,
), // ),
]), // ),
], // )
), // ],
), // ),
], // ),
)), // ),
], // ),
)), // ]),
], // Padding(
), // padding: const EdgeInsets.only(
)); // // left: 20,
} // // right: 20,
} // top: 30,
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// SizedBox(
// width: 331.4,
// height: 50.0,
// child: GestureDetector(
// onTap: () {
// getImageFromCamera();
// },
// child: Container(
// // padding: EdgeInsets.fromLTRB(20, 30, 10, 15),
// decoration: BoxDecoration(
// border: Border.all(
// // color: const Color(0xFFF05A22),
// style: BorderStyle.none,
// width: 1.0,
// ),
// color: Colors.blue[200],
// borderRadius:
// BorderRadius.circular(
// 10.0),
// ),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: const <Widget>[
// Center(
// child: Text(
// "Take a Picture ",
// style: TextStyle(
// color:
// Color(0xFFFFFFFF),
// fontFamily:
// 'Montserrat',
// fontSize: 16,
// fontWeight:
// FontWeight.w600,
// letterSpacing: 1,
// ),
// ),
// )
// ],
// ),
// ),
// ),
// ),
// ]),
// ],
// ),
// ),
// Padding(
// padding: const EdgeInsets.only(
// // left: 20,
// // right: 20,
// top: 30,
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// SizedBox(
// width: 331.4,
// height: 50.0,
// child: GestureDetector(
// onTap: () async {
// await _retrieveDiseaseDescription(
// _name);
// _showTestDialog(
// context,
// _name,
// diseaseDescriptionsList,
// disease,
// );
//
// },
// child: Container(
// // padding: EdgeInsets.fromLTRB(20, 30, 10, 15),
// decoration: BoxDecoration(
// border: Border.all(
// // color: const Color(0xFFF05A22),
// style: BorderStyle.none,
// width: 1.0,
// ),
// color: Colors.blue[200],
// borderRadius:
// BorderRadius.circular(
// 10.0),
// ),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: const <Widget>[
// Center(
// child: Text(
// "Get More Information ",
// style: TextStyle(
// color:
// Color(0xFFFFFFFF),
// fontFamily:
// 'Montserrat',
// fontSize: 16,
// fontWeight:
// FontWeight.w600,
// letterSpacing: 1,
// ),
// ),
// )
// ],
// ),
// ),
// ),
// ),
// ]),
// ],
// ),
// ),
// ],
// )),
// ],
// )),
// ],
// ),
// ));
// }
//
// void _showTestDialog(
// BuildContext context,
// String diseaseName,
// List<DiseaseDescriptionPoint> diseaseDescriptionsList, Disease disease) {
// showDialog(
// context: context,
// barrierDismissible: false,
// //context: _scaffoldKey.currentContext,
// builder: (context) {
// return AlertDialog(
// backgroundColor: Colors.blue[100],
// elevation: 50.0,
// contentPadding: EdgeInsets.only(left: 25, right: 25),
// title: Center(child: Text("About " + diseaseName)),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.all(Radius.circular(20.0))),
// content: Container(
// height: 440,
// width: 600,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.stretch,
// children: <Widget>[
// Expanded(
// child: Container(
// margin: EdgeInsets.only(top: 10.0),
// child: SizedBox(
// height: 200,
// child: RawScrollbar(
// thumbColor: Colors.redAccent,
// radius: Radius.circular(20),
// thickness: 10,
// child: ListView.builder(
// itemCount: diseaseDescriptionsList.length,
// itemBuilder: (BuildContext context, int index) {
// return AnimationConfiguration.staggeredGrid(
// columnCount: diseaseDescriptionsList.length,
// position: index,
// child: SlideAnimation(
// child: FadeInAnimation(
// child: Container(
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(16),
// color: Colors.blue,
// ),
// margin: EdgeInsets.only(top: 5.0),
// child: Card(
// elevation: 5.0,
// child: ListTile(
// title: Text(
// diseaseDescriptionsList[index]
// .descriptionPoint,
// style: GoogleFonts.lato(
// textStyle: const TextStyle(
// fontSize: 18,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
// ),
// ),
// ),
// ),
// ),
// );
// }),
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// actions: <Widget>[
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Container(
// width: MediaQuery
// .of(context)
// .size
// .width * 0.20,
// margin: EdgeInsets.only(
// left: MediaQuery
// .of(context)
// .size
// .width * 0.1),
// 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) => DiseaseDetails(
// disease: 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(
// "More",
// textAlign: TextAlign.center,
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 14,
// color: Colors.black),
// ),
// ),
// ),
// ),
// ),
// // child: ElevatedButton(
// // child: Text(
// // 'More...',
// // style: TextStyle(color: Colors.white),
// // ),
// // // color: Color(0xFF32CD32),
// // // shape: RoundedRectangleBorder(
// // // borderRadius: BorderRadius.circular(30.0),
// // // ),
// // onPressed: () {
// // Navigator.of(context).push(
// // MaterialPageRoute(
// // builder: (context) => DiseaseDetails(
// // disease: diseaseList,
// // )),
// // );
// // },
// // ),
// ),
// SizedBox(
// width: MediaQuery
// .of(context)
// .size
// .width * 0.1,
// ),
// Padding(
// padding: const EdgeInsets.only(right: 40.0),
// child: Container(
// width: MediaQuery
// .of(context)
// .size
// .width * 0.20,
// child: ClipRRect(
// borderRadius: BorderRadius.circular(50),
// child: Material(
// color: Colors.redAccent,
// child: InkWell(
// splashColor: Colors.cyan.withOpacity(0.2),
// highlightColor: Colors.cyan.withOpacity(0.2),
// onTap: () {
// Navigator.of(context).pop();
// },
// 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(
// "Close",
// textAlign: TextAlign.center,
// style: TextStyle(
// fontWeight: FontWeight.bold,
// fontSize: 14,
// color: Colors.black),
// ),
// ),
// ),
// ),
// ),
// // child: ElevatedButton(
// // child: new Text(
// // 'Close',
// // style: TextStyle(color: Colors.white),
// // ),
// // // color: Color(0xFFFF0000),
// // // shape: new RoundedRectangleBorder(
// // // borderRadius: new BorderRadius.circular(30.0),
// // // ),
// // onPressed: () {
// // Navigator.of(context).pop();
// // },
// // ),
// ),
// ),
// SizedBox(
// height: MediaQuery
// .of(context)
// .size
// .height * 0.02,
// ),
// ],
// )
// ],
// );
// });
// }
// }
import 'dart:convert'; import 'dart:convert';
import 'package:canis_care/screens/web_view_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
...@@ -33,6 +34,9 @@ class _DiseaseIndividualTopicInfoState ...@@ -33,6 +34,9 @@ class _DiseaseIndividualTopicInfoState
List<DiseaseIndividualSubTopicInfo> subTopicInfoList = []; List<DiseaseIndividualSubTopicInfo> subTopicInfoList = [];
int pageIndex = 0; int pageIndex = 0;
PageController? _pageController; PageController? _pageController;
late String link;
String url = "https://canis-care-auto.herokuapp.com";
// String url = "http://192.168.1.101:8000";
@override @override
void dispose() { void dispose() {
...@@ -42,32 +46,39 @@ class _DiseaseIndividualTopicInfoState ...@@ -42,32 +46,39 @@ class _DiseaseIndividualTopicInfoState
@override @override
void initState() { void initState() {
_retrieveSeeAlsoLink();
_retrieveSubTopicsDetails(); _retrieveSubTopicsDetails();
super.initState(); super.initState();
_pageController = PageController(); _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 { _retrieveSubTopicsDetails() async {
subTopicsInfo = []; subTopicsInfo = [];
String retrieveUri = "http://192.168.1.102:8000/disease/" + String retrieveUri =
widget.disease.diseaseName + "$url/disease/${widget.disease.diseaseName}/${widget.category.topic}/${widget.diseaseIndividualTopic.individualTopic}/";
"/" +
widget.category.topic +
"/" +
widget.diseaseIndividualTopic.individualTopic +
"/";
List responses = json.decode( List responses = json.decode(
utf8.decode((await client.get(Uri.parse(retrieveUri))).bodyBytes)); utf8.decode((await client.get(Uri.parse(retrieveUri))).bodyBytes));
for (var element in responses) { for (var element in responses) {
// String res = element.substring(element.indexOf('#'));
// String res2 = res.replaceAll("#", "");
var encoded = utf8.encode(element); var encoded = utf8.encode(element);
var decoded = utf8.decode(encoded); var decoded = utf8.decode(encoded);
var formatted = decoded.substring(1); if (decoded.startsWith(RegExp(r'[A-Z][a-z]'))) {
subTopicsInfo.add(formatted); subTopicsInfo.add(decoded);
} else {
var formatted = decoded.substring(1);
subTopicsInfo.add(formatted);
}
} }
// var newDiseases = List<String>.from(diseases);
subTopicInfoList = List.generate( subTopicInfoList = List.generate(
subTopicsInfo.length, subTopicsInfo.length,
(index) => DiseaseIndividualSubTopicInfo( (index) => DiseaseIndividualSubTopicInfo(
...@@ -141,13 +152,14 @@ class _DiseaseIndividualTopicInfoState ...@@ -141,13 +152,14 @@ class _DiseaseIndividualTopicInfoState
BorderRadius.circular(16), BorderRadius.circular(16),
color: Colors.blue, color: Colors.blue,
), ),
margin: EdgeInsets.only( margin: const EdgeInsets.only(
top: 5.0, bottom: 15), top: 5.0, bottom: 15),
child: Card( child: Card(
child: Container( child: Container(
margin: EdgeInsets.only( margin: const EdgeInsets.only(
bottom: 30), bottom: 30),
padding: EdgeInsets.all(5.0), padding:
const EdgeInsets.all(5.0),
child: Text( child: Text(
subTopicInfoList[index] subTopicInfoList[index]
.individualTopicInfo, .individualTopicInfo,
...@@ -169,27 +181,44 @@ class _DiseaseIndividualTopicInfoState ...@@ -169,27 +181,44 @@ class _DiseaseIndividualTopicInfoState
visible: index == subTopicInfoList.length - 1, visible: index == subTopicInfoList.length - 1,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 10), padding: const EdgeInsets.only(top: 10),
child: FlatButton( child: ClipRRect(
onPressed: () { borderRadius: BorderRadius.circular(50),
// Navigator.of(context).push( child: Material(
// MaterialPageRoute( color: Colors.greenAccent,
// builder: (context) => child: InkWell(
// DiseaseDetails( splashColor:
// disease: diseaseList[index], Colors.cyan.withOpacity(0.2),
// )), highlightColor:
// ); Colors.cyan.withOpacity(0.2),
}, onTap: () {
color: Colors.cyan, Navigator.of(context).push(
shape: RoundedRectangleBorder( MaterialPageRoute(
borderRadius: builder: (context) =>
BorderRadius.circular(50)), DiseaseWebView(
padding: const EdgeInsets.all(15), link: link,
child: const Text( disease:
"See Also", widget.disease,
style: TextStyle( )));
color: Colors.black, },
fontSize: 15, child: Container(
fontWeight: FontWeight.bold), 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 ...@@ -201,7 +230,7 @@ class _DiseaseIndividualTopicInfoState
), ),
RawScrollbar( RawScrollbar(
thumbColor: Colors.redAccent, thumbColor: Colors.redAccent,
radius: Radius.circular(20), radius: const Radius.circular(20),
thickness: 10, thickness: 10,
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
...@@ -219,7 +248,7 @@ class _DiseaseIndividualTopicInfoState ...@@ -219,7 +248,7 @@ class _DiseaseIndividualTopicInfoState
child: Container( child: Container(
width: 20, width: 20,
height: 20, height: 20,
margin: EdgeInsets.all(10), margin: const EdgeInsets.all(10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.cyan, color: Colors.cyan,
borderRadius: BorderRadius.circular(50), borderRadius: BorderRadius.circular(50),
...@@ -240,7 +269,7 @@ class _DiseaseIndividualTopicInfoState ...@@ -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'; ...@@ -6,6 +6,7 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:localstorage/localstorage.dart';
import '../models/category.dart'; import '../models/category.dart';
import '../models/disease.dart'; import '../models/disease.dart';
...@@ -30,20 +31,30 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> { ...@@ -30,20 +31,30 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
Client client = http.Client(); Client client = http.Client();
List<String> subTopics = []; List<String> subTopics = [];
List<DiseaseIndividualTopic> subTopicList = []; 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 @override
void initState() { void initState() {
_retrieveSubTopics(); _retrieveSubTopics();
getItemFromLocalStorage();
super.initState(); super.initState();
} }
void getItemFromLocalStorage() {
Map<String, dynamic> info = json.decode(storage.getItem('info'));
infoEmail = info['email'];
infoRole = info['role'];
}
_retrieveSubTopics() async { _retrieveSubTopics() async {
subTopics = []; subTopics = [];
String retrieveUri = "http://192.168.1.102:8000/disease/" + String retrieveUri =
widget.disease.diseaseName + "$url/disease/${widget.disease.diseaseName}/${widget.category.topic}/";
"/" +
widget.category.topic +
"/";
List responses = List responses =
json.decode((await client.get(Uri.parse(retrieveUri))).body); json.decode((await client.get(Uri.parse(retrieveUri))).body);
...@@ -52,7 +63,6 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> { ...@@ -52,7 +63,6 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
String res2 = res.replaceAll("#", ""); String res2 = res.replaceAll("#", "");
subTopics.add(res2); subTopics.add(res2);
} }
// var newDiseases = List<String>.from(diseases);
subTopicList = List.generate(subTopics.length, subTopicList = List.generate(subTopics.length,
(index) => DiseaseIndividualTopic(individualTopic: subTopics[index])); (index) => DiseaseIndividualTopic(individualTopic: subTopics[index]));
setState(() {}); setState(() {});
...@@ -63,7 +73,7 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> { ...@@ -63,7 +73,7 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: title:
Text(widget.disease.diseaseName + " " + widget.category.topic)), Text("${widget.disease.diseaseName} ${widget.category.topic}")),
body: Stack(children: [ body: Stack(children: [
Container( Container(
color: Colors.blue[100], color: Colors.blue[100],
...@@ -122,8 +132,8 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> { ...@@ -122,8 +132,8 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
Row( Row(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
children: [ children: const [
const SizedBox(width: 8), SizedBox(width: 8),
], ],
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
...@@ -137,49 +147,23 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> { ...@@ -137,49 +147,23 @@ class _DiseaseIndividualState extends State<DiseaseIndividual> {
width: 1, width: 1,
color: Colors.grey[200]!.withOpacity(0.7), color: Colors.grey[200]!.withOpacity(0.7),
), ),
/* RotatedBox( RotatedBox(
quarterTurns: 3, quarterTurns: 3,
child: Text( child: Text(
reminder!.isCompleted == 1 ? "NOTED" : "WAITING", status == "true" && infoRole == "User"
style: GoogleFonts.lato( ? "Verified"
textStyle: const TextStyle( : " ",
fontSize: 14, style: GoogleFonts.lato(
fontWeight: FontWeight.bold, textStyle: const TextStyle(
color: Colors.white), 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> { ...@@ -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:canis_care/screens/disease_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:localstorage/localstorage.dart';
import '../data/disease_sub_topics.dart'; import '../data/disease_sub_topics.dart';
import '../models/component.dart'; import '../models/component.dart';
...@@ -20,10 +23,10 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -20,10 +23,10 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
drawer: SideDrawer(), drawer: const SideDrawer(),
appBar: AppBar( appBar: AppBar(
title: Text( title: const Text(
"Home Page", "Disease Intelligence",
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),
...@@ -33,7 +36,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -33,7 +36,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
child: Column( child: Column(
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.only( borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(60), bottomLeft: Radius.circular(60),
bottomRight: Radius.circular(60), bottomRight: Radius.circular(60),
), ),
...@@ -44,7 +47,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -44,7 +47,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: AssetImage(
'images/symbols/dogvet2.jpg', 'images/symbols/dogs.jpg',
), ),
fit: BoxFit.cover)), fit: BoxFit.cover)),
), ),
...@@ -67,7 +70,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -67,7 +70,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(bottom: 10), padding: const EdgeInsets.only(bottom: 10),
child: Text( child: Text(
"CANIS CARE", "CANIS CARE",
style: GoogleFonts.bungeeShade( style: GoogleFonts.bungeeShade(
...@@ -83,12 +86,12 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -83,12 +86,12 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
], ],
), ),
), ),
SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Expanded( Expanded(
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(60), topLeft: Radius.circular(60),
topRight: Radius.circular(60), topRight: Radius.circular(60),
), ),
...@@ -110,7 +113,8 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -110,7 +113,8 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => DiseaseList( builder: (context) => DiseaseList(
title: 'All Diseases', title: componentCategories[index]
.categoryName,
)), )),
); );
}, },
...@@ -137,7 +141,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> { ...@@ -137,7 +141,7 @@ class _DiseaseIntelligenceState extends State<DiseaseIntelligence> {
Text( Text(
componentCategories[index] componentCategories[index]
.categoryName, .categoryName,
style: TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
......
import 'dart:convert'; import 'dart:convert';
import 'package:badges/badges.dart';
import 'package:canis_care/screens/signin_screen.dart';
import 'package:canis_care/screens/welcome_screen.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:localstorage/localstorage.dart';
import '../models/disease.dart'; import '../models/disease.dart';
import '../models/disease_description_point.dart'; import '../models/disease_description_point.dart';
...@@ -21,31 +26,73 @@ class DiseaseList extends StatefulWidget { ...@@ -21,31 +26,73 @@ class DiseaseList extends StatefulWidget {
} }
class _DiseaseListState extends State<DiseaseList> { class _DiseaseListState extends State<DiseaseList> {
final _auth = FirebaseAuth.instance;
Client client = http.Client(); Client client = http.Client();
List<String> diseases = []; List<String> diseases = [];
List<Disease> allDiseaseList = []; List<Disease> allDiseaseList = [];
List<String> diseaseDescriptions = []; List<String> diseaseDescriptions = [];
List<DiseaseDescriptionPoint> diseaseDescriptionsList = []; List<DiseaseDescriptionPoint> diseaseDescriptionsList = [];
String url = "https://canis-care-auto.herokuapp.com";
// String url = "http://192.168.1.101:8000";
String? status;
final LocalStorage storage = LocalStorage('local_storage_app');
String? infoRole, infoEmail;
late String retrieveUri;
@override @override
void initState() { void initState() {
_retrieveDiseases(); _retrieveDiseases();
getItemFromLocalStorage();
super.initState(); super.initState();
} }
void getItemFromLocalStorage() {
Map<String, dynamic> info = json.decode(storage.getItem('info'));
infoEmail = info['email'];
infoRole = info['role'];
}
signOut() async {
await _auth.signOut();
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => WelcomeScreen()),
(route) => false);
}
_updateStatus(disease, stat) async {
String updateUri = "$url/disease/status/$disease/$stat";
json.decode(
utf8.decode((await client.get(Uri.parse(updateUri))).bodyBytes));
}
_retrieveApprovedStatus(disease) async {
String getStatusUri = "$url/disease/get/status/" + disease;
List responses = json.decode(
utf8.decode((await client.get(Uri.parse(getStatusUri))).bodyBytes));
setState(() {
status = responses[0];
});
}
_retrieveDiseaseDescription(disease) async { _retrieveDiseaseDescription(disease) async {
diseaseDescriptions = []; diseaseDescriptions = [];
String retrieveUri = "http://192.168.1.102:8000/disease/" + disease + "/"; String retrieveDescriptionUri = "${"$url/disease/" + disease}/";
List responses = json.decode( List responses = json.decode(utf8.decode(
utf8.decode((await client.get(Uri.parse(retrieveUri))).bodyBytes)); (await client.get(Uri.parse(retrieveDescriptionUri))).bodyBytes));
for (var element in responses) { for (var element in responses) {
// String res = element.substring(element.indexOf('#'));
// String res2 = res.replaceAll("#", "");
var encoded = utf8.encode(element); var encoded = utf8.encode(element);
var decoded = utf8.decode(encoded); var decoded = utf8.decode(encoded);
var formatted = decoded.substring(1); if (decoded.startsWith(RegExp(r'[A-Z][a-z]'))) {
diseaseDescriptions.add(formatted); diseaseDescriptions.add(decoded);
} else {
var formatted = decoded.substring(1);
diseaseDescriptions.add(formatted);
}
} }
var newDiseases = List<String>.from(diseaseDescriptions); var newDiseases = List<String>.from(diseaseDescriptions);
diseaseDescriptionsList = List.generate( diseaseDescriptionsList = List.generate(
...@@ -57,16 +104,20 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -57,16 +104,20 @@ class _DiseaseListState extends State<DiseaseList> {
_retrieveDiseases() async { _retrieveDiseases() async {
diseases = []; diseases = [];
String retrieveUri = "https://canis-care-app.herokuapp.com/diseases/"; String cat =
widget.title.substring(0, widget.title.indexOf(' ')).toLowerCase();
String cat2 = widget.title.toString().split(' ')[0].toLowerCase();
if (cat2 == "all") {
retrieveUri = "$url/diseases/";
} else {
retrieveUri = "$url/diseasecategory/$cat2";
}
List responses = List responses =
json.decode((await client.get(Uri.parse(retrieveUri))).body); json.decode((await client.get(Uri.parse(retrieveUri))).body);
for (var element in responses) { for (var element in responses) {
// String res = element.substring(element.indexOf('#'));
// String res2 = res.replaceAll("#", "");
diseases.add(element); diseases.add(element);
} }
// var newDiseases = List<String>.from(diseases);
allDiseaseList = List.generate( allDiseaseList = List.generate(
diseases.length, (index) => Disease(diseaseName: diseases[index])); diseases.length, (index) => Disease(diseaseName: diseases[index]));
diseaseList = List.from(allDiseaseList); diseaseList = List.from(allDiseaseList);
...@@ -87,20 +138,65 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -87,20 +138,65 @@ class _DiseaseListState extends State<DiseaseList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
drawer: SideDrawer(), drawer: const SideDrawer(),
appBar: AppBar( appBar: AppBar(
title: Text(widget.title, textAlign: TextAlign.center), title: Text(widget.title, textAlign: TextAlign.center),
actions: [ actions: [
Container( // Container(
margin: const EdgeInsets.only(right: 40), // margin: const EdgeInsets.only(right: 15),
padding: EdgeInsets.all(10.0), // padding: const EdgeInsets.all(10.0),
child: ClipOval( // child: CircleAvatar(
child: Icon(Icons.ac_unit_rounded), // radius: 40.0,
), // child: ClipOval(
) // child: IconButton(
// color: Colors.red,
// onPressed: () {
// signOut();
// },
// icon: Icon(Icons.logout_outlined),
// ),
// ),
// ),
// )
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(width: 8),
Padding(
padding: const EdgeInsets.only(right: 30),
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.redAccent,
child: InkWell(
splashColor: Colors.redAccent.withOpacity(0.2),
highlightColor: Colors.redAccent.withOpacity(0.2),
onTap: () {
signOut();
},
child: Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Colors.transparent,
border: Border.all(color: Colors.red, width: 4)),
child: const Text(
"Logout",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
),
),
),
],
),
], ],
), ),
body: RefreshIndicator( body: RefreshIndicator(
onRefresh: () async { onRefresh: () async {
_retrieveDiseases(); _retrieveDiseases();
...@@ -109,19 +205,19 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -109,19 +205,19 @@ class _DiseaseListState extends State<DiseaseList> {
color: Colors.blue[100], color: Colors.blue[100],
child: Column(children: [ child: Column(children: [
Padding( Padding(
padding: EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: TextField( child: TextField(
onChanged: (value) => updateDiseaseList(value), onChanged: (value) => updateDiseaseList(value),
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
filled: true, filled: true,
fillColor: Color(0xff302390), fillColor: const Color(0xff302390),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
borderSide: BorderSide.none), borderSide: BorderSide.none),
hintText: "Search diseases...", hintText: "Search diseases...",
hintStyle: TextStyle(color: Colors.cyan), hintStyle: const TextStyle(color: Colors.cyan),
prefixIcon: Icon( prefixIcon: const Icon(
Icons.search, Icons.search,
color: Colors.white, color: Colors.white,
), ),
...@@ -133,7 +229,7 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -133,7 +229,7 @@ class _DiseaseListState extends State<DiseaseList> {
margin: const EdgeInsets.only(top: 0.0), margin: const EdgeInsets.only(top: 0.0),
child: RawScrollbar( child: RawScrollbar(
thumbColor: Colors.redAccent, thumbColor: Colors.redAccent,
radius: Radius.circular(10), radius: const Radius.circular(10),
thickness: 10, thickness: 10,
child: ListView.builder( child: ListView.builder(
itemCount: diseaseList.length, itemCount: diseaseList.length,
...@@ -190,52 +286,66 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -190,52 +286,66 @@ class _DiseaseListState extends State<DiseaseList> {
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.center,
children: [ children: [
Icon( const Icon(
Icons.remove_red_eye_outlined, Icons.remove_red_eye_outlined,
size: 22, size: 22,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
// Text(
// "Get More...",
// style: GoogleFonts.lato(
// textStyle: TextStyle(
// fontSize: 15,
// fontWeight: FontWeight.w800,
// ),
// ),
// ),
Padding( Padding(
padding: padding:
const EdgeInsets.all(0), const EdgeInsets.all(0),
child: FlatButton( child: ClipRRect(
onPressed: () { borderRadius:
Navigator.of(context) BorderRadius.circular(
.push( 50),
MaterialPageRoute( child: Material(
builder: (context) => color: Colors.cyan,
DiseaseDetails( child: InkWell(
disease: splashColor: Colors.cyan
diseaseList[ .withOpacity(0.2),
index], highlightColor: Colors
)), .cyan
); .withOpacity(0.2),
}, onTap: () {
color: Colors.cyan, Navigator.push(
shape: context,
RoundedRectangleBorder( MaterialPageRoute(
borderRadius: builder:
BorderRadius (context) =>
.circular( DiseaseDetails(
50)), disease:
padding: diseaseList[index],
const EdgeInsets.all(5), )));
child: const Text( },
"Get More", child: Container(
style: TextStyle( padding:
color: Colors.black, const EdgeInsets
fontSize: 15, .all(10),
fontWeight: decoration: BoxDecoration(
FontWeight.bold), borderRadius:
BorderRadius
.circular(
50),
color: Colors
.transparent,
border: Border.all(
color: Colors
.cyan,
width: 4)),
child: const Text(
"Get More",
textAlign: TextAlign
.center,
style: TextStyle(
fontWeight:
FontWeight
.bold,
fontSize: 14,
color: Colors
.black),
),
),
),
), ),
), ),
), ),
...@@ -253,22 +363,12 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -253,22 +363,12 @@ class _DiseaseListState extends State<DiseaseList> {
color: color:
Colors.grey[200]!.withOpacity(0.7), 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),
),
),
),*/
IconButton( IconButton(
onPressed: () async { onPressed: () async {
await _retrieveDiseaseDescription( await _retrieveDiseaseDescription(
diseaseList[index].diseaseName); diseaseList[index].diseaseName);
await _retrieveApprovedStatus(
diseaseList[index].diseaseName);
_showTestDialog( _showTestDialog(
context, context,
diseaseList[index].diseaseName, diseaseList[index].diseaseName,
...@@ -283,34 +383,6 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -283,34 +383,6 @@ class _DiseaseListState extends State<DiseaseList> {
]), ]),
), ),
), ),
// 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()),
// )
// }),
// ),
// ),
), ),
), ),
), ),
...@@ -324,14 +396,6 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -324,14 +396,6 @@ class _DiseaseListState extends State<DiseaseList> {
]), ]),
), ),
), ),
// floatingActionButton: FloatingActionButton(
// onPressed: () => Navigator.of(context).push(MaterialPageRoute(
// builder: (context) => CreatePage(
// client: client,
// ))),
// tooltip: 'Increment',
// child: const Icon(Icons.add),
// ), // This trailing comma makes auto-formatting nicer for build methods.
); );
} }
...@@ -345,126 +409,319 @@ class _DiseaseListState extends State<DiseaseList> { ...@@ -345,126 +409,319 @@ class _DiseaseListState extends State<DiseaseList> {
barrierDismissible: false, barrierDismissible: false,
//context: _scaffoldKey.currentContext, //context: _scaffoldKey.currentContext,
builder: (context) { builder: (context) {
return AlertDialog( return StatefulBuilder(builder: (context, setState) {
backgroundColor: Colors.blue[100], return AlertDialog(
elevation: 50.0, backgroundColor: Colors.blue[100],
contentPadding: EdgeInsets.only(left: 25, right: 25), elevation: 50.0,
title: Center(child: Text("About " + diseaseName)), contentPadding: const EdgeInsets.only(left: 25, right: 25),
shape: RoundedRectangleBorder( // title: Center(child: Text("About $diseaseName")),
borderRadius: BorderRadius.all(Radius.circular(20.0))), title: infoRole == "Doctor"
content: Container( ? Center(
height: 440, child: Badge(
width: 600, shape: BadgeShape.square,
child: Column( badgeColor:
crossAxisAlignment: CrossAxisAlignment.stretch, status == "false" ? Colors.red : Colors.green,
children: <Widget>[ animationDuration: const Duration(milliseconds: 300),
Expanded( animationType: BadgeAnimationType.scale,
child: Container( borderRadius: BorderRadius.circular(5),
margin: EdgeInsets.only(top: 10.0), position: BadgePosition.topEnd(top: -12, end: -20),
child: SizedBox( padding: const EdgeInsets.all(2),
height: 200, badgeContent: status == "false"
child: RawScrollbar( ? const Text(
thumbColor: Colors.redAccent, 'Not Accepted',
radius: Radius.circular(20), style: TextStyle(
thickness: 10, color: Colors.white,
child: ListView.builder( fontSize: 13,
itemCount: diseaseDescriptionsList.length, fontWeight: FontWeight.bold),
itemBuilder: (BuildContext context, int index) { )
return AnimationConfiguration.staggeredGrid( : const Text(
columnCount: diseaseDescriptionsList.length, 'Accepted',
position: index, style: TextStyle(
child: SlideAnimation( color: Colors.white,
child: FadeInAnimation( fontSize: 13,
child: Container( fontWeight: FontWeight.bold),
decoration: BoxDecoration( ),
borderRadius: child: Container(
BorderRadius.circular(16), margin: const EdgeInsets.only(top: 5),
color: Colors.blue, child: Text(
), diseaseName,
margin: EdgeInsets.only(top: 5.0), style: TextStyle(
child: Card( color: Colors.grey[600], fontSize: 26),
elevation: 5.0, ),
child: ListTile( ),
title: Text( ),
diseaseDescriptionsList[index] )
.descriptionPoint, : Center(
style: GoogleFonts.lato( child: Badge(
textStyle: const TextStyle( shape: BadgeShape.square,
fontSize: 18, badgeColor: status == "false"
fontWeight: FontWeight.bold, ? Colors.yellowAccent
: Colors.green,
animationDuration: const Duration(milliseconds: 300),
animationType: BadgeAnimationType.scale,
borderRadius: BorderRadius.circular(5),
position: BadgePosition.topEnd(top: -12, end: -20),
padding: const EdgeInsets.all(2),
badgeContent: status == "false"
? const Text(
'Pending',
style: TextStyle(
color: Colors.black,
fontSize: 13,
fontWeight: FontWeight.bold),
)
: const Text(
'Verified',
style: TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.bold),
),
child: Container(
margin: const EdgeInsets.only(top: 5),
child: Text(
diseaseName,
style: TextStyle(
color: Colors.grey[600], fontSize: 26),
),
),
),
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))),
content: status == "false" && infoRole == "User"
? SizedBox(
height: 300,
width: 600,
child: Column(children: <Widget>[
Container(
margin: const EdgeInsets.only(top: 50),
child: const Text(
"Information is in verifying process!",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold))),
Container(
margin: const EdgeInsets.only(top: 50),
child: const Icon(Icons.pending_actions, size: 100.0),
)
]))
: Container(
height: 440,
width: 600,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.only(top: 10.0),
child: SizedBox(
height: 200,
child: RawScrollbar(
thumbColor: Colors.redAccent,
radius: const Radius.circular(20),
thickness: 10,
child: ListView.builder(
itemCount: diseaseDescriptionsList.length,
itemBuilder:
(BuildContext context, int index) {
return AnimationConfiguration
.staggeredGrid(
columnCount:
diseaseDescriptionsList.length,
position: index,
child: SlideAnimation(
child: FadeInAnimation(
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(16),
color: Colors.blue,
),
margin: const EdgeInsets.only(
top: 5.0),
child: Card(
elevation: 5.0,
child: ListTile(
title: Text(
diseaseDescriptionsList[
index]
.descriptionPoint,
style: GoogleFonts.lato(
textStyle:
const TextStyle(
fontSize: 18,
fontWeight:
FontWeight.bold,
),
),
),
),
), ),
), ),
), ),
), ),
), );
), }),
), ),
), ),
); ),
}), ),
), ],
),
),
),
],
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.20,
margin: EdgeInsets.only(
left: MediaQuery.of(context).size.width * 0.1),
child: RaisedButton(
child: Text(
'More...',
style: TextStyle(color: Colors.white),
),
color: Color(0xFF32CD32),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
), ),
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DiseaseDetails(
disease: diseaseList,
)),
);
},
), ),
), actions: <Widget>[
SizedBox( Row(
width: MediaQuery.of(context).size.width * 0.1, mainAxisAlignment: MainAxisAlignment.center,
), children: <Widget>[
Padding( Container(
padding: const EdgeInsets.only(right: 40.0), padding: const EdgeInsets.only(right: 5.0),
child: Container(
width: MediaQuery.of(context).size.width * 0.20, width: MediaQuery.of(context).size.width * 0.20,
child: RaisedButton( margin: EdgeInsets.only(
child: new Text( left: MediaQuery.of(context).size.width * 0.03),
'Close', child: ClipRRect(
style: TextStyle(color: Colors.white), 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) => DiseaseDetails(
disease: diseaseList,
)),
);
},
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(
"More",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
), ),
color: Color(0xFFFF0000), ),
shape: new RoundedRectangleBorder( ),
borderRadius: new BorderRadius.circular(30.0), Padding(
padding: const EdgeInsets.only(right: 5.0),
child: infoRole == "Doctor"
? Container(
width: MediaQuery.of(context).size.width * 0.25,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: status == "false"
? Colors.green
: Colors.red,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor:
Colors.cyan.withOpacity(0.2),
onTap: () {
if (status == "false") {
_updateStatus(
diseaseList.diseaseName, "true");
setState(() {
status = "true";
});
} else {
_updateStatus(
diseaseList.diseaseName, "false");
setState(() {
status = "false";
});
}
},
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: status == "false"
? const Text(
"Approve",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
)
: const Text(
"Reject",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
),
),
)
: SizedBox(
width: MediaQuery.of(context).size.width * 0.1),
),
Padding(
padding: const EdgeInsets.only(right: 10.0),
child: Container(
width: MediaQuery.of(context).size.width * 0.20,
child: ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Material(
color: Colors.redAccent,
child: InkWell(
splashColor: Colors.cyan.withOpacity(0.2),
highlightColor: Colors.cyan.withOpacity(0.2),
onTap: () {
Navigator.of(context).pop();
},
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(
"Close",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black),
),
),
),
),
), ),
onPressed: () {
Navigator.of(context).pop();
},
), ),
), ),
), SizedBox(
SizedBox( height: MediaQuery.of(context).size.height * 0.02,
height: MediaQuery.of(context).size.height * 0.02, ),
), ],
], )
) ],
], );
); });
}); });
} }
} }
import 'dart:convert';
import 'package:canis_care/models/component.dart'; import 'package:canis_care/models/component.dart';
import 'package:canis_care/screens/chat_bot.dart';
import 'package:canis_care/screens/disease_intelligence_screen.dart'; import 'package:canis_care/screens/disease_intelligence_screen.dart';
import 'package:canis_care/screens/severity-level-detection.dart'; import 'package:canis_care/screens/severity-level-detection.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:localstorage/localstorage.dart';
import '../data/disease_sub_topics.dart'; import '../data/disease_sub_topics.dart';
import '../widgets/side_drawer.dart'; import '../widgets/side_drawer.dart';
...@@ -16,17 +20,32 @@ class HomePage extends StatefulWidget { ...@@ -16,17 +20,32 @@ class HomePage extends StatefulWidget {
} }
class _HomePageState extends State<HomePage> { class _HomePageState extends State<HomePage> {
final LocalStorage storage = LocalStorage('local_storage_app');
String? infoRole, infoEmail;
@override
void initState() {
getItemFromLocalStorage();
super.initState();
}
void getItemFromLocalStorage() {
Map<String, dynamic> info = json.decode(storage.getItem('info'));
infoEmail = info['email'];
infoRole = info['role'];
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
drawer: SideDrawer(), drawer: const SideDrawer(),
body: Container( body: Container(
color: Colors.blue[100], color: Colors.blue[100],
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.only( borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(60), bottomLeft: Radius.circular(60),
bottomRight: Radius.circular(60), bottomRight: Radius.circular(60),
), ),
...@@ -56,32 +75,61 @@ class _HomePageState extends State<HomePage> { ...@@ -56,32 +75,61 @@ class _HomePageState extends State<HomePage> {
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
child: Row( child: Column(children: [
mainAxisAlignment: MainAxisAlignment.center, Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
Padding( children: [
padding: EdgeInsets.only(bottom: 10), Padding(
child: Text( padding: const EdgeInsets.only(bottom: 10),
"CANIS CARE", child: Text(
style: GoogleFonts.bungeeShade( "CANIS CARE",
textStyle: const TextStyle( style: GoogleFonts.bungeeShade(
fontSize: 30, textStyle: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 30,
color: Colors.cyan), fontWeight: FontWeight.bold,
color: Colors.cyan),
),
), ),
), )
) ],
], ),
)) Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: infoRole == "Doctor"
? Text(
"Doctor Portal",
style: GoogleFonts.oswald(
textStyle: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: Colors.cyanAccent),
),
)
: Text(
"User Portal",
style: GoogleFonts.oswald(
textStyle: const TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: Colors.cyanAccent),
),
),
)
],
),
]))
], ],
), ),
), ),
SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Expanded( Expanded(
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(60), topLeft: Radius.circular(60),
topRight: Radius.circular(60), topRight: Radius.circular(60),
), ),
...@@ -101,17 +149,17 @@ class _HomePageState extends State<HomePage> { ...@@ -101,17 +149,17 @@ class _HomePageState extends State<HomePage> {
maxCrossAxisExtent: 280.0, maxCrossAxisExtent: 280.0,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { // onTap: () {
Navigator.of(context).push( // Navigator.of(context).push(
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => DiseaseIdentification()), // builder: (context) => DiseaseIdentification()),
); // );
}, // },
child: Container( child: Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10), top: 10, left: 10, right: 10, bottom: 10),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(60), borderRadius: BorderRadius.circular(40),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.blueAccent.withOpacity(0.6)), color: Colors.blueAccent.withOpacity(0.6)),
...@@ -126,7 +174,7 @@ class _HomePageState extends State<HomePage> { ...@@ -126,7 +174,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
Text( const Text(
"Identification", "Identification",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
...@@ -141,17 +189,17 @@ class _HomePageState extends State<HomePage> { ...@@ -141,17 +189,17 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
GestureDetector( GestureDetector(
onTap: () { // onTap: () {
Navigator.of(context).push( // Navigator.of(context).push(
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => SeverityLevelDetection()), // builder: (context) => SeverityLevelDetection()),
); // );
}, // },
child: Container( child: Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10), top: 10, left: 10, right: 10, bottom: 10),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(60), borderRadius: BorderRadius.circular(40),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.blueAccent.withOpacity(0.6)), color: Colors.blueAccent.withOpacity(0.6)),
...@@ -166,7 +214,7 @@ class _HomePageState extends State<HomePage> { ...@@ -166,7 +214,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
Text( const Text(
"Severity Level", "Severity Level",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
...@@ -184,7 +232,8 @@ class _HomePageState extends State<HomePage> { ...@@ -184,7 +232,8 @@ class _HomePageState extends State<HomePage> {
onTap: () { onTap: () {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => DiseaseIntelligence()), builder: (context) =>
const DiseaseIntelligence()),
); );
}, },
child: Container( child: Container(
...@@ -206,7 +255,7 @@ class _HomePageState extends State<HomePage> { ...@@ -206,7 +255,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
Text( const Text(
"Intelligence", "Intelligence",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
...@@ -221,6 +270,10 @@ class _HomePageState extends State<HomePage> { ...@@ -221,6 +270,10 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
GestureDetector( GestureDetector(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ChatBot()));
},
child: Container( child: Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 10), top: 10, left: 10, right: 10, bottom: 10),
...@@ -240,7 +293,7 @@ class _HomePageState extends State<HomePage> { ...@@ -240,7 +293,7 @@ class _HomePageState extends State<HomePage> {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
Text( const Text(
"Chat Support", "Chat Support",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
...@@ -255,51 +308,6 @@ class _HomePageState extends State<HomePage> { ...@@ -255,51 +308,6 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
], ],
// children: List.generate(
// componentCategories.length,
// (index) => GestureDetector(
// onTap: () {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => MyHomePage(
// title: 'Diseases',
// )),
// );
// },
// child: Container(
// padding: const EdgeInsets.only(
// top: 10, left: 10, right: 10, bottom: 10),
// child: ClipRRect(
// borderRadius: BorderRadius.circular(60),
// child: Container(
// decoration: BoxDecoration(
// color:
// Colors.blueAccent.withOpacity(0.6)),
// child: Column(
// children: [
// Image.asset(
// subCategories[index].imgUrl,
// fit: BoxFit.cover,
// width: 100,
// height: 100,
// ),
// const SizedBox(
// height: 10,
// ),
// Text(
// subCategories[index].categoryName,
// style: TextStyle(
// color: Colors.white,
// fontSize: 20,
// fontWeight: FontWeight.bold,
// ),
// )
// ],
// ),
// ),
// ),
// ),
// )),
), ),
), ),
]), ]),
......
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());
// })
// ],
// ),
// ))),
// );
// }
}
import 'dart:io'; // import 'dart:io';
//
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; // import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart'; // import 'package:image_picker/image_picker.dart';
import 'package:tflite/tflite.dart'; // import 'package:tflite/tflite.dart';
//
// severityLevelDetectionState // // severityLevelDetectionState
class SeverityLevelDetection extends StatefulWidget { // class SeverityLevelDetection extends StatefulWidget {
const SeverityLevelDetection({Key? key}) : super(key: key); // const SeverityLevelDetection({Key? key}) : super(key: key);
//
@override // @override
State<SeverityLevelDetection> createState() => _severityLevelDetectionState(); // State<SeverityLevelDetection> createState() => _severityLevelDetectionState();
} // }
//
class _severityLevelDetectionState extends State<SeverityLevelDetection> { // class _severityLevelDetectionState extends State<SeverityLevelDetection> {
//
late File pickedImage; // late File pickedImage;
bool _busy = false; // bool _busy = false;
late List _recognitions; // late List _recognitions;
bool isImageLoaded = false; // bool isImageLoaded = false;
late List resultList; // late List resultList;
String _confidence = ""; // String _confidence = "";
String _name = ""; // String _name = "";
String numbers = ""; // String numbers = "";
//
getImageFromGallery() async { // getImageFromGallery() async {
var image = // var image =
await ImagePicker.platform.getImage(source: ImageSource.gallery); // await ImagePicker.platform.getImage(source: ImageSource.gallery);
print("11111:"); // print("11111:");
setState(() { // setState(() {
_busy = true; // _busy = true;
}); // });
//
pickedImage = File(image!.path); // pickedImage = File(image!.path);
isImageLoaded = true; // isImageLoaded = true;
predictImage(pickedImage); // predictImage(pickedImage);
} // }
//
getImageFromCamera() async { // getImageFromCamera() async {
var image = await ImagePicker.platform.getImage(source: ImageSource.camera); // var image = await ImagePicker.platform.getImage(source: ImageSource.camera);
setState(() { // setState(() {
_busy = true; // _busy = true;
}); // });
//
pickedImage = File(image!.path); // pickedImage = File(image!.path);
isImageLoaded = true; // isImageLoaded = true;
predictImage(pickedImage); // predictImage(pickedImage);
} // }
//
void predictImage(File image) async { // void predictImage(File image) async {
await applyModelOnImage(image); // await applyModelOnImage(image);
} // }
//
loadDetectionModel() async { // loadDetectionModel() async {
try { // try {
String? res = await Tflite.loadModel( // String? res = await Tflite.loadModel(
model: "assets/severitymodel.tflite", // model: "assets/noneSeverityModel.tflite",
labels: "assets/levels-s.txt", // labels: "assets/levels-s.txt",
numThreads: 1, // numThreads: 1,
// defaults to 1 // // defaults to 1
isAsset: true, // isAsset: true,
// defaults to true, set to false to load resources outside assets // // defaults to true, set to false to load resources outside assets
useGpuDelegate: // useGpuDelegate:
false // defaults to false, set to true to use GPU delegate // false // defaults to false, set to true to use GPU delegate
); // );
print("Model Result : $res"); // print("Model Result : $res");
} on PlatformException { // } on PlatformException {
print('Failed to load model.'); // print('Failed to load model.');
} // }
} // }
//
applyModelOnImage(File image) async { // applyModelOnImage(File image) async {
int startTime = new DateTime.now().millisecondsSinceEpoch; // int startTime = new DateTime.now().millisecondsSinceEpoch;
//
var recognitions = await Tflite.runModelOnImage( // var recognitions = await Tflite.runModelOnImage(
path: image.path, // path: image.path,
// required // // required
imageMean: 0.0, // imageMean: 0.0,
// defaults to 117.0 // // defaults to 117.0
imageStd: 255.0, // imageStd: 255.0,
// defaults to 1.0 // // defaults to 1.0
numResults: 2, // numResults: 2,
// defaults to 5 // // defaults to 5
threshold: 0.2, // threshold: 0.2,
// defaults to 0.1 // // defaults to 0.1
asynch: true // defaults to true // asynch: true // defaults to true
); // );
setState(() { // setState(() {
_recognitions = recognitions!; // _recognitions = recognitions!;
print("res result : $_recognitions"); // print("res result : $_recognitions");
String str = _recognitions[0]["label"]; // String str = _recognitions[0]["label"];
_name = str.substring(2); // _name = str.substring(2);
print("Detected Levels: $_name"); // print("Detected Levels: $_name");
_confidence = _recognitions != null // _confidence = _recognitions != null
? (_recognitions[0]["confidence"] * 100.0) // ? (_recognitions[0]["confidence"] * 100.0)
.toString() // .toString()
.substring(0, 2) + // .substring(0, 2) +
"%" // "%"
: ""; // : "";
print("Confidence: $_confidence"); // print("Confidence: $_confidence");
}); // });
int endTime = new DateTime.now().millisecondsSinceEpoch; // int endTime = new DateTime.now().millisecondsSinceEpoch;
print("Inference took ${endTime - startTime}ms"); // setState(() { // print("Inference took ${endTime - startTime}ms"); // setState(() {
} // }
//
@override // @override
void initState() { // void initState() {
super.initState(); // super.initState();
loadDetectionModel(); // loadDetectionModel();
} // }
//
void objectRecocnition() async {} // void objectRecocnition() async {}
//
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return Scaffold( // return Scaffold(
appBar: AppBar(title: const Text("Severity Level Detection")), // appBar: AppBar(title: const Text("Severity Level Detection")),
body: SingleChildScrollView( // body: SingleChildScrollView(
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Padding( // Padding(
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
left: 20, // left: 20,
//
right: 20, // right: 20,
top: 35, // top: 35,
), // ),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
Row( // Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
SizedBox(height: 350), // SizedBox(height: 350),
isImageLoaded // isImageLoaded
? Center( // ? Center(
child: Container( // child: Container(
height: 350, // height: 350,
width: 350, // width: 350,
decoration: BoxDecoration( // decoration: BoxDecoration(
image: DecorationImage( // image: DecorationImage(
image: FileImage( // image: FileImage(
File(pickedImage.path)), // File(pickedImage.path)),
fit: BoxFit.contain)), // fit: BoxFit.contain)),
), // ),
) // )
: Container(), // : Container(),
]), // ]),
Padding( // Padding(
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
left: 20, // left: 20,
right: 20, // right: 20,
top: 100, // top: 100,
), // ),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
Text( // Text(
"Identified Severity Level: $_name \n Confidence: $_confidence" // "Identified Severity Level: $_name \n\n"
// style: TextStyle( // // style: TextStyle(
// color: Color(0xFFF05A22), // // color: Color(0xFFF05A22),
// fontFamily: 'Montserrat', // // fontFamily: 'Montserrat',
// fontSize: 16, // // fontSize: 16,
// fontWeight: FontWeight.w600, // // fontWeight: FontWeight.w600,
// letterSpacing: 1, // // letterSpacing: 1,
// ), // // ),
), // ),
Row( // Row(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.spaceBetween, // MainAxisAlignment.spaceBetween,
children: [ // children: [
SizedBox( // SizedBox(
width: 331.4, // width: 331.4,
height: 50.0, // height: 50.0,
child: GestureDetector( // child: GestureDetector(
onTap: () { // onTap: () {
getImageFromGallery(); // getImageFromGallery();
}, // },
child: Container( // child: Container(
// padding: EdgeInsets.fromLTRB(20, 30, 10, 15), // // padding: EdgeInsets.fromLTRB(20, 30, 10, 15),
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border.all( // border: Border.all(
// color: const Color(0xFFF05A22), // // color: const Color(0xFFF05A22),
style: BorderStyle.none, // style: BorderStyle.none,
width: 1.0, // width: 1.0,
), // ),
color: Colors.blue[200], // color: Colors.blue[200],
borderRadius: // borderRadius:
BorderRadius.circular(10.0), // BorderRadius.circular(10.0),
), // ),
child: Row( // child: Row(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.center, // MainAxisAlignment.center,
children: const <Widget>[ // children: const <Widget>[
Center( // Center(
child: Text( // child: Text(
"Launch Gallery", // "Launch Gallery",
style: TextStyle( // style: TextStyle(
color: Color(0xFFFFFFFF), // color: Color(0xFFFFFFFF),
fontFamily: 'Montserrat', // fontFamily: 'Montserrat',
fontSize: 16, // fontSize: 16,
fontWeight: FontWeight.w600, // fontWeight: FontWeight.w600,
letterSpacing: 1, // letterSpacing: 1,
), // ),
), // ),
) // )
], // ],
), // ),
), // ),
), // ),
), // ),
]), // ]),
Padding( // Padding(
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
// left: 20, // // left: 20,
// right: 20, // // right: 20,
top: 30, // top: 30,
), // ),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // children: [
Row( // Row(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.spaceBetween, // MainAxisAlignment.spaceBetween,
children: [ // children: [
SizedBox( // SizedBox(
width: 331.4, // width: 331.4,
height: 50.0, // height: 50.0,
child: GestureDetector( // child: GestureDetector(
onTap: () { // onTap: () {
getImageFromCamera(); // getImageFromCamera();
}, // },
child: Container( // child: Container(
// padding: EdgeInsets.fromLTRB(20, 30, 10, 15), // // padding: EdgeInsets.fromLTRB(20, 30, 10, 15),
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border.all( // border: Border.all(
// color: const Color(0xFFF05A22), // // color: const Color(0xFFF05A22),
style: BorderStyle.none, // style: BorderStyle.none,
width: 1.0, // width: 1.0,
), // ),
color: Colors.blue[200], // color: Colors.blue[200],
borderRadius: // borderRadius:
BorderRadius.circular( // BorderRadius.circular(
10.0), // 10.0),
), // ),
child: Row( // child: Row(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.center, // MainAxisAlignment.center,
children: const <Widget>[ // children: const <Widget>[
Center( // Center(
child: Text( // child: Text(
"Take a Picture ", // "Take a Picture ",
style: TextStyle( // style: TextStyle(
color: // color:
Color(0xFFFFFFFF), // Color(0xFFFFFFFF),
fontFamily: // fontFamily:
'Montserrat', // 'Montserrat',
fontSize: 16, // fontSize: 16,
fontWeight: // fontWeight:
FontWeight.w600, // FontWeight.w600,
letterSpacing: 1, // letterSpacing: 1,
), // ),
), // ),
) // )
], // ],
), // ),
), // ),
), // ),
), // ),
]), // ]),
], // ],
), // ),
), // ),
], // ],
)), // )),
], // ],
)), // )),
], // ],
), // ),
)); // ));
} // }
} // }
// 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'; 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); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const Scaffold( return Scaffold(
body: Center(child: Text("Sign Up Page")), // 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 { ...@@ -19,11 +19,6 @@ class SplashScreen extends StatelessWidget {
color: Colors.cyan, color: Colors.cyan,
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset("images/logo.png"), 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/home_screen.dart';
import 'package:canis_care/screens/login_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:canis_care/screens/signup_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -41,25 +43,40 @@ class WelcomeScreen extends StatelessWidget { ...@@ -41,25 +43,40 @@ class WelcomeScreen extends StatelessWidget {
const SizedBox( const SizedBox(
height: 50, height: 50,
), ),
Padding( Container(
padding: const EdgeInsets.all(20), margin:
child: FlatButton( const EdgeInsets.only(left: 20, right: 20, bottom: 20),
onPressed: () { child: ClipRRect(
Navigator.push( borderRadius: BorderRadius.circular(50),
context, child: Material(
MaterialPageRoute( color: Colors.transparent,
builder: (context) => const LoginScreen())); child: InkWell(
}, splashColor: Colors.cyan.withOpacity(0.2),
color: Colors.cyan, highlightColor: Colors.cyan.withOpacity(0.2),
shape: RoundedRectangleBorder( onTap: () {
borderRadius: BorderRadius.circular(50)), Navigator.push(
padding: const EdgeInsets.all(25), context,
child: const Text( MaterialPageRoute(
"Log In", builder: (context) =>
style: TextStyle( const SignInScreen()));
color: Colors.black, },
fontSize: 20, child: Container(
fontWeight: FontWeight.bold), 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 { ...@@ -100,26 +117,39 @@ class WelcomeScreen extends StatelessWidget {
), ),
), ),
), ),
Padding( Container(
padding: margin:
const EdgeInsets.only(left: 20, right: 20, bottom: 20), const EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: FlatButton( child: ClipRRect(
onPressed: () { borderRadius: BorderRadius.circular(50),
Navigator.push( child: Material(
context, color: Colors.transparent,
MaterialPageRoute( child: InkWell(
builder: (context) => const HomePage())); splashColor: Colors.cyan.withOpacity(0.2),
}, highlightColor: Colors.cyan.withOpacity(0.2),
color: Colors.cyan, onTap: () {
shape: RoundedRectangleBorder( Navigator.push(
borderRadius: BorderRadius.circular(50)), context,
padding: const EdgeInsets.all(25), MaterialPageRoute(
child: const Text( builder: (context) => const AdminScreen()));
"Get Started", },
style: TextStyle( child: Container(
color: Colors.black, padding: const EdgeInsets.all(20),
fontSize: 20, decoration: BoxDecoration(
fontWeight: FontWeight.bold), 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 'package:flutter/material.dart';
import '../screens/home_screen.dart';
class BotBar extends StatelessWidget { class BotBar extends StatelessWidget {
const BotBar({Key? key}) : super(key: key); const BotBar({Key? key}) : super(key: key);
...@@ -25,7 +29,11 @@ class BotBar extends StatelessWidget { ...@@ -25,7 +29,11 @@ class BotBar extends StatelessWidget {
size: 30, size: 30,
color: Colors.blue, color: Colors.blue,
), ),
onPressed: () {}, onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const HomePage()),
);
},
), ),
), ),
), ),
...@@ -33,11 +41,15 @@ class BotBar extends StatelessWidget { ...@@ -33,11 +41,15 @@ class BotBar extends StatelessWidget {
child: Material( child: Material(
child: IconButton( child: IconButton(
icon: const Icon( icon: const Icon(
Icons.add_a_photo, Icons.camera_alt,
size: 30, size: 30,
color: Colors.blue, color: Colors.blue,
), ),
onPressed: () {}, onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const HomePage()),
);
},
), ),
), ),
), ),
...@@ -45,11 +57,16 @@ class BotBar extends StatelessWidget { ...@@ -45,11 +57,16 @@ class BotBar extends StatelessWidget {
child: Material( child: Material(
child: IconButton( child: IconButton(
icon: const Icon( icon: const Icon(
Icons.account_circle, Icons.info_rounded,
size: 30, size: 30,
color: Colors.blue, color: Colors.blue,
), ),
onPressed: () {}, onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const DiseaseIntelligence()),
);
},
), ),
), ),
), ),
...@@ -57,11 +74,15 @@ class BotBar extends StatelessWidget { ...@@ -57,11 +74,15 @@ class BotBar extends StatelessWidget {
child: Material( child: Material(
child: IconButton( child: IconButton(
icon: const Icon( icon: const Icon(
Icons.ac_unit_rounded, Icons.chat_rounded,
size: 30, size: 30,
color: Colors.blue, 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();
},
),
],
);
},
);
}
}
import 'package:flutter/material.dart';
Image logoWidget(String imageName) {
return Image.asset(
imageName,
fit: BoxFit.fitWidth,
width: 240,
height: 240,
color: Colors.white,
);
}
TextField reusableTextField(String text, IconData icon, bool isPasswordType,
TextEditingController controller) {
return TextField(
controller: controller,
obscureText: isPasswordType,
enableSuggestions: !isPasswordType,
autocorrect: !isPasswordType,
cursorColor: Colors.black,
style: TextStyle(color: Colors.black.withOpacity(0.9)),
decoration: InputDecoration(
prefixIcon: Icon(
icon,
color: Colors.blueGrey,
),
labelText: text,
labelStyle:
const TextStyle(color: Colors.blueGrey, fontWeight: FontWeight.bold),
filled: true,
floatingLabelBehavior: FloatingLabelBehavior.never,
fillColor: Colors.white.withOpacity(0.3),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(30.0),
borderSide: const BorderSide(width: 0, style: BorderStyle.none)),
),
keyboardType: isPasswordType
? TextInputType.visiblePassword
: TextInputType.emailAddress,
);
}
Container firebaseUIButton(BuildContext context, String title, Function onTap) {
return Container(
width: MediaQuery.of(context).size.width,
height: 50,
margin: const EdgeInsets.fromLTRB(0, 10, 0, 20),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(90)),
child: ElevatedButton(
onPressed: () {
onTap();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.pressed)) {
return Colors.cyan.withOpacity(0.8);
}
return Colors.white;
}),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)))),
child: Text(
title,
style: const TextStyle(
color: Colors.black87, fontWeight: FontWeight.bold, fontSize: 16),
),
),
);
}
import 'package:canis_care/screens/chat_bot.dart';
import 'package:canis_care/widgets/side_drawer_tile.dart'; import 'package:canis_care/widgets/side_drawer_tile.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ternav_icons/ternav_icons.dart'; import 'package:ternav_icons/ternav_icons.dart';
import '../screens/disease_intelligence_screen.dart';
import '../screens/home_screen.dart'; import '../screens/home_screen.dart';
class SideDrawer extends StatelessWidget { class SideDrawer extends StatelessWidget {
...@@ -42,15 +44,17 @@ class SideDrawer extends StatelessWidget { ...@@ -42,15 +44,17 @@ class SideDrawer extends StatelessWidget {
icon: TernavIcons.lightOutline.info_1, icon: TernavIcons.lightOutline.info_1,
title: "Disease Information", title: "Disease Information",
onTap: () { onTap: () {
// Navigator.of(context).push( Navigator.of(context).push(MaterialPageRoute(
// MaterialPageRoute(builder: (context) => const HomePage()), builder: (context) => const DiseaseIntelligence()));
// );
}, },
), ),
DrawerListTile( DrawerListTile(
icon: TernavIcons.lightOutline.message, icon: TernavIcons.lightOutline.message,
title: "Chat Service", title: "Chat Service",
onTap: () {}, onTap: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => ChatBot()));
},
), ),
const SizedBox( const SizedBox(
height: 10, height: 10,
......
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
enum _MenuOptions {
navigationDelegate,
}
class Menu extends StatelessWidget {
const Menu({required this.controller, super.key});
final Completer<WebViewController> controller;
@override
Widget build(BuildContext context) {
return FutureBuilder<WebViewController>(
future: controller.future,
builder: (context, controller) {
return PopupMenuButton<_MenuOptions>(
onSelected: (value) async {
switch (value) {
case _MenuOptions.navigationDelegate:
await controller.data!.loadUrl('https://youtube.com');
break;
}
},
itemBuilder: (context) => [
const PopupMenuItem<_MenuOptions>(
value: _MenuOptions.navigationDelegate,
child: Text('Navigate to YouTube'),
),
],
);
},
);
}
}
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';
class WebViewStack extends StatefulWidget {
const WebViewStack(
{super.key,
required this.link,
required this.controller,
required this.disease});
final String link;
final Completer<WebViewController> controller;
final Disease disease;
@override
State<WebViewStack> createState() => _WebViewStackState();
}
class _WebViewStackState extends State<WebViewStack> {
Client client = http.Client();
var loadingPercentage = 0;
late String link;
// String url = "https://canis-care-mobile.herokuapp.com";
String url = "http://192.168.1.101:8000";
@override
void initState() {
_retrieveSeeAlsoLink();
super.initState();
}
_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];
});
}
String webViewUserAgent = '';
Future<void> setUserAgentVariable() async {
Future.delayed(Duration(milliseconds: 5), () {
setState(() {
webViewUserAgent = 'flutterwebviewexample';
});
});
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
WebView(
userAgent: webViewUserAgent,
javascriptMode: JavascriptMode.unrestricted,
gestureNavigationEnabled: true,
initialUrl: widget.link,
onWebViewCreated: (webViewController) {
widget.controller.complete(webViewController);
},
onPageStarted: (url) {
setState(() {
loadingPercentage = 0;
});
},
onProgress: (progress) {
setState(() {
loadingPercentage = progress;
});
},
onPageFinished: (url) {
setState(() {
loadingPercentage = 100;
});
},
// navigationDelegate: (navigation) {
// final host = Uri.parse(navigation.url).host;
// if (host.contains('youtube.com')) {
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// 'Blocking navigation to $host',
// ),
// ),
// );
// return NavigationDecision.navigate;
// }
// return NavigationDecision.navigate;
// },
),
if (loadingPercentage < 100)
LinearProgressIndicator(
value: loadingPercentage / 100.0,
),
],
);
}
}
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_flutterfire_internals:
dependency: transitive
description:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
async: async:
dependency: transitive dependency: transitive
description: description:
...@@ -8,6 +15,20 @@ packages: ...@@ -8,6 +15,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.9.0" version: "2.9.0"
badges:
dependency: "direct main"
description:
name: badges
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
basic_utils:
dependency: "direct main"
description:
name: basic_utils
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
...@@ -15,6 +36,13 @@ packages: ...@@ -15,6 +36,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
bubble:
dependency: "direct main"
description:
name: bubble
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
...@@ -29,6 +57,27 @@ packages: ...@@ -29,6 +57,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
cloud_firestore:
dependency: "direct main"
description:
name: cloud_firestore
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.1"
cloud_firestore_platform_interface:
dependency: transitive
description:
name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.7.7"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.10"
collection: collection:
dependency: transitive dependency: transitive
description: description:
...@@ -36,6 +85,13 @@ packages: ...@@ -36,6 +85,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.16.0" version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
cross_file: cross_file:
dependency: transitive dependency: transitive
description: description:
...@@ -78,6 +134,48 @@ packages: ...@@ -78,6 +134,48 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.4" version: "6.1.4"
firebase_auth:
dependency: "direct main"
description:
name: firebase_auth
url: "https://pub.dartlang.org"
source: hosted
version: "3.11.2"
firebase_auth_platform_interface:
dependency: transitive
description:
name: firebase_auth_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "6.10.1"
firebase_auth_web:
dependency: transitive
description:
name: firebase_auth_web
url: "https://pub.dartlang.org"
source: hosted
version: "4.6.1"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "1.24.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.1"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.3"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
...@@ -97,6 +195,13 @@ packages: ...@@ -97,6 +195,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.7" version: "2.0.7"
flutter_spinkit:
dependency: "direct main"
description:
name: flutter_spinkit
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
flutter_staggered_animations: flutter_staggered_animations:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -177,6 +282,13 @@ packages: ...@@ -177,6 +282,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.6.2" version: "2.6.2"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
js: js:
dependency: transitive dependency: transitive
description: description:
...@@ -184,6 +296,13 @@ packages: ...@@ -184,6 +296,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.4" version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.7.0"
lints: lints:
dependency: transitive dependency: transitive
description: description:
...@@ -191,6 +310,20 @@ packages: ...@@ -191,6 +310,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
localstorage:
dependency: "direct main"
description:
name: localstorage
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0+1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
...@@ -282,6 +415,13 @@ packages: ...@@ -282,6 +415,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
pointycastle:
dependency: transitive
description:
name: pointycastle
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.2"
process: process:
dependency: transitive dependency: transitive
description: description:
...@@ -343,20 +483,69 @@ packages: ...@@ -343,20 +483,69 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.12" version: "0.4.12"
tflite: typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
name: tflite name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "6.1.6"
typed_data: url_launcher_android:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: url_launcher_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.1" version: "6.0.19"
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:
...@@ -371,6 +560,34 @@ packages: ...@@ -371,6 +560,34 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.0" version: "1.5.0"
webview_flutter:
dependency: "direct main"
description:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.4"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.10.4"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.5"
win32: win32:
dependency: transitive dependency: transitive
description: description:
......
...@@ -40,9 +40,19 @@ dependencies: ...@@ -40,9 +40,19 @@ dependencies:
font_awesome_flutter: ^10.2.1 font_awesome_flutter: ^10.2.1
flutter_staggered_animations: any flutter_staggered_animations: any
google_fonts: google_fonts:
tflite: ^1.1.2 # tflite: ^1.1.2
meta: ^1.8.0 meta: ^1.8.0
image_picker: ^0.8.5+3 image_picker: ^0.8.5+3
url_launcher: ^6.1.6
flutter_spinkit: ^5.1.0
webview_flutter: ^3.0.4
bubble: ^1.2.1
firebase_core: ^1.24.0
firebase_auth: ^3.11.2
localstorage: ^4.0.0+1
badges: ^2.0.3
cloud_firestore:
basic_utils: any
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
...@@ -101,11 +111,19 @@ flutter: ...@@ -101,11 +111,19 @@ flutter:
- images/symbols/bacterial.png - images/symbols/bacterial.png
- images/symbols/viral.png - images/symbols/viral.png
- images/symbols/2.jpg - images/symbols/2.jpg
- images/symbols/Admin1.jpg
- images/symbols/Admin2.jpg
- images/symbols/extract5.png
- images/symbols/userm.png
- images/symbols/dogs.jpg
- images/symbols/preprocess.png
- images/symbols/onto.png
- images/symbols/onto2.png
- assets/skinDiseaseIdentificationModel.tflite - assets/skinDiseaseIdentificationModel.tflite
- assets/labels.txt - assets/labels.txt
- assets/newdog1model1.tflite - assets/newdog1model1.tflite
- assets/levels-s.txt - assets/levels-s.txt
- assets/severitymodel.tflite - assets/noneSeverityModel.tflite
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
......
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