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/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:healthcare_user/common/updateprofile.dart'; import 'package:healthcare_user/common/updateprofile.dart';
import 'package:healthcare_user/emergency.dart'; import 'package:healthcare_user/emergency.dart';
import 'package:healthcare_user/howareufeeling_today.dart';
import 'package:healthcare_user/invitations.dart'; import 'package:healthcare_user/invitations.dart';
import 'package:healthcare_user/medicines.dart'; import 'package:healthcare_user/medicines.dart';
import 'package:healthcare_user/my_health.dart'; import 'package:healthcare_user/my_health.dart';
import 'package:healthcare_user/my_medicine_timings.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/reports.dart';
import 'package:healthcare_user/seekopinion.dart'; import 'package:healthcare_user/seekopinion.dart';
import 'package:healthcare_user/common/settings.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 'dart:ui' as ui;
import 'login.dart'; import 'login.dart';
import 'dart:io'; import 'dart:io';
import 'package:dots_indicator/dots_indicator.dart';
class Dashboard extends StatefulWidget { class Dashboard extends StatefulWidget {
const Dashboard({super.key}); const Dashboard({super.key});
@ -35,7 +38,7 @@ class _DashboardState extends State<Dashboard> {
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
bool isTablet = false; bool isTablet = false;
bool isPhone = true; bool isPhone = true;
int currentIndex = 0;
final double devicePixelRatio = ui.window.devicePixelRatio; final double devicePixelRatio = ui.window.devicePixelRatio;
static final ui.Size size1 = ui.window.physicalSize; static final ui.Size size1 = ui.window.physicalSize;
final double width = size1.width; final double width = size1.width;
@ -63,51 +66,38 @@ class _DashboardState extends State<Dashboard> {
"images/emergency.png" "images/emergency.png"
]; ];
gridOntap(int ind){ gridOntap(int ind) {
if (ind == 0) {
if(ind==0){
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => const SeekOpinion()),
builder: (context) => const SeekOpinion()),
); );
} } else if (ind == 1) {
else if(ind==1){
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => const Reports()),
builder: (context) => const Reports()),
); );
} } else if (ind == 2) {
else if(ind==2){
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => const Prescriptions()),
builder: (context) => const Prescriptions()),
); );
} } else if (ind == 3) {
else if(ind==3){
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => const Medicines()),
builder: (context) => const Medicines()),
); );
} } else if (ind == 4) {
else if(ind==4){
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => const Invitations()),
builder: (context) => const Invitations()),
); );
} } else if (ind == 5) {
else if(ind==5){
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => const Emergency()),
builder: (context) => const Emergency()),
); );
} }
} }
Widget _dashBoard() { Widget _dashBoard() {
@ -152,28 +142,284 @@ class _DashboardState extends State<Dashboard> {
}).toList(), }).toList(),
), ),
SizedBox(height: 5), SizedBox(height: 5),
Expanded(child: Container( Expanded(
padding: EdgeInsets.all(12.0), child: Container(
child: GridView.builder( padding: EdgeInsets.all(12.0),
itemCount: images.length, child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( itemCount: images.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisCount: 3,
crossAxisSpacing: 4.0, crossAxisSpacing: 2.0,
mainAxisSpacing: 4.0,), mainAxisSpacing: 2.0,
itemBuilder: (BuildContext context, int index) { ),
return GestureDetector( itemBuilder: (BuildContext context, int index) {
onTap: (){ return GestureDetector(
gridOntap(index); onTap: () {
}, gridOntap(index);
child: Image.asset(images[index]), },
); 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 @override
void initState() { void initState() {
super.initState(); super.initState();
@ -193,12 +439,15 @@ class _DashboardState extends State<Dashboard> {
final image = await _picker.pickImage(source: ImageSource.gallery); final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.updatedImage = imageTemp; AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
}); });
//uploadProfileApi(image.path); AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $e'); print('Failed to pick image: $e');
} }
@ -209,13 +458,14 @@ class _DashboardState extends State<Dashboard> {
final image = await _picker.pickImage(source: ImageSource.camera); final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.updatedImage = imageTemp; AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
}); });
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
//uploadProfileApi(image.path);
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $e'); print('Failed to pick image: $e');
} }
@ -295,9 +545,11 @@ class _DashboardState extends State<Dashboard> {
return shouldPop!; return shouldPop!;
}, },
child: Scaffold( child: Scaffold(
backgroundColor: primaryColor,
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: AppSettings.appBar('Health Care'), appBar: AppSettings.appBar('Health Care'),
drawer: Drawer( drawer: Drawer(
backgroundColor: secondaryColor,
child: ListView( child: ListView(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
children: [ children: [
@ -319,14 +571,16 @@ class _DashboardState extends State<Dashboard> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
image: DecorationImage( image: DecorationImage(
image: (AppSettings.updatedImage != image: (AppSettings.profilePictureUrl !=
null) '' &&
? FileImage( AppSettings.profilePictureUrl !=
AppSettings.updatedImage!) 'null')
as ImageProvider ? NetworkImage(AppSettings
.profilePictureUrl)
as ImageProvider
: AssetImage( : AssetImage(
"images/profile_pic.png"), // picked file "images/profile_pic.png"), // picked file
fit: BoxFit.cover)), fit: BoxFit.fitWidth)),
), ),
onTap: () { onTap: () {
showModalBottomSheet<void>( showModalBottomSheet<void>(
@ -337,7 +591,7 @@ class _DashboardState extends State<Dashboard> {
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
GestureDetector( GestureDetector(
child: Icon( child: Icon(
@ -352,8 +606,8 @@ class _DashboardState extends State<Dashboard> {
), ),
SizedBox( SizedBox(
width: MediaQuery.of(context) width: MediaQuery.of(context)
.size .size
.width * .width *
.20, .20,
), ),
GestureDetector( GestureDetector(
@ -377,24 +631,37 @@ class _DashboardState extends State<Dashboard> {
), ),
Text( Text(
AppSettings.userName, AppSettings.userName,
style: TextStyle(color: Colors.white, fontSize: 15), style: drawerHeaderTextStyle(),
), ),
Text( Text(
AppSettings.phoneNumber, AppSettings.phoneNumber,
style: TextStyle(color: Colors.white, fontSize: 15), style: drawerHeaderTextStyle(),
), ),
Visibility( Visibility(
visible:AppSettings.email!='', visible: AppSettings.email != '',
child: Text( child: Text(
AppSettings.email, AppSettings.email,
style: TextStyle(color: Colors.white, fontSize: 15), style: drawerHeaderTextStyle(),
),), ),
Visibility( ),
visible: AppSettings.age!='', Row(
child: Text( children: [
AppSettings.age+' Yrs', Visibility(
style: TextStyle(color: Colors.white, fontSize: 15), visible: AppSettings.age != '',
),), child: Text(
AppSettings.age + ' Yrs, ',
style: drawerHeaderTextStyle(),
),
),
Visibility(
visible: AppSettings.gender != '',
child: Text(
AppSettings.gender,
style: drawerHeaderTextStyle(),
),
),
],
)
], ],
), ),
Container() Container()
@ -402,7 +669,7 @@ class _DashboardState extends State<Dashboard> {
)), )),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/editprofile.png'), image: const AssetImage('images/editprofile.png'),
height: 25, height: 25,
@ -414,7 +681,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('Edit Profile', style: TextStyle(color: primaryColor)), Text('Edit Profile', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () { onTap: () {
@ -430,7 +697,7 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/myhealth.png'), image: const AssetImage('images/myhealth.png'),
height: 25, height: 25,
@ -442,14 +709,42 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, 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: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const MyHealth()), builder: (context) => const HowAreYouFellingToday()),
); );
}, },
), ),
@ -458,7 +753,7 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/reportmyself.png'), image: const AssetImage('images/reportmyself.png'),
height: 25, height: 25,
@ -470,17 +765,23 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, 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( Divider(
color: Colors.grey, color: Colors.grey,
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/myconnections.png'), image: const AssetImage('images/myconnections.png'),
height: 25, height: 25,
@ -492,7 +793,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('My Connections', style: TextStyle(color: primaryColor)), Text('My Connections', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () {}, onTap: () {},
@ -502,7 +803,7 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/mymedicinetimings.png'), image: const AssetImage('images/mymedicinetimings.png'),
height: 25, height: 25,
@ -514,7 +815,8 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('My Medicine Timings', style: TextStyle(color: primaryColor)), Text('My Medicine Timings',
style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () { onTap: () {
@ -530,7 +832,7 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/updatepin.png'), image: const AssetImage('images/updatepin.png'),
height: 25, height: 25,
@ -542,7 +844,7 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('Update Pin', style: TextStyle(color: primaryColor)), Text('Update Pin', style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () {}, onTap: () {},
@ -552,9 +854,10 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/updatemobilenumber.png'), image:
const AssetImage('images/updatemobilenumber.png'),
height: 25, height: 25,
width: 25, width: 25,
fit: BoxFit.fill), fit: BoxFit.fill),
@ -564,7 +867,8 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('Update Mobile Number', style: TextStyle(color: primaryColor)), Text('Update Mobile Number',
style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () {}, onTap: () {},
@ -574,7 +878,7 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/updatemylocation.png'), image: const AssetImage('images/updatemylocation.png'),
height: 25, height: 25,
@ -586,7 +890,8 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, width: 10,
), ),
Text('Update My Location', style: TextStyle(color: primaryColor)), Text('Update My Location',
style: drawerListItemsTextStyle()),
], ],
), ),
onTap: () {}, onTap: () {},
@ -596,7 +901,7 @@ class _DashboardState extends State<Dashboard> {
), ),
ListTile( ListTile(
title: Row( title: Row(
children: const [ children: [
Image( Image(
image: const AssetImage('images/logout.png'), image: const AssetImage('images/logout.png'),
height: 25, height: 25,
@ -608,16 +913,17 @@ class _DashboardState extends State<Dashboard> {
const SizedBox( const SizedBox(
width: 10, 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(), onWillPop: () async => onWillPop(),
child: Scaffold( child: Scaffold(
backgroundColor: primaryColor,
body: Stack( body: Stack(
children: <Widget>[ children: <Widget>[
Container( /*Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,), image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,),
), ),
), ),*/
GestureDetector( GestureDetector(
onTap: () { onTap: () {
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
@ -96,50 +97,31 @@ class _LoginState extends State<Login> {
image: const AssetImage('images/logo.png'), image: const AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .25, height: MediaQuery.of(context).size.height * .25,
)), )),
const SizedBox( SizedBox(
height: 15, height:MediaQuery.of(context).size.height * .05,
), ),
Container( Container(
padding: const EdgeInsets.all(10),
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: mobileNumberController, controller: mobileNumberController,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: const InputDecoration( decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
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
),
),
), ),
), ),
const SizedBox( SizedBox(height:MediaQuery.of(context).size.height * .02,),
height: 15,
),
Container( Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
obscureText: isObscureText, obscureText: isObscureText,
controller: passwordController, controller: passwordController,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Password', labelText: 'Password',
prefixIcon: const Icon(Icons.password, color: greyColor,), prefixIcon: const Icon(Icons.password, color: greyColor,),
labelStyle: const TextStyle( labelStyle: const TextStyle(
color: greyColor, //<-- SEE HERE color: Colors.black, //<-- SEE HERE
), ),
border: const OutlineInputBorder( border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: primaryColor)),
@ -167,36 +149,39 @@ class _LoginState extends State<Login> {
), ),
), ),
Padding(padding: const EdgeInsets.fromLTRB(220, 10, 0,10), SizedBox(height:MediaQuery.of(context).size.height * .02,),
child: TextButton( Align(
onPressed: () { alignment: Alignment.bottomRight,
/*Navigator.push( child: Padding(padding: const EdgeInsets.fromLTRB(0, 0, 0,0),
child: TextButton(
onPressed: () {
/*Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => OtpScreen()), MaterialPageRoute(builder: (context) => OtpScreen()),
);*/ );*/
}, },
child: const Text( child: const Text(
'Forgot Password?', 'Forgot Password?',
style: TextStyle( style: TextStyle(
color: greyColor, color: Colors.white,
fontSize: 15, decoration: TextDecoration.underline,
decoration: TextDecoration.underline,
),
), ),
), ),),
),), ),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container( Container(
width: 400, width:double.infinity,
height: 50, height: MediaQuery.of(context).size.height * .06,
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: primaryColor, // background primary: buttonColors, // background
onPrimary: Colors.white, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () async{ onPressed: () async{
if (mobileNumberController.text != '' || if (mobileNumberController.text != '' &&
passwordController.text != '') { passwordController.text != '') {
AppSettings.preLoaderDialog(context); AppSettings.preLoaderDialog(context);
@ -254,14 +239,13 @@ class _LoginState extends State<Login> {
const Text( const Text(
'Not a Member Yet?', 'Not a Member Yet?',
style: TextStyle( style: TextStyle(
color: primaryColor, color: Colors.white,
), ),
), ),
TextButton( TextButton(
child: const Text( child: const Text(
'Sign Up', 'Sign Up',
style: TextStyle(fontSize: 15, style: TextStyle(decoration: TextDecoration.underline,color: Colors.white),
decoration: TextDecoration.underline,color: greyColor),
), ),
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(

@ -230,7 +230,15 @@ class OtpInput extends StatelessWidget {
maxLength: 1, maxLength: 1,
cursorColor: Theme.of(context).primaryColor, cursorColor: Theme.of(context).primaryColor,
decoration: const InputDecoration( 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: '', counterText: '',
hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)), hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)),
onChanged: (value) { onChanged: (value) {

@ -13,7 +13,10 @@ import 'dart:async';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:fluttertoast/fluttertoast.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 greyColor = Color(0XFF8F8E8E);
const Color textFieldStartColor = Colors.grey; const Color textFieldStartColor = Colors.grey;
const Color screenBackgroundColor = Color(0XFFEAF6FF); const Color screenBackgroundColor = Color(0XFFEAF6FF);
@ -21,10 +24,10 @@ const Color screenBackgroundColord = Colors.black12;
const Color dashboardbackground = Color(0XFFF5F5F5); const Color dashboardbackground = Color(0XFFF5F5F5);
//Color AppBarGradient_1 = Color(0XFF1258F6); //Color AppBarGradient_1 = Color(0XFF1258F6);
Color AppBarGradient_1 = Color(0XFF1786A3); Color AppBarGradient_1 = Color(0XFF68A85D);
TextStyle PreloaderText() { TextStyle PreloaderText() {
return TextStyle(color: Color(0XFF1786A3)); return TextStyle(color: Color(0XFF68A85D));
} }
TextStyle labelTextStyle() { TextStyle labelTextStyle() {
@ -66,8 +69,7 @@ Text dimensionSuffixText() {
TextStyle dashboardTextStyle() { TextStyle dashboardTextStyle() {
return TextStyle( return TextStyle(
color: primaryColor, color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
); );
} }
@ -82,22 +84,59 @@ TextStyle labelTextStyleBold() {
TextStyle serverIssueTextStyle() { TextStyle serverIssueTextStyle() {
return TextStyle(color: Colors.red, fontSize: 15); return TextStyle(color: Colors.red, fontSize: 15);
} }
TextStyle bottomSheetValuesTextStyle() { TextStyle bottomSheetValuesTextStyle() {
return TextStyle(fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); return TextStyle(fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
} }
TextStyle wrapTextStyle() { TextStyle wrapTextStyle() {
return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
} }
TextStyle wrapTextStyleBlack() { TextStyle wrapTextStyleBlack() {
return TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); return TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
} }
TextStyle withoutWrapTextStyle() { TextStyle withoutWrapTextStyle() {
return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,); return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,);
} }
TextStyle bmiTextStyle() { TextStyle bmiTextStyle() {
return TextStyle(color:primaryColor,fontSize: 16,fontWeight: FontWeight.bold,); 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>(); final GlobalKey<State> preloaderWindowKey = new GlobalKey<State>();
Future<void> preloaderWindow(BuildContext context) async { Future<void> preloaderWindow(BuildContext context) async {
try { try {
@ -112,6 +151,7 @@ class AppSettings {
static String userAddress = ''; static String userAddress = '';
static String email = ''; static String email = '';
static String age = ''; static String age = '';
static String gender = '';
static String phoneNumber = ''; static String phoneNumber = '';
static String accessToken = ''; static String accessToken = '';
static String customerId = ''; static String customerId = '';
@ -154,6 +194,13 @@ class AppSettings {
static String getMedicineTimingsUrl = host + 'getmedicineztiming'; static String getMedicineTimingsUrl = host + 'getmedicineztiming';
static String prescriptionUploadPicUrl = host + 'uploads-precription'; static String prescriptionUploadPicUrl = host + 'uploads-precription';
static String getAllpharmaciesDataUrl = host + 'getAllPharmacylist'; 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 File? updatedImage;
static String image = ''; static String image = '';
static String profilePictureUrl = '';
static var api = { static var api = {
'signIn': host + '/login', 'signIn': host + '/login',
}; };
@ -510,7 +558,6 @@ class AppSettings {
phoneNumber = _response['phone']; phoneNumber = _response['phone'];
email = _response['emails'][0]['email']; email = _response['emails'][0]['email'];
age = _response['age'].toString(); age = _response['age'].toString();
await saveData('phone', _response['phone'], 'STRING'); await saveData('phone', _response['phone'], 'STRING');
await saveData('email', _response['emails'][0]['email'], 'STRING'); await saveData('email', _response['emails'][0]['email'], 'STRING');
await saveData('username', _response['username'], 'STRING'); await saveData('username', _response['username'], 'STRING');
@ -611,6 +658,15 @@ class AppSettings {
var res = await request.send(); var res = await request.send();
return res; 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 { 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 { static Future<String> getAllpharmacies() async {
var uri = Uri.parse(getAllpharmaciesDataUrl); var uri = Uri.parse(getAllpharmaciesDataUrl);
//uri = uri.replace(query: 'customerId=$customerId'); //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*/ /*Apis ends here*/
//save data local //save data local
@ -712,16 +876,18 @@ class AppSettings {
await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE'); await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE');
await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE'); await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE');
await saveData('fcmId', input['simplydata']['fcmId'], 'STRING'); 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'); //await saveData('age', input['simplydata']['age'], 'STRING');
//latitude,longitude //latitude,longitude
await loadDataFromMemory(); await loadDataFromMemory();
} }
static Future<void> saveProfile(dynamic image) async { /* static Future<void> saveProfile(dynamic image) async {
// save login name information // save login name information
await saveData('profile', image.toString(), 'STRING'); await saveData('profile', image.toString(), 'STRING');
//await loadDataFromMemory(); //await loadDataFromMemory();
} }*/
static Uint8List convertBase64Image(String base64String) { static Uint8List convertBase64Image(String base64String) {
return Base64Decoder().convert(base64String.split(',').last); return Base64Decoder().convert(base64String.split(',').last);
@ -736,32 +902,10 @@ class AppSettings {
customerId = await getData('customerId', 'STRING'); customerId = await getData('customerId', 'STRING');
userLatitude = await getData('latitude', 'DOUBLE'); userLatitude = await getData('latitude', 'DOUBLE');
userLongitude =await getData('longitude', 'DOUBLE'); userLongitude =await getData('longitude', 'DOUBLE');
profilePictureUrl=await getData('profile', 'STRING');
fcmId =await getData('fcmId', 'STRING'); fcmId =await getData('fcmId', 'STRING');
age=await getData('age', 'STRING'); age=await getData('age', 'STRING');
getProfile(); gender=await getData('gender', 'STRING');
}
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);
} }
static void longFailedStyledToast(String message, context) { static void longFailedStyledToast(String message, context) {

@ -147,498 +147,383 @@ class _SignUpState extends State<SignUp> {
return WillPopScope( return WillPopScope(
onWillPop:()async=>onWillPop(), onWillPop:()async=>onWillPop(),
child: Scaffold( child: Scaffold(
backgroundColor: primaryColor,
body: Stack(children: <Widget>[ body: Stack(children: <Widget>[
Container( /* Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,), image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,),
), ),
), ),*/
GestureDetector( GestureDetector(
onTap: () { onTap: () {
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
}, },
child: SafeArea( child: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Padding(
children: <Widget>[ padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox( SizedBox(
height: 20, height: 20,
),
Container(
//width: double.infinity,
child: Image(
image: const AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .18,
)),
SizedBox(
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
),
),
), ),
), //name Container(
const SizedBox( //width: double.infinity,
height: 5, child: Image(
), image: const AssetImage('images/logo.png'),
Container( height: MediaQuery.of(context).size.height * .18,
padding: const EdgeInsets.all(10), )),
child: DropdownButtonFormField(
// Initial Value SizedBox(
value: genderUnit, height:MediaQuery.of(context).size.height * .05,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.female,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Units',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: genderUnitItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
genderUnit = newValue!;
});
},
),),
const SizedBox(
height: 5,
),
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
),
),
), ),
), //mobile Container(
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration(Icons.person,'Enter Name'),
/* 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
),
), ),
), ), //name
),*/ SizedBox(height:MediaQuery.of(context).size.height * .02,),
const SizedBox( Container(
height: 5, child: DropdownButtonFormField(
), // Initial Value
GestureDetector( value: genderUnit,
child: Container( isExpanded: true,
padding: const EdgeInsets.all(10), decoration: const InputDecoration(
filled: true,
fillColor: Colors.white,
prefixIcon: Icon(
Icons.female,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Gender',
labelStyle: TextStyle(color: Colors.black)
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: genderUnitItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(
fontSize: 16,
),
textAlign: TextAlign.center,
));
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
genderUnit = newValue!;
});
},
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField( child: TextFormField(
cursorColor: greyColor, cursorColor: greyColor,
controller: userAddressCapturingController, controller: mobileNumberController,
onTap:() keyboardType: TextInputType.phone,
{ maxLength: 10,
decoration: textFormFieldDecoration(Icons.phone_android,'Enter Mobile Number'),
//============================================================================================= ),
), //mobile
location.serviceEnabled().then((value) { SizedBox(height:MediaQuery.of(context).size.height * .02,),
if (value) { GestureDetector(
initRenderer(); child: Container(
Navigator.push( child: TextFormField(
context, cursorColor: greyColor,
MaterialPageRoute( controller: userAddressCapturingController,
builder: (context) { onTap:()
return PlacePicker( {
resizeToAvoidBottomInset: false,
hintText: "Find a place ...", //=============================================================================================
searchingText: "Please wait ...",
selectText: "Select place", location.serviceEnabled().then((value) {
outsideOfPickAreaText: "Place not in area", if (value) {
initialPosition: kInitialPosition, initRenderer();
useCurrentLocation: true, Navigator.push(
selectInitialPosition: true, context,
usePinPointingSearch: true, MaterialPageRoute(
usePlaceDetailSearch: true, builder: (context) {
zoomGesturesEnabled: true, return PlacePicker(
zoomControlsEnabled: true, resizeToAvoidBottomInset: false,
onMapCreated: (GoogleMapController controller) {}, hintText: "Find a place ...",
onPlacePicked: (PickResult result) { searchingText: "Please wait ...",
setState(() { selectText: "Select place",
selectedPlace = result; outsideOfPickAreaText: "Place not in area",
lat=selectedPlace!.geometry!.location.lat; initialPosition: kInitialPosition,
lng=selectedPlace!.geometry!.location.lng; useCurrentLocation: true,
if(selectedPlace!.types!.length==1){ selectInitialPosition: true,
userAddressCapturingController.text = usePinPointingSearch: true,
selectedPlace!.formattedAddress!; usePlaceDetailSearch: true,
} zoomGesturesEnabled: true,
else{ zoomControlsEnabled: true,
userAddressCapturingController.text =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!; onMapCreated: (GoogleMapController controller) {},
} onPlacePicked: (PickResult result) {
Navigator.of(context).pop(); setState(() {
}); selectedPlace = result;
}, lat=selectedPlace!.geometry!.location.lat;
onMapTypeChanged: (MapType mapType) {}, lng=selectedPlace!.geometry!.location.lng;
apiKey: Platform.isAndroid if(selectedPlace!.types!.length==1){
? APIKeys.androidApiKey userAddressCapturingController.text =
: APIKeys.iosApiKey, selectedPlace!.formattedAddress!;
forceAndroidLocationManager: true, }
); else{
}, userAddressCapturingController.text =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!;
), }
); Navigator.of(context).pop();
} else { });
showGeneralDialog( },
context: context, onMapTypeChanged: (MapType mapType) {},
pageBuilder: (context, x, y) { apiKey: Platform.isAndroid
return Scaffold( ? APIKeys.androidApiKey
backgroundColor: Colors.grey.withOpacity(.5), : APIKeys.iosApiKey,
body: Center( forceAndroidLocationManager: true,
child: Container( );
width: double.infinity, },
height: 150, ),
padding: );
const EdgeInsets.symmetric(horizontal: 20), } else {
child: Card( showGeneralDialog(
child: Padding( context: context,
padding: const EdgeInsets.all(10.0), pageBuilder: (context, x, y) {
child: Column( return Scaffold(
mainAxisAlignment: MainAxisAlignment.center, backgroundColor: Colors.grey.withOpacity(.5),
children: [ body: Center(
const Text( child: Container(
"Please enable the location", width: double.infinity,
style: TextStyle( height: 150,
fontSize:18, padding:
fontWeight: FontWeight.w500, const EdgeInsets.symmetric(horizontal: 20),
child: Card(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Please enable the location",
style: TextStyle(
fontSize:18,
fontWeight: FontWeight.w500,
),
),
const SizedBox(
height: 20,
), ),
), ElevatedButton(
const SizedBox( onPressed: () {
height: 20, Navigator.pop(context);
), },
ElevatedButton( child: const Text("Cancel"),
onPressed: () { ),
Navigator.pop(context); ],
}, ),
child: const Text("Cancel"),
),
],
), ),
), ),
), ),
), ),
), );
); },
}, );
); }
} });
});
//===================================================================================== //=====================================================================================
// _getCurrentPosition(); // _getCurrentPosition();
}, },
keyboardType: TextInputType.streetAddress, keyboardType: TextInputType.streetAddress,
readOnly: true, readOnly: true,
decoration: const InputDecoration( decoration:textFormFieldDecoration(Icons.location_on_rounded,'Click to select address(map)'),
prefixIcon: Icon(
Icons.location_on_rounded, ),
color: primaryColor, ),
/* onTap: ()
{
},*///address
),//address capturing
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: userAddressDescriptionController,
keyboardType: TextInputType.emailAddress,
decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'),
),
),//address description
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
obscureText: isPwdObscureText,
controller: passwordController,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Create Password',
prefixIcon: const Icon(
Icons.lock,
color: greyColor,
),
labelStyle: const TextStyle(
color: Colors.black, //<-- SEE HERE
), ),
border: OutlineInputBorder( border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)), borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder( focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: primaryColor),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor), borderSide: BorderSide(color: primaryColor),
), ),
labelText: 'Click to select address(map)', suffixIcon: IconButton(
labelStyle: TextStyle( icon: Icon(
color: greyColor, //<-- SEE HERE Icons.visibility_off_outlined,
color: isPwdObscureText?greyColor:primaryColor,
),
onPressed: () {
setState(() {
isPwdObscureText = !isPwdObscureText;
});
},
), ),
), ),
),
),
/* onTap: ()
{
},*///address
),//address capturing
const SizedBox(
height: 5,
),
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
),
), ),
), ), //pwd
),//address description 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 (nameController.text != '' &&
passwordController.text != '' &&
mobileNumberController.text != '') {
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["username"] = nameController.text.toString();
payload["password"] =
passwordController.text.toString();
payload["phone"] =
mobileNumberController.text.toString();
payload["firstName"] = nameController.text.toString();
payload["emails"] = [
{"email": emailController.text.toString()}
];
payload["lastName"] = '';
payload["address1"] = userAddressCapturingController.text;
payload["address2"] = '';
payload["city"] = '';
payload["state"] = '';
payload["zip"] = '';
payload["country"] = '';
payload["notes"] = '';
payload["latitude"] = lat;
payload["longitude"] = lng;
payload["fcmId"] = AppSettings.fcmId;
payload["age"] = 0;
payload["gender"] = genderUnit.toString();
bool signUpStatus = await AppSettings.signUp(payload);
try {
if (signUpStatus) {
var smsPayload = new Map<String, dynamic>();
smsPayload["mobileNumbers"] = mobileNumberController.text.toString();
bool sendSms = await AppSettings.sendSms(smsPayload);
if(sendSms){
Navigator.of(context, rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OtpScreen(myObject: mobileNumberController.text.toString(),)),
);
}
else{
Navigator.of(context, rootNavigator: true).pop();
}
const SizedBox(
height: 5,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
obscureText: isPwdObscureText,
controller: passwordController,
decoration: InputDecoration(
labelText: 'Create Password',
prefixIcon: const Icon(
Icons.lock,
color: primaryColor,
),
labelStyle: const TextStyle(
color: greyColor, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isPwdObscureText?greyColor:primaryColor,
),
onPressed: () {
setState(() {
isPwdObscureText = !isPwdObscureText;
});
},
),
),
),
), //pwd
const SizedBox(
height: 5,
),
Container(
width:MediaQuery.of(context).size.width * .99,
height: 55,
padding: const EdgeInsets.fromLTRB(3, 0, 3, 0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
if (nameController.text != '' &&
passwordController.text != '' &&
mobileNumberController.text != '') {
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["username"] = nameController.text.toString();
payload["password"] =
passwordController.text.toString();
payload["phone"] =
mobileNumberController.text.toString();
payload["firstName"] = nameController.text.toString();
payload["emails"] = [
{"email": emailController.text.toString()}
];
payload["lastName"] = '';
payload["address1"] = userAddressCapturingController.text;
payload["address2"] = '';
payload["city"] = '';
payload["state"] = '';
payload["zip"] = '';
payload["country"] = '';
payload["notes"] = '';
payload["latitude"] = lat;
payload["longitude"] = lng;
payload["fcmId"] = AppSettings.fcmId;
payload["age"] = 0;
payload["gender"] = genderUnit.toString();
bool signUpStatus = await AppSettings.signUp(payload);
try {
if (signUpStatus) {
var smsPayload = new Map<String, dynamic>();
smsPayload["mobileNumbers"] = mobileNumberController.text.toString();
bool sendSms = await AppSettings.sendSms(smsPayload);
if(sendSms){
Navigator.of(context, rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OtpScreen(myObject: mobileNumberController.text.toString(),)),
);
} }
else{ else {
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast(
"Mobile number already exists");
} }
} catch (exception) {
print(exception);
}
else {
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast( AppSettings.longFailedToast("Please enter valid details");
"Mobile number already exists");
} }
} catch (exception) {
print(exception);
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("Please enter valid details");
} }
} else {
else { AppSettings.longFailedToast("details should not be empty");
AppSettings.longFailedToast("details should not be empty"); }
} },
}, child: Text('Sign Up'),
child: Text('Sign Up'), )),//login button
)),//login button Row(
Row( mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
children: <Widget>[ const Text(
const Text( 'Are you a Member?',
'Are you a Member?',
style: TextStyle(
color: primaryColor,
),
),
TextButton(
child: const Text(
'Login?',
style: TextStyle( style: TextStyle(
fontSize: 20, color: Colors.white,
color: greyColor,
decoration: TextDecoration.underline,
), ),
), ),
onPressed: () { TextButton(
Navigator.push( child: const Text(
context, 'Login?',
MaterialPageRoute( style: TextStyle(
builder: (context) => const Login()), fontSize: 20,
); color: Colors.white,
}, decoration: TextDecoration.underline,
) ),
], ),
), onPressed: () {
], Navigator.push(
), context,
MaterialPageRoute(
builder: (context) => const Login()),
);
},
)
],
),
],
),
)
)), )),
), ),
])), ); ])), );

@ -73,7 +73,7 @@ class _SplashScreenState extends State<SplashScreen> {
children: <Widget>[ children: <Widget>[
Container( Container(
decoration: const BoxDecoration( 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -47,12 +49,14 @@ class _UpdateprofileState extends State<UpdateProfile> {
final image = await _picker.pickImage(source: ImageSource.gallery); final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.updatedImage = imageTemp; AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
}); });
//uploadProfileApi(image.path); AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $e'); print('Failed to pick image: $e');
} }
@ -63,33 +67,19 @@ class _UpdateprofileState extends State<UpdateProfile> {
final image = await _picker.pickImage(source: ImageSource.camera); final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.updatedImage = imageTemp; AppSettings.profilePictureUrl = jsonDecode(res)['picture'];
}); });
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
//uploadProfileApi(image.path);
AppSettings.uploadImageHTTP(image);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -128,8 +118,8 @@ class _UpdateprofileState extends State<UpdateProfile> {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
image: DecorationImage( image: DecorationImage(
image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file 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: () { onTap: () {
showModalBottomSheet<void>( 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 pharmacy_name = '';
String status=''; String status='';
String picture=''; String picture='';
String contact_number='';
String pharmacy_address='';
String pharmacy_id='';
String registration_number='';
String description='';
String starting_price='';
Color text_color=Colors.black; Color text_color=Colors.black;
double lat=0; double lat=0;
double lng=0; double lng=0;
bool isChecked=false;
PharmaciesModel(); PharmaciesModel();
@ -15,7 +22,13 @@ class PharmaciesModel {
PharmaciesModel rtvm = new PharmaciesModel(); PharmaciesModel rtvm = new PharmaciesModel();
rtvm.pharmacy_name = json['pharmacyname'] ?? ''; 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.status = json['status'] ?? '';
rtvm.lat = json['latitude'] ?? 0; rtvm.lat = json['latitude'] ?? 0;
rtvm.lng = json['longitude'] ??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 onPrimary: Colors.white, // foreground
), ),
onPressed: () async { onPressed: () async {
editTimingsDialog(); editTimingsDialog();
}, },
child: const Text('Edit'), 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" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.2.0+1" 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: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -833,6 +840,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.1.0" 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: platform:
dependency: transitive dependency: transitive
description: description:

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

Loading…
Cancel
Save