prescription adding

dev
Sneha 1 year ago
parent a35d50972f
commit 57c9b3618f

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 KiB

After

Width:  |  Height:  |  Size: 935 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 662 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

@ -0,0 +1,13 @@
/* get pharmacies data */
/*Expanded(
child: Container(
child: isPharmacyDataLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: _pharamciesData(),
))*/

@ -1,13 +1,15 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:healthcare_user/common/updateprofile.dart';
import 'package:healthcare_user/emergency.dart';
import 'package:healthcare_user/howareufeeling_today.dart';
import 'package:healthcare_user/invitations.dart';
import 'package:healthcare_user/medicines.dart';
import 'package:healthcare_user/my_health.dart';
import 'package:healthcare_user/my_medicine_timings.dart';
import 'package:healthcare_user/prescriptions.dart';
import 'package:healthcare_user/prescriptions/prescriptions.dart';
import 'package:healthcare_user/report_my_self.dart';
import 'package:healthcare_user/reports.dart';
import 'package:healthcare_user/seekopinion.dart';
import 'package:healthcare_user/common/settings.dart';
@ -16,6 +18,7 @@ import 'package:carousel_slider/carousel_slider.dart';
import 'dart:ui' as ui;
import 'login.dart';
import 'dart:io';
import 'package:dots_indicator/dots_indicator.dart';
class Dashboard extends StatefulWidget {
const Dashboard({super.key});
@ -35,7 +38,7 @@ class _DashboardState extends State<Dashboard> {
final ImagePicker _picker = ImagePicker();
bool isTablet = false;
bool isPhone = true;
int currentIndex = 0;
final double devicePixelRatio = ui.window.devicePixelRatio;
static final ui.Size size1 = ui.window.physicalSize;
final double width = size1.width;
@ -64,50 +67,37 @@ class _DashboardState extends State<Dashboard> {
];
gridOntap(int ind) {
if (ind == 0) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SeekOpinion()),
MaterialPageRoute(builder: (context) => const SeekOpinion()),
);
}
else if(ind==1){
} else if (ind == 1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Reports()),
MaterialPageRoute(builder: (context) => const Reports()),
);
}
else if(ind==2){
} else if (ind == 2) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Prescriptions()),
MaterialPageRoute(builder: (context) => const Prescriptions()),
);
}
else if(ind==3){
} else if (ind == 3) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Medicines()),
MaterialPageRoute(builder: (context) => const Medicines()),
);
}
else if(ind==4){
} else if (ind == 4) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Invitations()),
MaterialPageRoute(builder: (context) => const Invitations()),
);
}
else if(ind==5){
} else if (ind == 5) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Emergency()),
MaterialPageRoute(builder: (context) => const Emergency()),
);
}
}
Widget _dashBoard() {
@ -152,14 +142,16 @@ class _DashboardState extends State<Dashboard> {
}).toList(),
),
SizedBox(height: 5),
Expanded(child: Container(
Expanded(
child: Container(
padding: EdgeInsets.all(12.0),
child: GridView.builder(
itemCount: images.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 4.0,
mainAxisSpacing: 4.0,),
crossAxisSpacing: 2.0,
mainAxisSpacing: 2.0,
),
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
@ -168,12 +160,266 @@ class _DashboardState extends State<Dashboard> {
child: Image.asset(images[index]),
);
},
)),)
)),
)
],
),
);
}
Widget _newDashboard() {
return Container(
color: primaryColor,
child: Column(children: <Widget>[
CarouselSlider(
options: CarouselOptions(
height: MediaQuery.of(context).size.height * .250,
aspectRatio: 16 / 9,
viewportFraction: 0.8,
initialPage: 0,
enableInfiniteScroll: true,
reverse: false,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),
autoPlayCurve: Curves.ease,
enlargeCenterPage: true,
onPageChanged: (index, reason) {
setState(() {
currentIndex = index;
});
},
enlargeFactor: 0.2,
scrollDirection: Axis.horizontal,
),
items: imgList.map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * .250,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
),
//color: Colors.red,
child: FittedBox(
child: Image(
image: AssetImage(i),
),
fit: BoxFit.fill,
));
},
);
}).toList(),
),
DotsIndicator(
dotsCount: imgList.length,
position: currentIndex,
axis: Axis.horizontal,
decorator: DotsDecorator(
color: Colors.white,
activeColor: buttonColors
)
//decorator: decorator,
),
Padding(
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/seekopinion.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SeekOpinion()),
);
},
),
Text(
'Seek Opinion',
style: dashboardTextStyle(),
),
],
),
Column(
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/reports.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Reports()),
);
},
),
Text(
'Reports',
style: dashboardTextStyle(),
),
],
),
],
),
),
Padding(
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/prescriptions.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Prescriptions()),
);
},
),
Text(
'Prescriptions',
style: dashboardTextStyle(),
),
],
),
Column(
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/medicines.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Medicines()),
);
},
),
Text(
'Medicines',
style: dashboardTextStyle(),
),
],
),
],
),
),
Padding(
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/invitations.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Invitations()),
);
},
),
Text(
'Invitations',
style: dashboardTextStyle(),
),
],
),
Column(
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/emergency.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Emergency()),
);
},
),
Text(
'Emergency',
style: dashboardTextStyle(),
),
],
),
],
),
)
]));
}
@override
void initState() {
super.initState();
@ -193,12 +439,15 @@ class _DashboardState extends State<Dashboard> {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
AppSettings.updatedImage = imageTemp;
AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
});
//uploadProfileApi(image.path);
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
@ -209,13 +458,14 @@ class _DashboardState extends State<Dashboard> {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
AppSettings.updatedImage = imageTemp;
AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
});
//uploadProfileApi(image.path);
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
@ -295,9 +545,11 @@ class _DashboardState extends State<Dashboard> {
return shouldPop!;
},
child: Scaffold(
backgroundColor: primaryColor,
resizeToAvoidBottomInset: false,
appBar: AppSettings.appBar('Health Care'),
drawer: Drawer(
backgroundColor: secondaryColor,
child: ListView(
padding: EdgeInsets.zero,
children: [
@ -319,14 +571,16 @@ class _DashboardState extends State<Dashboard> {
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: (AppSettings.updatedImage !=
null)
? FileImage(
AppSettings.updatedImage!)
image: (AppSettings.profilePictureUrl !=
'' &&
AppSettings.profilePictureUrl !=
'null')
? NetworkImage(AppSettings
.profilePictureUrl)
as ImageProvider
: AssetImage(
"images/profile_pic.png"), // picked file
fit: BoxFit.cover)),
fit: BoxFit.fitWidth)),
),
onTap: () {
showModalBottomSheet<void>(
@ -377,24 +631,37 @@ class _DashboardState extends State<Dashboard> {
),
Text(
AppSettings.userName,
style: TextStyle(color: Colors.white, fontSize: 15),
style: drawerHeaderTextStyle(),
),
Text(
AppSettings.phoneNumber,
style: TextStyle(color: Colors.white, fontSize: 15),
style: drawerHeaderTextStyle(),
),
Visibility(
visible: AppSettings.email != '',
child: Text(
AppSettings.email,
style: TextStyle(color: Colors.white, fontSize: 15),
),),
style: drawerHeaderTextStyle(),
),
),
Row(
children: [
Visibility(
visible: AppSettings.age != '',
child: Text(
AppSettings.age+' Yrs',
style: TextStyle(color: Colors.white, fontSize: 15),
),),
AppSettings.age + ' Yrs, ',
style: drawerHeaderTextStyle(),
),
),
Visibility(
visible: AppSettings.gender != '',
child: Text(
AppSettings.gender,
style: drawerHeaderTextStyle(),
),
),
],
)
],
),
Container()
@ -402,7 +669,7 @@ class _DashboardState extends State<Dashboard> {
)),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/editprofile.png'),
height: 25,
@ -414,7 +681,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('Edit Profile', style: TextStyle(color: primaryColor)),
Text('Edit Profile', style: drawerListItemsTextStyle()),
],
),
onTap: () {
@ -430,7 +697,7 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/myhealth.png'),
height: 25,
@ -442,14 +709,42 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('My Health', style: TextStyle(color: primaryColor)),
Text('My Health', style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const MyHealth()),
);
},
),
Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: [
Image(
image: const AssetImage('images/myconnections.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
const SizedBox(
width: 10,
),
const SizedBox(
width: 10,
),
Text('How are you feeling today?',
style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MyHealth()),
builder: (context) => const HowAreYouFellingToday()),
);
},
),
@ -458,7 +753,7 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/reportmyself.png'),
height: 25,
@ -470,17 +765,23 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('Report Myself', style: TextStyle(color: primaryColor)),
Text('Report Myself', style: drawerListItemsTextStyle()),
],
),
onTap: () {},
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ReportMySelf()),
);
},
),
Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/myconnections.png'),
height: 25,
@ -492,7 +793,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('My Connections', style: TextStyle(color: primaryColor)),
Text('My Connections', style: drawerListItemsTextStyle()),
],
),
onTap: () {},
@ -502,7 +803,7 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/mymedicinetimings.png'),
height: 25,
@ -514,7 +815,8 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('My Medicine Timings', style: TextStyle(color: primaryColor)),
Text('My Medicine Timings',
style: drawerListItemsTextStyle()),
],
),
onTap: () {
@ -530,7 +832,7 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/updatepin.png'),
height: 25,
@ -542,7 +844,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('Update Pin', style: TextStyle(color: primaryColor)),
Text('Update Pin', style: drawerListItemsTextStyle()),
],
),
onTap: () {},
@ -552,9 +854,10 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/updatemobilenumber.png'),
image:
const AssetImage('images/updatemobilenumber.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
@ -564,7 +867,8 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('Update Mobile Number', style: TextStyle(color: primaryColor)),
Text('Update Mobile Number',
style: drawerListItemsTextStyle()),
],
),
onTap: () {},
@ -574,7 +878,7 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/updatemylocation.png'),
height: 25,
@ -586,7 +890,8 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('Update My Location', style: TextStyle(color: primaryColor)),
Text('Update My Location',
style: drawerListItemsTextStyle()),
],
),
onTap: () {},
@ -596,7 +901,7 @@ class _DashboardState extends State<Dashboard> {
),
ListTile(
title: Row(
children: const [
children: [
Image(
image: const AssetImage('images/logout.png'),
height: 25,
@ -608,16 +913,17 @@ class _DashboardState extends State<Dashboard> {
const SizedBox(
width: 10,
),
Text('Logout', style: TextStyle(color: primaryColor)),
Text('Logout', style: drawerListItemsTextStyle()),
],
),
onTap: () {},
onTap: () {
showLogoutAlertDialog(context);
},
),
],
),
),
body: _dashBoard(),
body: _newDashboard(),
),
);
}

@ -70,13 +70,14 @@ class _LoginState extends State<Login> {
onWillPop: () async => onWillPop(),
child: Scaffold(
backgroundColor: primaryColor,
body: Stack(
children: <Widget>[
Container(
/*Container(
decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,),
),
),
),*/
GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
@ -96,50 +97,31 @@ class _LoginState extends State<Login> {
image: const AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .25,
)),
const SizedBox(
height: 15,
SizedBox(
height:MediaQuery.of(context).size.height * .05,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color:primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter MobileNumber',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
),
const SizedBox(
height: 15,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: TextFormField(
cursorColor: greyColor,
obscureText: isObscureText,
controller: passwordController,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Password',
prefixIcon: const Icon(Icons.password, color: greyColor,),
labelStyle: const TextStyle(
color: greyColor, //<-- SEE HERE
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
@ -167,7 +149,10 @@ class _LoginState extends State<Login> {
),
),
Padding(padding: const EdgeInsets.fromLTRB(220, 10, 0,10),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Align(
alignment: Alignment.bottomRight,
child: Padding(padding: const EdgeInsets.fromLTRB(0, 0, 0,0),
child: TextButton(
onPressed: () {
/*Navigator.push(
@ -178,25 +163,25 @@ class _LoginState extends State<Login> {
child: const Text(
'Forgot Password?',
style: TextStyle(
color: greyColor,
fontSize: 15,
color: Colors.white,
decoration: TextDecoration.underline,
),
),
),),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: 400,
height: 50,
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async{
if (mobileNumberController.text != '' ||
if (mobileNumberController.text != '' &&
passwordController.text != '') {
AppSettings.preLoaderDialog(context);
@ -254,14 +239,13 @@ class _LoginState extends State<Login> {
const Text(
'Not a Member Yet?',
style: TextStyle(
color: primaryColor,
color: Colors.white,
),
),
TextButton(
child: const Text(
'Sign Up',
style: TextStyle(fontSize: 15,
decoration: TextDecoration.underline,color: greyColor),
style: TextStyle(decoration: TextDecoration.underline,color: Colors.white),
),
onPressed: () {
Navigator.push(

@ -230,7 +230,15 @@ class OtpInput extends StatelessWidget {
maxLength: 1,
cursorColor: Theme.of(context).primaryColor,
decoration: const InputDecoration(
border: OutlineInputBorder(),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
counterText: '',
hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)),
onChanged: (value) {

@ -13,7 +13,10 @@ import 'dart:async';
import 'package:geolocator/geolocator.dart';
import 'package:fluttertoast/fluttertoast.dart';
const Color primaryColor = Color(0XFF1786A3);
//const Color primaryColor = Color(0XFF1786A3);
const Color primaryColor = Color(0XFF68A85D);
const Color secondaryColor = Color(0XFFA0C899);
const Color buttonColors = Color(0XFFFFAC1C);
const Color greyColor = Color(0XFF8F8E8E);
const Color textFieldStartColor = Colors.grey;
const Color screenBackgroundColor = Color(0XFFEAF6FF);
@ -21,10 +24,10 @@ const Color screenBackgroundColord = Colors.black12;
const Color dashboardbackground = Color(0XFFF5F5F5);
//Color AppBarGradient_1 = Color(0XFF1258F6);
Color AppBarGradient_1 = Color(0XFF1786A3);
Color AppBarGradient_1 = Color(0XFF68A85D);
TextStyle PreloaderText() {
return TextStyle(color: Color(0XFF1786A3));
return TextStyle(color: Color(0XFF68A85D));
}
TextStyle labelTextStyle() {
@ -66,8 +69,7 @@ Text dimensionSuffixText() {
TextStyle dashboardTextStyle() {
return TextStyle(
color: primaryColor,
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
);
}
@ -82,22 +84,59 @@ TextStyle labelTextStyleBold() {
TextStyle serverIssueTextStyle() {
return TextStyle(color: Colors.red, fontSize: 15);
}
TextStyle bottomSheetValuesTextStyle() {
return TextStyle(fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
}
TextStyle wrapTextStyle() {
return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
}
TextStyle wrapTextStyleBlack() {
return TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
}
TextStyle withoutWrapTextStyle() {
return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,);
}
TextStyle bmiTextStyle() {
return TextStyle(color:primaryColor,fontSize: 16,fontWeight: FontWeight.bold,);
}
TextStyle drawerListItemsTextStyle(){
return TextStyle(color: Colors.white);
}
TextStyle drawerHeaderTextStyle(){
return TextStyle(color: Colors.white, fontSize: 15);
}
InputDecoration textFormFieldDecoration(IconData icon,var text){
return InputDecoration(
filled: true,
fillColor: Colors.white,
prefixIcon: Icon(
icon,
color: greyColor,
),
border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: text,
labelStyle:
TextStyle(color: Colors.black, //<-- SEE HERE
),
);
}
final GlobalKey<State> preloaderWindowKey = new GlobalKey<State>();
Future<void> preloaderWindow(BuildContext context) async {
try {
@ -112,6 +151,7 @@ class AppSettings {
static String userAddress = '';
static String email = '';
static String age = '';
static String gender = '';
static String phoneNumber = '';
static String accessToken = '';
static String customerId = '';
@ -154,6 +194,13 @@ class AppSettings {
static String getMedicineTimingsUrl = host + 'getmedicineztiming';
static String prescriptionUploadPicUrl = host + 'uploads-precription';
static String getAllpharmaciesDataUrl = host + 'getAllPharmacylist';
static String uploadPrescriptionUrl = host + 'submitPicture';
static String addPrescriptionUrl = host + 'add-prescription-details';
static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo';
static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription';
@ -164,6 +211,7 @@ class AppSettings {
static File? updatedImage;
static String image = '';
static String profilePictureUrl = '';
static var api = {
'signIn': host + '/login',
};
@ -510,7 +558,6 @@ class AppSettings {
phoneNumber = _response['phone'];
email = _response['emails'][0]['email'];
age = _response['age'].toString();
await saveData('phone', _response['phone'], 'STRING');
await saveData('email', _response['emails'][0]['email'], 'STRING');
await saveData('username', _response['username'], 'STRING');
@ -611,6 +658,15 @@ class AppSettings {
var res = await request.send();
return res;
}
static Future<String> uploadImageHTTPNew(file) async {
var request = http.MultipartRequest('POST', Uri.parse(uploadPicUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> uploadImageHTTPForPrescriptions(file) async {
@ -623,6 +679,16 @@ class AppSettings {
}
static Future<String> uploadVideoInReportMySelf(file) async {
var request = http.MultipartRequest('POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId));
request.files.add(await http.MultipartFile.fromPath('video', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
static Future<String> getAllpharmacies() async {
var uri = Uri.parse(getAllpharmaciesDataUrl);
//uri = uri.replace(query: 'customerId=$customerId');
@ -695,6 +761,104 @@ class AppSettings {
}
}
static Future<bool> uploadPrescription(payload) async {
var uri = Uri.parse(uploadPrescriptionUrl + '/' + customerId);
var response = await http.post(
uri,
body: json.encode(payload),
headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
print(e);
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(
uri,
body: json.encode(payload),
headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<bool> addPrescription(payload) async {
var uri = Uri.parse(addPrescriptionUrl + '/' + customerId);
var response = await http.post(
uri,
body: json.encode(payload),
headers: await buildRequestHeaders());
if (response.statusCode == 200) {
try {
var _response = json.decode(response.body);
print(_response);
return true;
} catch (e) {
print(e);
return false;
}
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.post(
uri,
body: json.encode(payload),
headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<String> getAllPrescriptions() async {
var uri = Uri.parse(getAllPrescriptionsDataUrl+'/'+customerId);
//uri = uri.replace(query: 'customerId=$customerId');
var response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.get(uri, headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
/*Apis ends here*/
//save data local
@ -712,16 +876,18 @@ class AppSettings {
await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE');
await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE');
await saveData('fcmId', input['simplydata']['fcmId'], 'STRING');
await saveData('age', input['simplydata']['age'], 'STRING');
await saveData('gender', input['simplydata']['gender'], 'STRING');
//await saveData('age', input['simplydata']['age'], 'STRING');
//latitude,longitude
await loadDataFromMemory();
}
static Future<void> saveProfile(dynamic image) async {
/* static Future<void> saveProfile(dynamic image) async {
// save login name information
await saveData('profile', image.toString(), 'STRING');
//await loadDataFromMemory();
}
}*/
static Uint8List convertBase64Image(String base64String) {
return Base64Decoder().convert(base64String.split(',').last);
@ -736,32 +902,10 @@ class AppSettings {
customerId = await getData('customerId', 'STRING');
userLatitude = await getData('latitude', 'DOUBLE');
userLongitude =await getData('longitude', 'DOUBLE');
profilePictureUrl=await getData('profile', 'STRING');
fcmId =await getData('fcmId', 'STRING');
age=await getData('age', 'STRING');
getProfile();
}
static Future<void> getProfile() async {
final image1 = await getData('profile', 'STRING');
//Io.File.fromUri(imageFile.uri)
var x = image1;
if (image1 == null) return;
if (image1 == '') {
updatedImage = null;
}
else if (image1 == 'null') {
updatedImage = null;
}
else {
final imageTemp = File(image1);
updatedImage = imageTemp;
}
print(updatedImage);
gender=await getData('gender', 'STRING');
}
static void longFailedStyledToast(String message, context) {

@ -147,18 +147,21 @@ class _SignUpState extends State<SignUp> {
return WillPopScope(
onWillPop:()async=>onWillPop(),
child: Scaffold(
backgroundColor: primaryColor,
body: Stack(children: <Widget>[
Container(
/* Container(
decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,),
),
),
),*/
GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
@ -173,47 +176,29 @@ class _SignUpState extends State<SignUp> {
)),
SizedBox(
height: 05,
height:MediaQuery.of(context).size.height * .05,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
textCapitalization: TextCapitalization.sentences,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration(Icons.person,'Enter Name'),
),
), //name
const SizedBox(
height: 5,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
padding: const EdgeInsets.all(10),
child: DropdownButtonFormField(
// Initial Value
value: genderUnit,
isExpanded: true,
decoration: const InputDecoration(
filled: true,
fillColor: Colors.white,
prefixIcon: Icon(
Icons.female,
color: primaryColor,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
@ -223,10 +208,8 @@ class _SignUpState extends State<SignUp> {
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Units',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
labelText: 'Select Gender',
labelStyle: TextStyle(color: Colors.black)
),
hint: Text('Units'),
@ -253,74 +236,19 @@ class _SignUpState extends State<SignUp> {
});
},
),),
const SizedBox(
height: 5,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.phone,
maxLength: 10,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone_android,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter Mobile Number',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
decoration: textFormFieldDecoration(Icons.phone_android,'Enter Mobile Number'),
),
), //mobile
/* const SizedBox(
height: 5,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: emailController,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.email,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter your email',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),*/
const SizedBox(
height: 5,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
GestureDetector(
child: Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: userAddressCapturingController,
@ -428,24 +356,7 @@ class _SignUpState extends State<SignUp> {
},
keyboardType: TextInputType.streetAddress,
readOnly: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on_rounded,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Click to select address(map)',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
decoration:textFormFieldDecoration(Icons.location_on_rounded,'Click to select address(map)'),
),
),
@ -453,56 +364,32 @@ class _SignUpState extends State<SignUp> {
{
},*///address
),//address capturing
const SizedBox(
height: 5,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: userAddressDescriptionController,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.plagiarism_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Address Description (Ex: Flat No)',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),//address description
decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'),
const SizedBox(
height: 5,
),
),//address description
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
obscureText: isPwdObscureText,
controller: passwordController,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Create Password',
prefixIcon: const Icon(
Icons.lock,
color: primaryColor,
color: greyColor,
),
labelStyle: const TextStyle(
color: greyColor, //<-- SEE HERE
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
@ -526,17 +413,14 @@ class _SignUpState extends State<SignUp> {
),
),
), //pwd
const SizedBox(
height: 5,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width:MediaQuery.of(context).size.width * .99,
height: 55,
padding: const EdgeInsets.fromLTRB(3, 0, 3, 0),
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (nameController.text != '' &&
@ -615,7 +499,7 @@ class _SignUpState extends State<SignUp> {
const Text(
'Are you a Member?',
style: TextStyle(
color: primaryColor,
color: Colors.white,
),
),
TextButton(
@ -623,7 +507,7 @@ class _SignUpState extends State<SignUp> {
'Login?',
style: TextStyle(
fontSize: 20,
color: greyColor,
color: Colors.white,
decoration: TextDecoration.underline,
),
),
@ -639,6 +523,7 @@ class _SignUpState extends State<SignUp> {
),
],
),
)
)),
),
])), );

@ -73,7 +73,7 @@ class _SplashScreenState extends State<SplashScreen> {
children: <Widget>[
Container(
decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/splashscreen.png"), fit: BoxFit.cover,),
image: DecorationImage(image: AssetImage("images/splashscreen.png"), fit: BoxFit.fill,),
),
),

@ -1,4 +1,6 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -47,12 +49,14 @@ class _UpdateprofileState extends State<UpdateProfile> {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
AppSettings.updatedImage = imageTemp;
AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
});
//uploadProfileApi(image.path);
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
@ -63,33 +67,19 @@ class _UpdateprofileState extends State<UpdateProfile> {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
AppSettings.updatedImage = imageTemp;
AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
});
//uploadProfileApi(image.path);
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future<void> uploadProfileApi(image) async {
var formData = new Map<String, dynamic>();
/* formData = FormData.fromMap({
"username" : "John",
"password" : "123456",
"device-type" : "Android"
});*/
var payload = new Map<String, dynamic>();
payload["formData"] = image.toString();
var response1 = await AppSettings.updateProfilePicture(payload);
print(response1);
}
@override
Widget build(BuildContext context) {
@ -128,8 +118,8 @@ class _UpdateprofileState extends State<UpdateProfile> {
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file
fit: BoxFit.cover)),
image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ? NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
showModalBottomSheet<void>(

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class EditMedicineTimings extends StatefulWidget {
const EditMedicineTimings({Key? key}) : super(key: key);
@override
State<EditMedicineTimings> createState() => _EditMedicineTimingsState();
}
class _EditMedicineTimingsState extends State<EditMedicineTimings> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

@ -0,0 +1,40 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/report_my_self.dart';
class HowAreYouFellingToday extends StatefulWidget {
const HowAreYouFellingToday({Key? key}) : super(key: key);
@override
State<HowAreYouFellingToday> createState() => _HowAreYouFellingTodayState();
}
class _HowAreYouFellingTodayState extends State<HowAreYouFellingToday> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('How are you feeling today?'),
body: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: TextButton(
child: const Text(
'Report a problem!',
style: TextStyle(fontSize: 15,
decoration: TextDecoration.underline,color: greyColor),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ReportMySelf()),
);
//signup screen
},
),
),
),
);
}
}

@ -5,9 +5,16 @@ class PharmaciesModel {
String pharmacy_name = '';
String status='';
String picture='';
String contact_number='';
String pharmacy_address='';
String pharmacy_id='';
String registration_number='';
String description='';
String starting_price='';
Color text_color=Colors.black;
double lat=0;
double lng=0;
bool isChecked=false;
PharmaciesModel();
@ -15,7 +22,13 @@ class PharmaciesModel {
PharmaciesModel rtvm = new PharmaciesModel();
rtvm.pharmacy_name = json['pharmacyname'] ?? '';
rtvm.picture = json['pharmacyname'] ?? '';
rtvm.pharmacy_id = json['pharmacyId'] ?? '';
rtvm.contact_number = json['phone'] ?? '';
rtvm.pharmacy_address =json['profile']['pharmacy_address'] ?? '';
rtvm.registration_number = json['registration_number'] ?? '';
rtvm.description = json['description'] ?? '';
rtvm.starting_price = json['startingPrice'] ?? '';
rtvm.picture = json['picture'] ?? '';
rtvm.status = json['status'] ?? '';
rtvm.lat = json['latitude'] ?? 0;
rtvm.lng = json['longitude'] ??0;

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
class PrescriptionsModel {
String prescription_name = '';
String patient_name='';
String prescription_url='';
String age='';
String gender='';
String patient_type='';
PrescriptionsModel();
factory PrescriptionsModel.fromJson(Map<String, dynamic> json){
PrescriptionsModel rtvm = new PrescriptionsModel();
rtvm.prescription_name = json['name'] ?? '';
rtvm.patient_type = json['patientType'] ?? '';
rtvm.prescription_url = json['pictureUrl'][0] ?? '';
return rtvm;
}
}

@ -364,6 +364,7 @@ class _MyMedicineTimingsState extends State<MyMedicineTimings> {
onPrimary: Colors.white, // foreground
),
onPressed: () async {
editTimingsDialog();
},
child: const Text('Edit'),

@ -1,222 +0,0 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:geolocator/geolocator.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/pharmacies.dart';
import 'package:image_picker/image_picker.dart';
class Prescriptions extends StatefulWidget {
const Prescriptions({Key? key}) : super(key: key);
@override
State<Prescriptions> createState() => _PrescriptionsState();
}
class _PrescriptionsState extends State<Prescriptions> {
final ImagePicker _picker = ImagePicker();
String Url='';
List<PharmaciesModel> pharmaciesList = [];
List<PharmaciesModel> FilteredList = [];
bool isSupplierDataLoading=false;
bool isSereverIssue = false;
double lat=0;
double lng=0;
String userAddress='';
String dropdownArea = '2';
//String dropdownType = 'Tank';
var AreaItems = [
'2',
'5',
'10',
'25',
'50',
'100'
];
Future<void> getAllPharmaciesData(var distance) async {
try {
var pharmacyResponse = await AppSettings.getAllpharmacies();
setState(() {
pharmaciesList =
((jsonDecode(pharmacyResponse)['data']) as List).map((dynamic model) {
return PharmaciesModel.fromJson(model);
}).toList();
FilteredList=[];
pharmaciesList.forEach((element) async{
var distanceInM;
if(distance=='2'){
distanceInM=2000;
}
else if(distance=='5'){
distanceInM=5000;
}
else if(distance=='10'){
distanceInM=10000;
}
else if(distance=='25'){
distanceInM=25000;
}
else if(distance=='50'){
distanceInM=50000;
}
else if(distance=='100'){
distanceInM=100000;
}
double distanceInMeters = await Geolocator.distanceBetween(element.lat,element.lng,lat,lng);
if(distanceInMeters<=distanceInM){
FilteredList.add(element);
}
});
//FilteredList=suppliersList.where((product) => product.address.toString().toUpperCase()=='SUMP').toList();
isSupplierDataLoading = false;
});
} catch (e) {
setState(() {
isSupplierDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
lat=AppSettings.userLatitude;
lng=AppSettings.userLongitude;
userAddress=AppSettings.userAddress;
getAllPharmaciesData(dropdownArea);
super.initState();
}
Future pickImageFromGallery() async {
try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
var res=await AppSettings.uploadImageHTTPForPrescriptions(image);
print(jsonDecode(res));
setState(() {
Url = jsonDecode(res)['picture'];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future takeImageFromCamera() async {
try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
var res=await AppSettings.uploadImageHTTPForPrescriptions(image);
print(jsonDecode(res));
setState(() {
Url = jsonDecode(res)['picture'];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
/**/
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Prescriptions'),
body: Container(
child: Column(
children: [
Padding(
padding: EdgeInsets.all(10),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async{
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: greyColor,
),
onTap: () async {
await takeImageFromCamera();
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context)
.size
.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: greyColor,
),
onTap: () async {
await pickImageFromGallery();
Navigator.pop(context);
},
),
],
),
),
);
});
},
child: const Text('Select image'),
),
),
Container(
width: MediaQuery.of(context).size.width * .18,
height:
MediaQuery.of(context).size.height * .10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(Url) as ImageProvider, // picked file
fit: BoxFit.contain)),
),
],
)
),
);
}
}

@ -0,0 +1,408 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:image_picker/image_picker.dart';
import 'package:photo_view/photo_view.dart';
import 'package:pinch_zoom/pinch_zoom.dart';
class AddPrescription extends StatefulWidget {
const AddPrescription({Key? key}) : super(key: key);
@override
State<AddPrescription> createState() => _AddPrescriptionState();
}
class _AddPrescriptionState extends State<AddPrescription> {
final ImagePicker _picker = ImagePicker();
String Url = '';
final _transformationController = TransformationController();
TapDownDetails _doubleTapDetails=TapDownDetails();
TextEditingController prescriptionNameController = TextEditingController();
TextEditingController patientNameController = TextEditingController();
TextEditingController patientAgeController = TextEditingController();
String? prescriptionFor;
String? gender;
Future pickImageFromGallery() async {
try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future takeImageFromCamera() async {
try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Widget zoomPhoto(var imageUrl){
return Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
)
);
}
showPicDialog(var imageUrl){
return showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return AlertDialog(
title: const Text(''),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * .10,
height: MediaQuery.of(context).size.height * .50,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
)
],
),
),
actions: <Widget>[
TextButton(
child: Text('Close', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
},
);
}
void _handleDoubleTap() {
if (_transformationController.value != Matrix4.identity()) {
_transformationController.value = Matrix4.identity();
} else {
final position = _doubleTapDetails.localPosition;
// For a 3x zoom
_transformationController.value = Matrix4.identity()
..translate(-position.dx * 2, -position.dy * 2)
..scale(3.0);
// Fox a 2x zoom
// ..translate(-position.dx, -position.dy)
// ..scale(2.0);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Add Prescription'),
body:SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCamera();
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width * .20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGallery();
Navigator.pop(context);
},
),
],
),
),
);
});
},
child: const Text('Select image'),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Visibility(
visible: Url != '',
child: GestureDetector(
child:
/*,*/
/*Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
child: PhotoView(
imageProvider: NetworkImage(Url) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
),*/
Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(Url) as ImageProvider, // picked file
fit: BoxFit.fill)),
),
onTap: (){
showPicDialog(Url);
},
)
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: prescriptionNameController,
decoration: textFormFieldDecoration(Icons.edit,'Enter Prescription name'),
),
),
Row(
children: [
Expanded(child: RadioListTile(
title: Text("For Yourself"),
value: "self",
groupValue: prescriptionFor,
activeColor: primaryColor,
onChanged: (value){
setState(() {
prescriptionFor = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("For Family"),
value: "others",
groupValue: prescriptionFor,
activeColor: primaryColor,
onChanged: (value){
setState(() {
prescriptionFor = value.toString();
});
},
),),
],
),
Visibility(
visible:prescriptionFor.toString().toLowerCase()=='others' ,
child: Container(
child: TextFormField(
cursorColor: greyColor,
controller: patientNameController,
decoration: textFormFieldDecoration(Icons.person,'Enter patient name'),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:prescriptionFor.toString().toLowerCase()=='others' ,
child: Container(
child: TextFormField(
cursorColor: greyColor,
keyboardType: TextInputType.number,
controller: patientAgeController,
decoration: textFormFieldDecoration(Icons.person,'Enter patient age'),
),
),),
Visibility(
visible:prescriptionFor.toString().toLowerCase()=='others' ,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: TextStyle(fontSize: 10)),
value: "male",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style: TextStyle(fontSize: 10),),
value: "female",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: TextStyle(fontSize: 10)),
value: "other",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width:double.infinity,
height: MediaQuery.of(context).size.height * .06,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async{
if(Url!=''&& prescriptionNameController.text!=''&&prescriptionFor!=''){
String _name='';
String _age='';
String? _gender='';
if(prescriptionFor.toString().toLowerCase()=='others'){
if(patientNameController!=''&& patientAgeController.text!=''&&gender!=''){
_name=patientNameController.text;
_age=patientAgeController.text;
_gender=gender;
}
else{
AppSettings.longFailedToast('Please enter details');
}
}
else{
_name=AppSettings.userName;
_age=AppSettings.age;
_gender=AppSettings.gender;
}
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){
var payload = new Map<String, dynamic>();
payload["name"] = prescriptionNameController.text.toString();
payload["pictureUrl"] = Url.toString();
payload["patientType"] = prescriptionFor.toString();
payload["others"] ={
"name": _name,
"age": int.parse(_age),
"gender": _gender.toString().toLowerCase()
};
bool uploadStatus = await AppSettings.addPrescription(payload);
try{
if(uploadStatus){
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longSuccessToast('Prescription added successfully');
}
else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('Fail to add prescription details');
}
}
catch(e){
print(e);
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('Fail to add prescription details');
}
}
else{
AppSettings.longFailedToast('Please check internet');
}
}
else{
AppSettings.longFailedToast('Please upload image');
}
},
child: const Text('Upload'),
)),
],
),
)) ,
)
);
}
}

@ -0,0 +1,693 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:geolocator/geolocator.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:healthcare_user/models/pharmacies_model.dart';
import 'package:healthcare_user/prescriptions/add_prescriptions.dart';
import 'package:image_picker/image_picker.dart';
import 'package:healthcare_user/models/prescriptions_model.dart';
class Prescriptions extends StatefulWidget {
const Prescriptions({Key? key}) : super(key: key);
@override
State<Prescriptions> createState() => _PrescriptionsState();
}
class _PrescriptionsState extends State<Prescriptions> {
final ImagePicker _picker = ImagePicker();
String Url = '';
List<PharmaciesModel> pharmaciesList = [];
List<PrescriptionsModel> prescriptionsList = [];
List<PharmaciesModel> FilteredList = [];
bool isPharmacyDataLoading = false;
bool isPrescriptionsData = false;
bool isSereverIssue = false;
double lat = 0;
double lng = 0;
String userAddress = '';
String dropdownArea = '2';
//String dropdownType = 'Tank';
var AreaItems = ['2', '5', '10', '25', '50', '100'];
List pharmaciesCheckboxes = [];
Future<void> getAllPharmaciesData(var distance) async {
isPharmacyDataLoading=true;
try {
var pharmacyResponse = await AppSettings.getAllpharmacies();
setState(() {
pharmaciesList = ((jsonDecode(pharmacyResponse)['data']) as List)
.map((dynamic model) {
return PharmaciesModel.fromJson(model);
}).toList();
FilteredList = [];
pharmaciesList.forEach((element) async {
var distanceInM;
if (distance == '2') {
distanceInM = 2000;
} else if (distance == '5') {
distanceInM = 5000;
} else if (distance == '10') {
distanceInM = 10000;
} else if (distance == '25') {
distanceInM = 25000;
} else if (distance == '50') {
distanceInM = 50000;
} else if (distance == '100') {
distanceInM = 100000;
}
double distanceInMeters = await Geolocator.distanceBetween(
element.lat, element.lng, lat, lng);
if (distanceInMeters <= distanceInM) {
FilteredList.add(element);
}
});
isPharmacyDataLoading = false;
});
} catch (e) {
setState(() {
isPharmacyDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getAllPrescriptions() async {
isPrescriptionsData=true;
try {
var response = await AppSettings.getAllPrescriptions();
setState(() {
prescriptionsList = ((jsonDecode(response)) as List)
.map((dynamic model) {
return PrescriptionsModel.fromJson(model);
}).toList();
isPrescriptionsData = false;
});
} catch (e) {
setState(() {
isPrescriptionsData = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
lat = AppSettings.userLatitude;
lng = AppSettings.userLongitude;
userAddress = AppSettings.userAddress;
getAllPrescriptions();
//getAllPharmaciesData(dropdownArea);
super.initState();
}
Future pickImageFromGallery() async {
try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future takeImageFromCamera() async {
try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPForPrescriptions(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
Url = jsonDecode(res)['pictures'][0];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Widget _pharamciesData() {
if (FilteredList.length != 0) {
return Column(
children: [
GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: FilteredList.length,
itemBuilder: (context, index) {
return Card(
elevation: 2.0,
child: CheckboxListTile(
title: Padding(
padding: EdgeInsets.fromLTRB(10, 10, 0, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width * .18,
height:
MediaQuery.of(context).size.height * .10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: FilteredList[index].picture == ''
? AssetImage("images/logo.png")
: NetworkImage(
FilteredList[index].picture)
as ImageProvider, // picked file
fit: BoxFit.contain)),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
width:
MediaQuery.of(context).size.width * .70,
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
FilteredList[index]
.pharmacy_name
.toUpperCase(),
style: wrapTextStyleBlack()),
SizedBox(
height: 10,
),
Text(
FilteredList[index]
.contact_number
.toUpperCase(),
style: wrapTextStyleBlack()),
/*Visibility(
visible: FilteredList[index].supplier_alternate_phone_number!='',
child: Text(
FilteredList[index]
.supplier_alternate_phone_number
.toUpperCase(),
style: wrapTextStyleBlack()),),*/
SizedBox(
height: 10,
),
Text(
FilteredList[index]
.pharmacy_address
.toUpperCase(),
style: wrapTextStyleBlack()),
Visibility(
visible:
FilteredList[index].description !=
'',
child: SizedBox(
height: 10,
),
),
Visibility(
visible:
FilteredList[index].description !=
'',
child: Text(
FilteredList[index]
.description
.toUpperCase(),
style: wrapTextStyleBlack()),
),
SizedBox(
height: 10,
),
/*Text(
FilteredList[index]
.starting_price
.toUpperCase(),
style: wrapTextStyleBlack()),
SizedBox(height: 10,),*/
],
)),
),
],
)
),
checkColor: Colors.white,
activeColor: primaryColor,
value: FilteredList[index].isChecked,
onChanged: (val) {
setState(
() {
FilteredList[index].isChecked = val!;
},
);
if (FilteredList[index].isChecked) {
pharmaciesCheckboxes.add({
'pharmacyId':
FilteredList[index]
.pharmacy_id,
});
} else {
pharmaciesCheckboxes.removeWhere((e) =>
e['pharmacyId']
.toString()
.toUpperCase() ==
FilteredList[index]
.pharmacy_id
.toString()
.toUpperCase());
}
},
),
);
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,//.size.width * .33,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height /7)),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
if(Url!=''&&pharmaciesCheckboxes.isNotEmpty){
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["picture"] = Url.toString();
payload["pharmacies"] = pharmaciesCheckboxes;
bool status = await AppSettings.uploadPrescription(payload);
try {
if (status) {
Navigator.of(context, rootNavigator: true).pop();
Url='';
pharmaciesCheckboxes = [];
AppSettings.longSuccessToast(
"Prescription uploaded Successfully");
// Navigator.pop(context);
getAllPharmaciesData(dropdownArea);
/*
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ConnectionsView()),
);*/
} else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast(
"Failed to upload prescription");
}
} catch (exception) {
AppSettings.longFailedToast("Failed to upload prescription");
print(exception);
}
}
else{
AppSettings.longFailedToast('Please select image and pharmacies' );
}
},
child: const Text('Upload'),
)
],
);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: isSereverIssue
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image: AssetImage('images/serverissue.png'),
// height: MediaQuery.of(context).size.height * .10,
),
SizedBox(
height: 20,
),
Text(
'There is an issue at server please try after some time',
style: serverIssueTextStyle(),
),
],
)
: userAddress == ''
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/*Image(
image: AssetImage('images/resourceblue.pngs'),
// height: MediaQuery.of(context).size.height * .10,
),*/
Icon(
Icons.location_on_outlined,
color: primaryColor,
size: 40,
),
SizedBox(
height: 20,
),
Text(
'Please select location to see near by pharmacies',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
),
),
],
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image: AssetImage('images/no_data.png'),
// height: MediaQuery.of(context).size.height * .10,
),
SizedBox(
height: 20,
),
Text(
'No Pharmacies',
style: serverIssueTextStyle(),
),
],
),
));
}
}
Widget _allPrescriptions(){
if (prescriptionsList.length != 0) {
return Column(
children: [
GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: FilteredList.length,
itemBuilder: (context, index) {
return Card(
elevation: 2.0,
child: CheckboxListTile(
title: Padding(
padding: EdgeInsets.fromLTRB(10, 10, 0, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width * .18,
height:
MediaQuery.of(context).size.height * .10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: FilteredList[index].picture == ''
? AssetImage("images/logo.png")
: NetworkImage(
FilteredList[index].picture)
as ImageProvider, // picked file
fit: BoxFit.contain)),
),
SizedBox(
width: 5,
),
Expanded(
child: Container(
width:
MediaQuery.of(context).size.width * .70,
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
FilteredList[index]
.pharmacy_name
.toUpperCase(),
style: wrapTextStyleBlack()),
SizedBox(
height: 10,
),
Text(
FilteredList[index]
.contact_number
.toUpperCase(),
style: wrapTextStyleBlack()),
/*Visibility(
visible: FilteredList[index].supplier_alternate_phone_number!='',
child: Text(
FilteredList[index]
.supplier_alternate_phone_number
.toUpperCase(),
style: wrapTextStyleBlack()),),*/
SizedBox(
height: 10,
),
Text(
FilteredList[index]
.pharmacy_address
.toUpperCase(),
style: wrapTextStyleBlack()),
Visibility(
visible:
FilteredList[index].description !=
'',
child: SizedBox(
height: 10,
),
),
Visibility(
visible:
FilteredList[index].description !=
'',
child: Text(
FilteredList[index]
.description
.toUpperCase(),
style: wrapTextStyleBlack()),
),
SizedBox(
height: 10,
),
/*Text(
FilteredList[index]
.starting_price
.toUpperCase(),
style: wrapTextStyleBlack()),
SizedBox(height: 10,),*/
],
)),
),
],
)
),
checkColor: Colors.white,
activeColor: primaryColor,
value: FilteredList[index].isChecked,
onChanged: (val) {
setState(
() {
FilteredList[index].isChecked = val!;
},
);
if (FilteredList[index].isChecked) {
pharmaciesCheckboxes.add({
'pharmacyId':
FilteredList[index]
.pharmacy_id,
});
} else {
pharmaciesCheckboxes.removeWhere((e) =>
e['pharmacyId']
.toString()
.toUpperCase() ==
FilteredList[index]
.pharmacy_id
.toString()
.toUpperCase());
}
},
),
);
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,//.size.width * .33,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height /7)),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
if(Url!=''&&pharmaciesCheckboxes.isNotEmpty){
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["picture"] = Url.toString();
payload["pharmacies"] = pharmaciesCheckboxes;
bool status = await AppSettings.uploadPrescription(payload);
try {
if (status) {
Navigator.of(context, rootNavigator: true).pop();
Url='';
pharmaciesCheckboxes = [];
AppSettings.longSuccessToast(
"Prescription uploaded Successfully");
// Navigator.pop(context);
getAllPharmaciesData(dropdownArea);
/*
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ConnectionsView()),
);*/
} else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast(
"Failed to upload prescription");
}
} catch (exception) {
AppSettings.longFailedToast("Failed to upload prescription");
print(exception);
}
}
else{
AppSettings.longFailedToast('Please select image and pharmacies' );
}
},
child: const Text('Upload'),
)
],
);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: isSereverIssue
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image: AssetImage('images/serverissue.png'),
// height: MediaQuery.of(context).size.height * .10,
),
SizedBox(
height: 20,
),
Text(
'There is an issue at server please try after some time',
style: serverIssueTextStyle(),
),
],
)
: userAddress == ''
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/*Image(
image: AssetImage('images/resourceblue.pngs'),
// height: MediaQuery.of(context).size.height * .10,
),*/
Icon(
Icons.location_on_outlined,
color: primaryColor,
size: 40,
),
SizedBox(
height: 20,
),
Text(
'Please select location to see near by pharmacies',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
),
),
],
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image(
image: AssetImage('images/no_data.png'),
// height: MediaQuery.of(context).size.height * .10,
),
SizedBox(
height: 20,
),
Text(
'No Pharmacies',
style: serverIssueTextStyle(),
),
],
),
));
}}
/**/
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Prescriptions'),
body: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AddPrescription()),
);
},
child: const Text('Add'),
),
),
_allPrescriptions(),
],
)),
);
}
}

@ -0,0 +1,219 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:healthcare_user/common/settings.dart';
import 'package:image_picker/image_picker.dart';
class ReportMySelf extends StatefulWidget {
const ReportMySelf({Key? key}) : super(key: key);
@override
State<ReportMySelf> createState() => _ReportMySelfState();
}
class _ReportMySelfState extends State<ReportMySelf> {
TextEditingController problemNameController = TextEditingController();
TextEditingController descriptionController = TextEditingController();
final ImagePicker _picker = ImagePicker();
String videoUrl='';
Future takeVideoFromCamera() async {
try {
final image = await _picker.pickVideo(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadVideoInReportMySelf(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
videoUrl = jsonDecode(res)['picture'];
});
} on PlatformException catch (e) {
print('Failed to pick video: $e');
}
}
Future pickVideoFromGallery() async {
try {
final image = await _picker.pickVideo(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadVideoInReportMySelf(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
videoUrl = jsonDecode(res)['picture'];
});
} on PlatformException catch (e) {
print('Failed to pick video: $e');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Report MySelf'),
body: Container(
child: Padding(
padding: EdgeInsets.all(10),
child:Column(
children: [
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: problemNameController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color:primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter problem name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
const SizedBox(
height: 15,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: descriptionController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.description,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color:primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
Row(
children: [
IconButton(
icon: Icon(
Icons.audio_file,
color: primaryColor,
),
onPressed: () {
},
),
SizedBox(width: 10,),
IconButton(
icon: Icon(
Icons.video_camera_back_rounded,
color: primaryColor,
),
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: greyColor,
),
onTap: () async {
await takeVideoFromCamera();
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width * .20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: greyColor,
),
onTap: () async {
await pickVideoFromGallery();
Navigator.pop(context);
},
),
],
),
),
);
});
},
),
SizedBox(width: 10,),
IconButton(
icon: Icon(
Icons.image,
color: primaryColor,
),
onPressed: () {
},
),
],
),
Visibility(
visible: videoUrl != '',
child: Padding(
padding: EdgeInsets.fromLTRB(10,0,0,0),
child: Container(
width: MediaQuery.of(context).size.width * .18,
height: MediaQuery.of(context).size.height * .10,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(videoUrl) as ImageProvider, // picked file
fit: BoxFit.contain)),
),
),
),
],
),
),
),
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -225,6 +225,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.0+1"
dots_indicator:
dependency: "direct dev"
description:
name: dots_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
fake_async:
dependency: transitive
description:
@ -833,6 +840,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
photo_view:
dependency: "direct dev"
description:
name: photo_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0"
pinch_zoom:
dependency: "direct dev"
description:
name: pinch_zoom
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
platform:
dependency: transitive
description:

@ -62,10 +62,13 @@ dev_dependencies:
carousel_slider: ^4.2.1
fluttertoast: ^8.2.2
day_night_time_picker: ^1.3.0
photo_view: ^0.14.0
pinch_zoom: ^1.0.0
dots_indicator: ^3.0.0
flutter_icons:
image_path_ios: 'images/logo.png'
image_path_android: 'images/logo.png'
image_path_ios: 'images/appicon.png'
image_path_android: 'images/appicon.png'
android: true
ios: true
remove_alpha_ios: true

Loading…
Cancel
Save