diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index bf7cf8e..eabddc3 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 33e8a80..d583383 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 667664f..1349b6d 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index f3e73cc..ea9d6a7 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 1e20c0f..3c46fec 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/images/appicon.png b/images/appicon.png new file mode 100644 index 0000000..6ee10c4 Binary files /dev/null and b/images/appicon.png differ diff --git a/images/editprofile.png b/images/editprofile.png index bf11808..cb7373e 100644 Binary files a/images/editprofile.png and b/images/editprofile.png differ diff --git a/images/emergency.png b/images/emergency.png index 0ce11d9..a0887e7 100644 Binary files a/images/emergency.png and b/images/emergency.png differ diff --git a/images/invitations.png b/images/invitations.png index 86dc31d..5194f24 100644 Binary files a/images/invitations.png and b/images/invitations.png differ diff --git a/images/logo.png b/images/logo.png index ef781fa..3982b86 100644 Binary files a/images/logo.png and b/images/logo.png differ diff --git a/images/logout.png b/images/logout.png index e083fc2..f577225 100644 Binary files a/images/logout.png and b/images/logout.png differ diff --git a/images/medicines.png b/images/medicines.png index 6c82587..d6d4650 100644 Binary files a/images/medicines.png and b/images/medicines.png differ diff --git a/images/mobilebg.png b/images/mobilebg.png index b831d5a..5d42afb 100644 Binary files a/images/mobilebg.png and b/images/mobilebg.png differ diff --git a/images/mobilebg2.png b/images/mobilebg2.png index e62652d..5ce3749 100644 Binary files a/images/mobilebg2.png and b/images/mobilebg2.png differ diff --git a/images/mobilebg3.png b/images/mobilebg3.png index 1664e0a..8673834 100644 Binary files a/images/mobilebg3.png and b/images/mobilebg3.png differ diff --git a/images/myconnections.png b/images/myconnections.png index 05ceab7..7062451 100644 Binary files a/images/myconnections.png and b/images/myconnections.png differ diff --git a/images/myhealth.png b/images/myhealth.png index 7cfbf73..1018a84 100644 Binary files a/images/myhealth.png and b/images/myhealth.png differ diff --git a/images/mymedicinetimings.png b/images/mymedicinetimings.png index 195e82e..ca62e55 100644 Binary files a/images/mymedicinetimings.png and b/images/mymedicinetimings.png differ diff --git a/images/no_data.png b/images/no_data.png new file mode 100644 index 0000000..27c28a4 Binary files /dev/null and b/images/no_data.png differ diff --git a/images/prescriptions.png b/images/prescriptions.png index 4e8c2c6..5737a33 100644 Binary files a/images/prescriptions.png and b/images/prescriptions.png differ diff --git a/images/reportmyself.png b/images/reportmyself.png index 01de7af..c588708 100644 Binary files a/images/reportmyself.png and b/images/reportmyself.png differ diff --git a/images/reports.png b/images/reports.png index efc7987..2421452 100644 Binary files a/images/reports.png and b/images/reports.png differ diff --git a/images/seekopinion.png b/images/seekopinion.png index df53f08..b17541a 100644 Binary files a/images/seekopinion.png and b/images/seekopinion.png differ diff --git a/images/serverissue.png b/images/serverissue.png new file mode 100644 index 0000000..ca8567c Binary files /dev/null and b/images/serverissue.png differ diff --git a/images/splashscreen.png b/images/splashscreen.png index 63a09da..e1ce188 100644 Binary files a/images/splashscreen.png and b/images/splashscreen.png differ diff --git a/images/updatemobilenumber.png b/images/updatemobilenumber.png index 962b70a..028dc66 100644 Binary files a/images/updatemobilenumber.png and b/images/updatemobilenumber.png differ diff --git a/images/updatemylocation.png b/images/updatemylocation.png index 0d492f4..533820d 100644 Binary files a/images/updatemylocation.png and b/images/updatemylocation.png differ diff --git a/images/updatepin.png b/images/updatepin.png index 6a386b7..7bbbd21 100644 Binary files a/images/updatepin.png and b/images/updatepin.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index fed59fc..57e69b7 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 31ca09e..2c7af6d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index acf8f56..73dd5f4 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index 2c09f3b..58dd612 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index e284efd..7c9dca9 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index a177160..3fbb974 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index 67f1277..c3e4830 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index acf8f56..73dd5f4 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index eb5fa93..06f405b 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index 6ae3f4a..4e5755e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index 6ae3f4a..4e5755e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 9b15c34..1d66944 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index 2bc4d69..a9ddeec 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index dcc5425..48d35cb 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index 9eb693d..a80e54e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/lib/comment/commentcode.dart b/lib/comment/commentcode.dart new file mode 100644 index 0000000..9198134 --- /dev/null +++ b/lib/comment/commentcode.dart @@ -0,0 +1,13 @@ + +/* get pharmacies data */ +/*Expanded( + child: Container( + child: isPharmacyDataLoading + ? Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ) + : _pharamciesData(), + ))*/ \ No newline at end of file diff --git a/lib/common/dashboard.dart b/lib/common/dashboard.dart index a7d5e7c..7e5fa29 100644 --- a/lib/common/dashboard.dart +++ b/lib/common/dashboard.dart @@ -1,13 +1,15 @@ +import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:healthcare_user/common/updateprofile.dart'; import 'package:healthcare_user/emergency.dart'; +import 'package:healthcare_user/howareufeeling_today.dart'; import 'package:healthcare_user/invitations.dart'; import 'package:healthcare_user/medicines.dart'; import 'package:healthcare_user/my_health.dart'; import 'package:healthcare_user/my_medicine_timings.dart'; -import 'package:healthcare_user/prescriptions.dart'; +import 'package:healthcare_user/prescriptions/prescriptions.dart'; +import 'package:healthcare_user/report_my_self.dart'; import 'package:healthcare_user/reports.dart'; import 'package:healthcare_user/seekopinion.dart'; import 'package:healthcare_user/common/settings.dart'; @@ -16,6 +18,7 @@ import 'package:carousel_slider/carousel_slider.dart'; import 'dart:ui' as ui; import 'login.dart'; import 'dart:io'; +import 'package:dots_indicator/dots_indicator.dart'; class Dashboard extends StatefulWidget { const Dashboard({super.key}); @@ -35,7 +38,7 @@ class _DashboardState extends State { final ImagePicker _picker = ImagePicker(); bool isTablet = false; bool isPhone = true; - + int currentIndex = 0; final double devicePixelRatio = ui.window.devicePixelRatio; static final ui.Size size1 = ui.window.physicalSize; final double width = size1.width; @@ -63,51 +66,38 @@ class _DashboardState extends State { "images/emergency.png" ]; - gridOntap(int ind){ - - if(ind==0){ + gridOntap(int ind) { + if (ind == 0) { Navigator.push( context, - MaterialPageRoute( - builder: (context) => const SeekOpinion()), + MaterialPageRoute(builder: (context) => const SeekOpinion()), ); - } - else if(ind==1){ + } else if (ind == 1) { Navigator.push( context, - MaterialPageRoute( - builder: (context) => const Reports()), + MaterialPageRoute(builder: (context) => const Reports()), ); - } - else if(ind==2){ + } else if (ind == 2) { Navigator.push( context, - MaterialPageRoute( - builder: (context) => const Prescriptions()), + MaterialPageRoute(builder: (context) => const Prescriptions()), ); - } - else if(ind==3){ + } else if (ind == 3) { Navigator.push( context, - MaterialPageRoute( - builder: (context) => const Medicines()), + MaterialPageRoute(builder: (context) => const Medicines()), ); - } - else if(ind==4){ + } else if (ind == 4) { Navigator.push( context, - MaterialPageRoute( - builder: (context) => const Invitations()), + MaterialPageRoute(builder: (context) => const Invitations()), ); - } - else if(ind==5){ + } else if (ind == 5) { Navigator.push( context, - MaterialPageRoute( - builder: (context) => const Emergency()), + MaterialPageRoute(builder: (context) => const Emergency()), ); } - } Widget _dashBoard() { @@ -152,28 +142,284 @@ class _DashboardState extends State { }).toList(), ), SizedBox(height: 5), - Expanded(child: Container( - padding: EdgeInsets.all(12.0), - child: GridView.builder( - itemCount: images.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + Expanded( + child: Container( + padding: EdgeInsets.all(12.0), + child: GridView.builder( + itemCount: images.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, - crossAxisSpacing: 4.0, - mainAxisSpacing: 4.0,), - itemBuilder: (BuildContext context, int index) { - return GestureDetector( - onTap: (){ - gridOntap(index); - }, - child: Image.asset(images[index]), - ); - }, - )),) + crossAxisSpacing: 2.0, + mainAxisSpacing: 2.0, + ), + itemBuilder: (BuildContext context, int index) { + return GestureDetector( + onTap: () { + gridOntap(index); + }, + child: Image.asset(images[index]), + ); + }, + )), + ) ], ), ); } + Widget _newDashboard() { + return Container( + color: primaryColor, + child: Column(children: [ + CarouselSlider( + options: CarouselOptions( + height: MediaQuery.of(context).size.height * .250, + aspectRatio: 16 / 9, + viewportFraction: 0.8, + initialPage: 0, + enableInfiniteScroll: true, + reverse: false, + autoPlay: true, + autoPlayInterval: Duration(seconds: 3), + autoPlayAnimationDuration: Duration(milliseconds: 800), + autoPlayCurve: Curves.ease, + enlargeCenterPage: true, + onPageChanged: (index, reason) { + setState(() { + currentIndex = index; + }); + }, + enlargeFactor: 0.2, + scrollDirection: Axis.horizontal, + ), + items: imgList.map((i) { + return Builder( + builder: (BuildContext context) { + return Container( + height: MediaQuery.of(context).size.height * .250, + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + //color: Colors.red, + child: FittedBox( + child: Image( + image: AssetImage(i), + ), + fit: BoxFit.fill, + )); + }, + ); + }).toList(), + ), + DotsIndicator( + dotsCount: imgList.length, + position: currentIndex, + axis: Axis.horizontal, + decorator: DotsDecorator( + color: Colors.white, + activeColor: buttonColors + ) + //decorator: decorator, + ), + Padding( + padding: EdgeInsets.all(10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage( + "images/seekopinion.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const SeekOpinion()), + ); + }, + ), + Text( + 'Seek Opinion', + style: dashboardTextStyle(), + ), + ], + ), + Column( + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage( + "images/reports.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Reports()), + ); + }, + ), + Text( + 'Reports', + style: dashboardTextStyle(), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage( + "images/prescriptions.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Prescriptions()), + ); + }, + ), + Text( + 'Prescriptions', + style: dashboardTextStyle(), + ), + ], + ), + Column( + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage( + "images/medicines.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Medicines()), + ); + }, + ), + Text( + 'Medicines', + style: dashboardTextStyle(), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage( + "images/invitations.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Invitations()), + ); + }, + ), + Text( + 'Invitations', + style: dashboardTextStyle(), + ), + ], + ), + Column( + children: [ + GestureDetector( + child: Container( + width: MediaQuery.of(context).size.width * .20, + height: MediaQuery.of(context).size.height * .15, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + image: DecorationImage( + image: AssetImage( + "images/emergency.png"), // picked file + fit: BoxFit.fitWidth)), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Emergency()), + ); + }, + ), + Text( + 'Emergency', + style: dashboardTextStyle(), + ), + ], + ), + ], + ), + ) + ])); + } + @override void initState() { super.initState(); @@ -193,12 +439,15 @@ class _DashboardState extends State { final image = await _picker.pickImage(source: ImageSource.gallery); if (image == null) return; final imageTemp = File(image.path); + + AppSettings.preLoaderDialog(context); + var res = await AppSettings.uploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); setState(() { - AppSettings.updatedImage = imageTemp; + AppSettings.profilePictureUrl = jsonDecode(res)['picture']; }); - //uploadProfileApi(image.path); - AppSettings.uploadImageHTTP(image); - AppSettings.saveProfile(image.path); + AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING'); } on PlatformException catch (e) { print('Failed to pick image: $e'); } @@ -209,13 +458,14 @@ class _DashboardState extends State { final image = await _picker.pickImage(source: ImageSource.camera); if (image == null) return; final imageTemp = File(image.path); + AppSettings.preLoaderDialog(context); + var res = await AppSettings.uploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); setState(() { - AppSettings.updatedImage = imageTemp; + AppSettings.profilePictureUrl = jsonDecode(res)['picture']; }); - - //uploadProfileApi(image.path); - AppSettings.uploadImageHTTP(image); - AppSettings.saveProfile(image.path); + AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING'); } on PlatformException catch (e) { print('Failed to pick image: $e'); } @@ -295,9 +545,11 @@ class _DashboardState extends State { return shouldPop!; }, child: Scaffold( + backgroundColor: primaryColor, resizeToAvoidBottomInset: false, appBar: AppSettings.appBar('Health Care'), drawer: Drawer( + backgroundColor: secondaryColor, child: ListView( padding: EdgeInsets.zero, children: [ @@ -319,14 +571,16 @@ class _DashboardState extends State { decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( - image: (AppSettings.updatedImage != - null) - ? FileImage( - AppSettings.updatedImage!) - as ImageProvider + image: (AppSettings.profilePictureUrl != + '' && + AppSettings.profilePictureUrl != + 'null') + ? NetworkImage(AppSettings + .profilePictureUrl) + as ImageProvider : AssetImage( - "images/profile_pic.png"), // picked file - fit: BoxFit.cover)), + "images/profile_pic.png"), // picked file + fit: BoxFit.fitWidth)), ), onTap: () { showModalBottomSheet( @@ -337,7 +591,7 @@ class _DashboardState extends State { child: Center( child: Row( mainAxisAlignment: - MainAxisAlignment.center, + MainAxisAlignment.center, children: [ GestureDetector( child: Icon( @@ -352,8 +606,8 @@ class _DashboardState extends State { ), SizedBox( width: MediaQuery.of(context) - .size - .width * + .size + .width * .20, ), GestureDetector( @@ -377,24 +631,37 @@ class _DashboardState extends State { ), Text( AppSettings.userName, - style: TextStyle(color: Colors.white, fontSize: 15), + style: drawerHeaderTextStyle(), ), Text( AppSettings.phoneNumber, - style: TextStyle(color: Colors.white, fontSize: 15), + style: drawerHeaderTextStyle(), ), Visibility( - visible:AppSettings.email!='', + visible: AppSettings.email != '', child: Text( - AppSettings.email, - style: TextStyle(color: Colors.white, fontSize: 15), - ),), - Visibility( - visible: AppSettings.age!='', - child: Text( - AppSettings.age+' Yrs', - style: TextStyle(color: Colors.white, fontSize: 15), - ),), + AppSettings.email, + style: drawerHeaderTextStyle(), + ), + ), + Row( + children: [ + Visibility( + visible: AppSettings.age != '', + child: Text( + AppSettings.age + ' Yrs, ', + style: drawerHeaderTextStyle(), + ), + ), + Visibility( + visible: AppSettings.gender != '', + child: Text( + AppSettings.gender, + style: drawerHeaderTextStyle(), + ), + ), + ], + ) ], ), Container() @@ -402,7 +669,7 @@ class _DashboardState extends State { )), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/editprofile.png'), height: 25, @@ -414,7 +681,7 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Edit Profile', style: TextStyle(color: primaryColor)), + Text('Edit Profile', style: drawerListItemsTextStyle()), ], ), onTap: () { @@ -430,7 +697,7 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/myhealth.png'), height: 25, @@ -442,14 +709,42 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('My Health', style: TextStyle(color: primaryColor)), + Text('My Health', style: drawerListItemsTextStyle()), + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const MyHealth()), + ); + }, + ), + Divider( + color: Colors.grey, + ), + ListTile( + title: Row( + children: [ + Image( + image: const AssetImage('images/myconnections.png'), + height: 25, + width: 25, + fit: BoxFit.fill), + const SizedBox( + width: 10, + ), + const SizedBox( + width: 10, + ), + Text('How are you feeling today?', + style: drawerListItemsTextStyle()), ], ), onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => const MyHealth()), + builder: (context) => const HowAreYouFellingToday()), ); }, ), @@ -458,7 +753,7 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/reportmyself.png'), height: 25, @@ -470,17 +765,23 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Report Myself', style: TextStyle(color: primaryColor)), + Text('Report Myself', style: drawerListItemsTextStyle()), ], ), - onTap: () {}, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ReportMySelf()), + ); + }, ), Divider( color: Colors.grey, ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/myconnections.png'), height: 25, @@ -492,7 +793,7 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('My Connections', style: TextStyle(color: primaryColor)), + Text('My Connections', style: drawerListItemsTextStyle()), ], ), onTap: () {}, @@ -502,7 +803,7 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/mymedicinetimings.png'), height: 25, @@ -514,7 +815,8 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('My Medicine Timings', style: TextStyle(color: primaryColor)), + Text('My Medicine Timings', + style: drawerListItemsTextStyle()), ], ), onTap: () { @@ -530,7 +832,7 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/updatepin.png'), height: 25, @@ -542,7 +844,7 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Update Pin', style: TextStyle(color: primaryColor)), + Text('Update Pin', style: drawerListItemsTextStyle()), ], ), onTap: () {}, @@ -552,9 +854,10 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( - image: const AssetImage('images/updatemobilenumber.png'), + image: + const AssetImage('images/updatemobilenumber.png'), height: 25, width: 25, fit: BoxFit.fill), @@ -564,7 +867,8 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Update Mobile Number', style: TextStyle(color: primaryColor)), + Text('Update Mobile Number', + style: drawerListItemsTextStyle()), ], ), onTap: () {}, @@ -574,7 +878,7 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/updatemylocation.png'), height: 25, @@ -586,7 +890,8 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Update My Location', style: TextStyle(color: primaryColor)), + Text('Update My Location', + style: drawerListItemsTextStyle()), ], ), onTap: () {}, @@ -596,7 +901,7 @@ class _DashboardState extends State { ), ListTile( title: Row( - children: const [ + children: [ Image( image: const AssetImage('images/logout.png'), height: 25, @@ -608,16 +913,17 @@ class _DashboardState extends State { const SizedBox( width: 10, ), - Text('Logout', style: TextStyle(color: primaryColor)), + Text('Logout', style: drawerListItemsTextStyle()), ], ), - onTap: () {}, + onTap: () { + showLogoutAlertDialog(context); + }, ), - ], ), ), - body: _dashBoard(), + body: _newDashboard(), ), ); } diff --git a/lib/common/login.dart b/lib/common/login.dart index 7bea85e..e479574 100644 --- a/lib/common/login.dart +++ b/lib/common/login.dart @@ -70,13 +70,14 @@ class _LoginState extends State { onWillPop: () async => onWillPop(), child: Scaffold( + backgroundColor: primaryColor, body: Stack( children: [ - Container( + /*Container( decoration: const BoxDecoration( image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,), ), - ), + ),*/ GestureDetector( onTap: () { FocusManager.instance.primaryFocus?.unfocus(); @@ -96,50 +97,31 @@ class _LoginState extends State { image: const AssetImage('images/logo.png'), height: MediaQuery.of(context).size.height * .25, )), - const SizedBox( - height: 15, + SizedBox( + height:MediaQuery.of(context).size.height * .05, ), Container( - padding: const EdgeInsets.all(10), child: TextFormField( cursorColor: greyColor, controller: mobileNumberController, keyboardType: TextInputType.number, - decoration: const InputDecoration( - prefixIcon: Icon( - Icons.phone, - color: greyColor, - ), - border: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color:primaryColor), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: primaryColor), - ), - labelText: 'Enter MobileNumber', - labelStyle: TextStyle( - color: greyColor, //<-- SEE HERE - ), - ), + decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'), + ), ), - const SizedBox( - height: 15, - ), - + SizedBox(height:MediaQuery.of(context).size.height * .02,), Container( - padding: const EdgeInsets.fromLTRB(10, 10, 10, 0), child: TextFormField( cursorColor: greyColor, obscureText: isObscureText, controller: passwordController, decoration: InputDecoration( + fillColor: Colors.white, + filled: true, labelText: 'Password', prefixIcon: const Icon(Icons.password, color: greyColor,), labelStyle: const TextStyle( - color: greyColor, //<-- SEE HERE + color: Colors.black, //<-- SEE HERE ), border: const OutlineInputBorder( borderSide: BorderSide(color: primaryColor)), @@ -167,36 +149,39 @@ class _LoginState extends State { ), ), - Padding(padding: const EdgeInsets.fromLTRB(220, 10, 0,10), - child: TextButton( - onPressed: () { - /*Navigator.push( + SizedBox(height:MediaQuery.of(context).size.height * .02,), + Align( + alignment: Alignment.bottomRight, + child: Padding(padding: const EdgeInsets.fromLTRB(0, 0, 0,0), + child: TextButton( + onPressed: () { + /*Navigator.push( context, MaterialPageRoute(builder: (context) => OtpScreen()), );*/ - }, - child: const Text( - 'Forgot Password?', - style: TextStyle( - color: greyColor, - fontSize: 15, - decoration: TextDecoration.underline, + }, + child: const Text( + 'Forgot Password?', + style: TextStyle( + color: Colors.white, + decoration: TextDecoration.underline, + ), ), - ), - ),), + ),), + ), + SizedBox(height:MediaQuery.of(context).size.height * .02,), Container( - width: 400, - height: 50, - padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + width:double.infinity, + height: MediaQuery.of(context).size.height * .06, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: primaryColor, // background - onPrimary: Colors.white, // foreground + primary: buttonColors, // background + onPrimary: Colors.black, // foreground ), onPressed: () async{ - if (mobileNumberController.text != '' || + if (mobileNumberController.text != '' && passwordController.text != '') { AppSettings.preLoaderDialog(context); @@ -254,14 +239,13 @@ class _LoginState extends State { const Text( 'Not a Member Yet?', style: TextStyle( - color: primaryColor, + color: Colors.white, ), ), TextButton( child: const Text( 'Sign Up', - style: TextStyle(fontSize: 15, - decoration: TextDecoration.underline,color: greyColor), + style: TextStyle(decoration: TextDecoration.underline,color: Colors.white), ), onPressed: () { Navigator.push( diff --git a/lib/common/otpscreen.dart b/lib/common/otpscreen.dart index c2b2252..0cebcb1 100644 --- a/lib/common/otpscreen.dart +++ b/lib/common/otpscreen.dart @@ -230,7 +230,15 @@ class OtpInput extends StatelessWidget { maxLength: 1, cursorColor: Theme.of(context).primaryColor, decoration: const InputDecoration( - border: OutlineInputBorder(), + filled: true, + fillColor: Colors.white, + border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), counterText: '', hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)), onChanged: (value) { diff --git a/lib/common/settings.dart b/lib/common/settings.dart index 9b03ade..215fa9b 100644 --- a/lib/common/settings.dart +++ b/lib/common/settings.dart @@ -13,7 +13,10 @@ import 'dart:async'; import 'package:geolocator/geolocator.dart'; import 'package:fluttertoast/fluttertoast.dart'; -const Color primaryColor = Color(0XFF1786A3); +//const Color primaryColor = Color(0XFF1786A3); +const Color primaryColor = Color(0XFF68A85D); +const Color secondaryColor = Color(0XFFA0C899); +const Color buttonColors = Color(0XFFFFAC1C); const Color greyColor = Color(0XFF8F8E8E); const Color textFieldStartColor = Colors.grey; const Color screenBackgroundColor = Color(0XFFEAF6FF); @@ -21,10 +24,10 @@ const Color screenBackgroundColord = Colors.black12; const Color dashboardbackground = Color(0XFFF5F5F5); //Color AppBarGradient_1 = Color(0XFF1258F6); -Color AppBarGradient_1 = Color(0XFF1786A3); +Color AppBarGradient_1 = Color(0XFF68A85D); TextStyle PreloaderText() { - return TextStyle(color: Color(0XFF1786A3)); + return TextStyle(color: Color(0XFF68A85D)); } TextStyle labelTextStyle() { @@ -66,8 +69,7 @@ Text dimensionSuffixText() { TextStyle dashboardTextStyle() { return TextStyle( - color: primaryColor, - fontSize: 12, + color: Colors.white, fontWeight: FontWeight.bold, ); } @@ -82,22 +84,59 @@ TextStyle labelTextStyleBold() { TextStyle serverIssueTextStyle() { return TextStyle(color: Colors.red, fontSize: 15); } + TextStyle bottomSheetValuesTextStyle() { return TextStyle(fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); } + TextStyle wrapTextStyle() { return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); } + TextStyle wrapTextStyleBlack() { return TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,); } + TextStyle withoutWrapTextStyle() { return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,); } + TextStyle bmiTextStyle() { return TextStyle(color:primaryColor,fontSize: 16,fontWeight: FontWeight.bold,); } +TextStyle drawerListItemsTextStyle(){ + return TextStyle(color: Colors.white); +} +TextStyle drawerHeaderTextStyle(){ + return TextStyle(color: Colors.white, fontSize: 15); +} + + + + +InputDecoration textFormFieldDecoration(IconData icon,var text){ + return InputDecoration( + filled: true, + fillColor: Colors.white, + prefixIcon: Icon( + icon, + color: greyColor, + ), + border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: primaryColor), + ), + labelText: text, + labelStyle: + TextStyle(color: Colors.black, //<-- SEE HERE + ), + ); +} + final GlobalKey preloaderWindowKey = new GlobalKey(); Future preloaderWindow(BuildContext context) async { try { @@ -112,6 +151,7 @@ class AppSettings { static String userAddress = ''; static String email = ''; static String age = ''; + static String gender = ''; static String phoneNumber = ''; static String accessToken = ''; static String customerId = ''; @@ -154,6 +194,13 @@ class AppSettings { static String getMedicineTimingsUrl = host + 'getmedicineztiming'; static String prescriptionUploadPicUrl = host + 'uploads-precription'; static String getAllpharmaciesDataUrl = host + 'getAllPharmacylist'; + static String uploadPrescriptionUrl = host + 'submitPicture'; + static String addPrescriptionUrl = host + 'add-prescription-details'; + static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo'; + static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription'; + + + @@ -164,6 +211,7 @@ class AppSettings { static File? updatedImage; static String image = ''; + static String profilePictureUrl = ''; static var api = { 'signIn': host + '/login', }; @@ -510,7 +558,6 @@ class AppSettings { phoneNumber = _response['phone']; email = _response['emails'][0]['email']; age = _response['age'].toString(); - await saveData('phone', _response['phone'], 'STRING'); await saveData('email', _response['emails'][0]['email'], 'STRING'); await saveData('username', _response['username'], 'STRING'); @@ -611,6 +658,15 @@ class AppSettings { var res = await request.send(); return res; + } + static Future 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 uploadImageHTTPForPrescriptions(file) async { @@ -623,6 +679,16 @@ class AppSettings { } + static Future 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 getAllpharmacies() async { var uri = Uri.parse(getAllpharmaciesDataUrl); //uri = uri.replace(query: 'customerId=$customerId'); @@ -695,6 +761,104 @@ class AppSettings { } } + static Future 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 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 getAllPrescriptions() async { + var uri = Uri.parse(getAllPrescriptionsDataUrl+'/'+customerId); + //uri = uri.replace(query: 'customerId=$customerId'); + + var response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else if (response.statusCode == 401) { + bool status = await AppSettings.resetToken(); + if (status) { + response = await http.get(uri, headers: await buildRequestHeaders()); + if (response.statusCode == 200) { + return response.body; + } else { + return ''; + } + } else { + return ''; + } + } else { + return ''; + } + } + + + /*Apis ends here*/ //save data local @@ -712,16 +876,18 @@ class AppSettings { await saveData('latitude', input['simplydata']['latitude'], 'DOUBLE'); await saveData('longitude', input['simplydata']['longitude'], 'DOUBLE'); await saveData('fcmId', input['simplydata']['fcmId'], 'STRING'); + await saveData('age', input['simplydata']['age'], 'STRING'); + await saveData('gender', input['simplydata']['gender'], 'STRING'); //await saveData('age', input['simplydata']['age'], 'STRING'); //latitude,longitude await loadDataFromMemory(); } - static Future saveProfile(dynamic image) async { + /* static Future saveProfile(dynamic image) async { // save login name information await saveData('profile', image.toString(), 'STRING'); //await loadDataFromMemory(); - } + }*/ static Uint8List convertBase64Image(String base64String) { return Base64Decoder().convert(base64String.split(',').last); @@ -736,32 +902,10 @@ class AppSettings { customerId = await getData('customerId', 'STRING'); userLatitude = await getData('latitude', 'DOUBLE'); userLongitude =await getData('longitude', 'DOUBLE'); + profilePictureUrl=await getData('profile', 'STRING'); fcmId =await getData('fcmId', 'STRING'); age=await getData('age', 'STRING'); - getProfile(); - } - - static Future getProfile() async { - final image1 = await getData('profile', 'STRING'); - - //Io.File.fromUri(imageFile.uri) - - var x = image1; - - if (image1 == null) return; - - if (image1 == '') { - updatedImage = null; - } - else if (image1 == 'null') { - updatedImage = null; - } - else { - final imageTemp = File(image1); - updatedImage = imageTemp; - } - - print(updatedImage); + gender=await getData('gender', 'STRING'); } static void longFailedStyledToast(String message, context) { diff --git a/lib/common/signup.dart b/lib/common/signup.dart index 6b58859..ec29a4f 100644 --- a/lib/common/signup.dart +++ b/lib/common/signup.dart @@ -147,498 +147,383 @@ class _SignUpState extends State { return WillPopScope( onWillPop:()async=>onWillPop(), child: Scaffold( + backgroundColor: primaryColor, body: Stack(children: [ - Container( + /* Container( decoration: const BoxDecoration( image: DecorationImage(image: AssetImage("images/background.png"), fit: BoxFit.cover,), ), - ), + ),*/ GestureDetector( onTap: () { FocusManager.instance.primaryFocus?.unfocus(); }, child: SafeArea( child: SingleChildScrollView( - child: Column( - children: [ + child: Padding( + padding: EdgeInsets.all(10), + child: Column( + children: [ - SizedBox( - 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 - ), - ), + SizedBox( + height: 20, ), - ), //name - const SizedBox( - height: 5, - ), - Container( - padding: const EdgeInsets.all(10), - child: DropdownButtonFormField( - // Initial Value - value: genderUnit, - 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 - ), - ), + Container( + //width: double.infinity, + child: Image( + image: const AssetImage('images/logo.png'), + height: MediaQuery.of(context).size.height * .18, + )), + + SizedBox( + height:MediaQuery.of(context).size.height * .05, ), - ), //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 - ), ), - ), - ),*/ - const SizedBox( - height: 5, - ), - GestureDetector( - child: Container( - padding: const EdgeInsets.all(10), + ), //name + SizedBox(height:MediaQuery.of(context).size.height * .02,), + Container( + child: DropdownButtonFormField( + // Initial Value + value: genderUnit, + isExpanded: true, + 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( cursorColor: greyColor, - controller: userAddressCapturingController, - onTap:() - { - - //============================================================================================= - - location.serviceEnabled().then((value) { - if (value) { - initRenderer(); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return PlacePicker( - resizeToAvoidBottomInset: false, - hintText: "Find a place ...", - searchingText: "Please wait ...", - selectText: "Select place", - outsideOfPickAreaText: "Place not in area", - initialPosition: kInitialPosition, - useCurrentLocation: true, - selectInitialPosition: true, - usePinPointingSearch: true, - usePlaceDetailSearch: true, - zoomGesturesEnabled: true, - zoomControlsEnabled: true, - onMapCreated: (GoogleMapController controller) {}, - onPlacePicked: (PickResult result) { - setState(() { - selectedPlace = result; - lat=selectedPlace!.geometry!.location.lat; - lng=selectedPlace!.geometry!.location.lng; - if(selectedPlace!.types!.length==1){ - userAddressCapturingController.text = - selectedPlace!.formattedAddress!; - } - else{ - userAddressCapturingController.text =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!; - } - Navigator.of(context).pop(); - }); - }, - onMapTypeChanged: (MapType mapType) {}, - apiKey: Platform.isAndroid - ? APIKeys.androidApiKey - : APIKeys.iosApiKey, - forceAndroidLocationManager: true, - ); - }, - ), - ); - } else { - showGeneralDialog( - context: context, - pageBuilder: (context, x, y) { - return Scaffold( - backgroundColor: Colors.grey.withOpacity(.5), - body: Center( - child: Container( - width: double.infinity, - height: 150, - padding: - 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, + controller: mobileNumberController, + keyboardType: TextInputType.phone, + maxLength: 10, + decoration: textFormFieldDecoration(Icons.phone_android,'Enter Mobile Number'), + ), + ), //mobile + SizedBox(height:MediaQuery.of(context).size.height * .02,), + GestureDetector( + child: Container( + child: TextFormField( + cursorColor: greyColor, + controller: userAddressCapturingController, + onTap:() + { + + //============================================================================================= + + location.serviceEnabled().then((value) { + if (value) { + initRenderer(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return PlacePicker( + resizeToAvoidBottomInset: false, + hintText: "Find a place ...", + searchingText: "Please wait ...", + selectText: "Select place", + outsideOfPickAreaText: "Place not in area", + initialPosition: kInitialPosition, + useCurrentLocation: true, + selectInitialPosition: true, + usePinPointingSearch: true, + usePlaceDetailSearch: true, + zoomGesturesEnabled: true, + zoomControlsEnabled: true, + onMapCreated: (GoogleMapController controller) {}, + onPlacePicked: (PickResult result) { + setState(() { + selectedPlace = result; + lat=selectedPlace!.geometry!.location.lat; + lng=selectedPlace!.geometry!.location.lng; + if(selectedPlace!.types!.length==1){ + userAddressCapturingController.text = + selectedPlace!.formattedAddress!; + } + else{ + userAddressCapturingController.text =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!; + } + Navigator.of(context).pop(); + }); + }, + onMapTypeChanged: (MapType mapType) {}, + apiKey: Platform.isAndroid + ? APIKeys.androidApiKey + : APIKeys.iosApiKey, + forceAndroidLocationManager: true, + ); + }, + ), + ); + } else { + showGeneralDialog( + context: context, + pageBuilder: (context, x, y) { + return Scaffold( + backgroundColor: Colors.grey.withOpacity(.5), + body: Center( + child: Container( + width: double.infinity, + height: 150, + padding: + 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, ), - ), - const SizedBox( - height: 20, - ), - ElevatedButton( - onPressed: () { - Navigator.pop(context); - }, - child: const Text("Cancel"), - ), - ], + ElevatedButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text("Cancel"), + ), + ], + ), ), ), ), ), - ), - ); - }, - ); - } - }); + ); + }, + ); + } + }); - //===================================================================================== + //===================================================================================== - // _getCurrentPosition(); - }, - keyboardType: TextInputType.streetAddress, - readOnly: true, - decoration: const InputDecoration( - prefixIcon: Icon( - Icons.location_on_rounded, - color: primaryColor, + // _getCurrentPosition(); + }, + keyboardType: TextInputType.streetAddress, + readOnly: true, + decoration:textFormFieldDecoration(Icons.location_on_rounded,'Click to select address(map)'), + + ), + ), + /* 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)), - focusedBorder: OutlineInputBorder( + focusedBorder: const OutlineInputBorder( borderSide: BorderSide(color: primaryColor), ), - enabledBorder: OutlineInputBorder( + enabledBorder: const OutlineInputBorder( borderSide: BorderSide(color: primaryColor), ), - labelText: 'Click to select address(map)', - labelStyle: TextStyle( - color: greyColor, //<-- SEE HERE + suffixIcon: IconButton( + icon: Icon( + 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 - ), ), - ), - ),//address description - + ), //pwd + 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(); + 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(); + 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(); - 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(); - 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(); + AppSettings.longFailedToast( + "Mobile number already exists"); } - - - - } - else { + } catch (exception) { + print(exception); Navigator.of(context, rootNavigator: true).pop(); - AppSettings.longFailedToast( - "Mobile number already exists"); + AppSettings.longFailedToast("Please enter valid details"); } - } catch (exception) { - print(exception); - Navigator.of(context, rootNavigator: true).pop(); - AppSettings.longFailedToast("Please enter valid details"); } - } - else { - AppSettings.longFailedToast("details should not be empty"); - } - }, - child: Text('Sign Up'), - )),//login button - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'Are you a Member?', - style: TextStyle( - color: primaryColor, - ), - ), - TextButton( - child: const Text( - 'Login?', + else { + AppSettings.longFailedToast("details should not be empty"); + } + }, + child: Text('Sign Up'), + )),//login button + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'Are you a Member?', style: TextStyle( - fontSize: 20, - color: greyColor, - decoration: TextDecoration.underline, + color: Colors.white, ), ), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const Login()), - ); - }, - ) - ], - ), - ], - ), + TextButton( + child: const Text( + 'Login?', + style: TextStyle( + fontSize: 20, + color: Colors.white, + decoration: TextDecoration.underline, + ), + ), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const Login()), + ); + }, + ) + ], + ), + ], + ), + ) )), ), ])), ); diff --git a/lib/common/splash_screen.dart b/lib/common/splash_screen.dart index 1c3dec6..0798148 100644 --- a/lib/common/splash_screen.dart +++ b/lib/common/splash_screen.dart @@ -73,7 +73,7 @@ class _SplashScreenState extends State { children: [ Container( decoration: const BoxDecoration( - image: DecorationImage(image: AssetImage("images/splashscreen.png"), fit: BoxFit.cover,), + image: DecorationImage(image: AssetImage("images/splashscreen.png"), fit: BoxFit.fill,), ), ), diff --git a/lib/common/updateprofile.dart b/lib/common/updateprofile.dart index 1fef78a..92624bc 100644 --- a/lib/common/updateprofile.dart +++ b/lib/common/updateprofile.dart @@ -1,4 +1,6 @@ +import 'dart:convert'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -47,12 +49,14 @@ class _UpdateprofileState extends State { final image = await _picker.pickImage(source: ImageSource.gallery); if (image == null) return; final imageTemp = File(image.path); + AppSettings.preLoaderDialog(context); + var res = await AppSettings.uploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); setState(() { - AppSettings.updatedImage = imageTemp; + AppSettings.profilePictureUrl = jsonDecode(res)['picture']; }); - //uploadProfileApi(image.path); - AppSettings.uploadImageHTTP(image); - AppSettings.saveProfile(image.path); + AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING'); } on PlatformException catch (e) { print('Failed to pick image: $e'); } @@ -63,33 +67,19 @@ class _UpdateprofileState extends State { final image = await _picker.pickImage(source: ImageSource.camera); if (image == null) return; final imageTemp = File(image.path); + AppSettings.preLoaderDialog(context); + var res = await AppSettings.uploadImageHTTPNew(image); + print(jsonDecode(res)); + Navigator.of(context, rootNavigator: true).pop(); setState(() { - AppSettings.updatedImage = imageTemp; + AppSettings.profilePictureUrl = jsonDecode(res)['picture']; }); - - //uploadProfileApi(image.path); - AppSettings.uploadImageHTTP(image); - AppSettings.saveProfile(image.path); + AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING'); } on PlatformException catch (e) { print('Failed to pick image: $e'); } } - Future uploadProfileApi(image) async { - var formData = new Map(); - /* formData = FormData.fromMap({ - "username" : "John", - "password" : "123456", - "device-type" : "Android" - });*/ - - - var payload = new Map(); - payload["formData"] = image.toString(); - var response1 = await AppSettings.updateProfilePicture(payload); - - print(response1); - } @override Widget build(BuildContext context) { @@ -128,8 +118,8 @@ class _UpdateprofileState extends State { decoration: BoxDecoration( shape: BoxShape.circle, image: DecorationImage( - image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file - fit: BoxFit.cover)), + image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ? NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file + fit: BoxFit.fitWidth)), ), onTap: () { showModalBottomSheet( diff --git a/lib/edit_medicine_timings.dart b/lib/edit_medicine_timings.dart new file mode 100644 index 0000000..a33bdfc --- /dev/null +++ b/lib/edit_medicine_timings.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class EditMedicineTimings extends StatefulWidget { + const EditMedicineTimings({Key? key}) : super(key: key); + + @override + State createState() => _EditMedicineTimingsState(); +} + +class _EditMedicineTimingsState extends State { + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/howareufeeling_today.dart b/lib/howareufeeling_today.dart new file mode 100644 index 0000000..0a84392 --- /dev/null +++ b/lib/howareufeeling_today.dart @@ -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 createState() => _HowAreYouFellingTodayState(); +} + +class _HowAreYouFellingTodayState extends State { + @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 + }, + ), + ), + ), + ); + } +} diff --git a/lib/models/pharmacies.dart b/lib/models/pharmacies_model.dart similarity index 50% rename from lib/models/pharmacies.dart rename to lib/models/pharmacies_model.dart index 642531a..1972967 100644 --- a/lib/models/pharmacies.dart +++ b/lib/models/pharmacies_model.dart @@ -5,9 +5,16 @@ class PharmaciesModel { String pharmacy_name = ''; String status=''; String picture=''; + String contact_number=''; + String pharmacy_address=''; + String pharmacy_id=''; + String registration_number=''; + String description=''; + String starting_price=''; Color text_color=Colors.black; double lat=0; double lng=0; + bool isChecked=false; PharmaciesModel(); @@ -15,7 +22,13 @@ class PharmaciesModel { PharmaciesModel rtvm = new PharmaciesModel(); rtvm.pharmacy_name = json['pharmacyname'] ?? ''; - rtvm.picture = json['pharmacyname'] ?? ''; + rtvm.pharmacy_id = json['pharmacyId'] ?? ''; + rtvm.contact_number = json['phone'] ?? ''; + rtvm.pharmacy_address =json['profile']['pharmacy_address'] ?? ''; + rtvm.registration_number = json['registration_number'] ?? ''; + rtvm.description = json['description'] ?? ''; + rtvm.starting_price = json['startingPrice'] ?? ''; + rtvm.picture = json['picture'] ?? ''; rtvm.status = json['status'] ?? ''; rtvm.lat = json['latitude'] ?? 0; rtvm.lng = json['longitude'] ??0; diff --git a/lib/models/prescriptions_model.dart b/lib/models/prescriptions_model.dart new file mode 100644 index 0000000..6a7176e --- /dev/null +++ b/lib/models/prescriptions_model.dart @@ -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 json){ + PrescriptionsModel rtvm = new PrescriptionsModel(); + + rtvm.prescription_name = json['name'] ?? ''; + rtvm.patient_type = json['patientType'] ?? ''; + rtvm.prescription_url = json['pictureUrl'][0] ?? ''; + + return rtvm; + } + +} \ No newline at end of file diff --git a/lib/my_medicine_timings.dart b/lib/my_medicine_timings.dart index a0b1a2d..f4bf3d1 100644 --- a/lib/my_medicine_timings.dart +++ b/lib/my_medicine_timings.dart @@ -364,6 +364,7 @@ class _MyMedicineTimingsState extends State { onPrimary: Colors.white, // foreground ), onPressed: () async { + editTimingsDialog(); }, child: const Text('Edit'), diff --git a/lib/prescriptions.dart b/lib/prescriptions.dart deleted file mode 100644 index 1f0c854..0000000 --- a/lib/prescriptions.dart +++ /dev/null @@ -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 createState() => _PrescriptionsState(); -} - -class _PrescriptionsState extends State { - - final ImagePicker _picker = ImagePicker(); - String Url=''; - List pharmaciesList = []; - List 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 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( - context: context, - builder: (BuildContext context) { - return SizedBox( - height: 200, - child: Center( - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - 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)), - ), - ], - ) - ), - ); - } -} diff --git a/lib/prescriptions/add_prescriptions.dart b/lib/prescriptions/add_prescriptions.dart new file mode 100644 index 0000000..a68fbad --- /dev/null +++ b/lib/prescriptions/add_prescriptions.dart @@ -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 createState() => _AddPrescriptionState(); +} + +class _AddPrescriptionState extends State { + + 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: [ + 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: [ + 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( + context: context, + builder: (BuildContext context) { + return SizedBox( + height: 200, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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(); + 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'), + )), + + + ], + ), + )) , + ) + ); + } +} diff --git a/lib/prescriptions/prescriptions.dart b/lib/prescriptions/prescriptions.dart new file mode 100644 index 0000000..a85cc23 --- /dev/null +++ b/lib/prescriptions/prescriptions.dart @@ -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 createState() => _PrescriptionsState(); +} + +class _PrescriptionsState extends State { + final ImagePicker _picker = ImagePicker(); + String Url = ''; + List pharmaciesList = []; + List prescriptionsList = []; + List 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 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 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(); + + 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(); + + 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(), + + ], + )), + ); + } +} diff --git a/lib/report_my_self.dart b/lib/report_my_self.dart new file mode 100644 index 0000000..1a1abae --- /dev/null +++ b/lib/report_my_self.dart @@ -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 createState() => _ReportMySelfState(); +} + +class _ReportMySelfState extends State { + + 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( + context: context, + builder: (BuildContext context) { + return SizedBox( + height: 200, + child: Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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)), + ), + + ), + ), + + + ], + ), + ), + ), + ); + } +} diff --git a/pictures/01.png b/pictures/01.png new file mode 100644 index 0000000..511be2d Binary files /dev/null and b/pictures/01.png differ diff --git a/pictures/02.png b/pictures/02.png new file mode 100644 index 0000000..debf165 Binary files /dev/null and b/pictures/02.png differ diff --git a/pictures/03.png b/pictures/03.png new file mode 100644 index 0000000..3d45adc Binary files /dev/null and b/pictures/03.png differ diff --git a/pictures/04.png b/pictures/04.png new file mode 100644 index 0000000..253192d Binary files /dev/null and b/pictures/04.png differ diff --git a/pictures/05.png b/pictures/05.png new file mode 100644 index 0000000..e23fe31 Binary files /dev/null and b/pictures/05.png differ diff --git a/pictures/06.png b/pictures/06.png new file mode 100644 index 0000000..9e74414 Binary files /dev/null and b/pictures/06.png differ diff --git a/pictures/08.png b/pictures/08.png new file mode 100644 index 0000000..cb22d9d Binary files /dev/null and b/pictures/08.png differ diff --git a/pictures/background.png b/pictures/background.png new file mode 100644 index 0000000..3dc7ddf Binary files /dev/null and b/pictures/background.png differ diff --git a/pictures/date.png b/pictures/date.png new file mode 100644 index 0000000..1a22262 Binary files /dev/null and b/pictures/date.png differ diff --git a/pictures/editprofile.png b/pictures/editprofile.png new file mode 100644 index 0000000..bf11808 Binary files /dev/null and b/pictures/editprofile.png differ diff --git a/pictures/emergency.png b/pictures/emergency.png new file mode 100644 index 0000000..0ce11d9 Binary files /dev/null and b/pictures/emergency.png differ diff --git a/pictures/height.png b/pictures/height.png new file mode 100644 index 0000000..7f152d3 Binary files /dev/null and b/pictures/height.png differ diff --git a/pictures/history.png b/pictures/history.png new file mode 100644 index 0000000..890dfe7 Binary files /dev/null and b/pictures/history.png differ diff --git a/pictures/invitations.png b/pictures/invitations.png new file mode 100644 index 0000000..86dc31d Binary files /dev/null and b/pictures/invitations.png differ diff --git a/pictures/logo.png b/pictures/logo.png new file mode 100644 index 0000000..ef781fa Binary files /dev/null and b/pictures/logo.png differ diff --git a/pictures/logout.png b/pictures/logout.png new file mode 100644 index 0000000..e083fc2 Binary files /dev/null and b/pictures/logout.png differ diff --git a/pictures/medicines.png b/pictures/medicines.png new file mode 100644 index 0000000..6c82587 Binary files /dev/null and b/pictures/medicines.png differ diff --git a/pictures/mobilebg.png b/pictures/mobilebg.png new file mode 100644 index 0000000..b831d5a Binary files /dev/null and b/pictures/mobilebg.png differ diff --git a/pictures/mobilebg2.png b/pictures/mobilebg2.png new file mode 100644 index 0000000..e62652d Binary files /dev/null and b/pictures/mobilebg2.png differ diff --git a/pictures/mobilebg3.png b/pictures/mobilebg3.png new file mode 100644 index 0000000..1664e0a Binary files /dev/null and b/pictures/mobilebg3.png differ diff --git a/pictures/myconnections.png b/pictures/myconnections.png new file mode 100644 index 0000000..05ceab7 Binary files /dev/null and b/pictures/myconnections.png differ diff --git a/pictures/myhealth.png b/pictures/myhealth.png new file mode 100644 index 0000000..7cfbf73 Binary files /dev/null and b/pictures/myhealth.png differ diff --git a/pictures/mymedicinetimings.png b/pictures/mymedicinetimings.png new file mode 100644 index 0000000..195e82e Binary files /dev/null and b/pictures/mymedicinetimings.png differ diff --git a/pictures/no_data.png b/pictures/no_data.png new file mode 100644 index 0000000..27c28a4 Binary files /dev/null and b/pictures/no_data.png differ diff --git a/pictures/prescriptions.png b/pictures/prescriptions.png new file mode 100644 index 0000000..4e8c2c6 Binary files /dev/null and b/pictures/prescriptions.png differ diff --git a/pictures/profile_pic.png b/pictures/profile_pic.png new file mode 100644 index 0000000..3fd3f73 Binary files /dev/null and b/pictures/profile_pic.png differ diff --git a/pictures/reportmyself.png b/pictures/reportmyself.png new file mode 100644 index 0000000..01de7af Binary files /dev/null and b/pictures/reportmyself.png differ diff --git a/pictures/reports.png b/pictures/reports.png new file mode 100644 index 0000000..efc7987 Binary files /dev/null and b/pictures/reports.png differ diff --git a/pictures/seekopinion.png b/pictures/seekopinion.png new file mode 100644 index 0000000..df53f08 Binary files /dev/null and b/pictures/seekopinion.png differ diff --git a/pictures/serverissue.png b/pictures/serverissue.png new file mode 100644 index 0000000..ca8567c Binary files /dev/null and b/pictures/serverissue.png differ diff --git a/pictures/splashscreen.png b/pictures/splashscreen.png new file mode 100644 index 0000000..63a09da Binary files /dev/null and b/pictures/splashscreen.png differ diff --git a/pictures/time.png b/pictures/time.png new file mode 100644 index 0000000..2efce7a Binary files /dev/null and b/pictures/time.png differ diff --git a/pictures/updatemobilenumber.png b/pictures/updatemobilenumber.png new file mode 100644 index 0000000..962b70a Binary files /dev/null and b/pictures/updatemobilenumber.png differ diff --git a/pictures/updatemylocation.png b/pictures/updatemylocation.png new file mode 100644 index 0000000..0d492f4 Binary files /dev/null and b/pictures/updatemylocation.png differ diff --git a/pictures/updatepin.png b/pictures/updatepin.png new file mode 100644 index 0000000..6a386b7 Binary files /dev/null and b/pictures/updatepin.png differ diff --git a/pictures/weight.png b/pictures/weight.png new file mode 100644 index 0000000..04eac04 Binary files /dev/null and b/pictures/weight.png differ diff --git a/pubspec.lock b/pubspec.lock index bfca4ee..3ea868b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -225,6 +225,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.2.0+1" + dots_indicator: + dependency: "direct dev" + description: + name: dots_indicator + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" fake_async: dependency: transitive description: @@ -833,6 +840,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.1.0" + photo_view: + dependency: "direct dev" + description: + name: photo_view + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0" + pinch_zoom: + dependency: "direct dev" + description: + name: pinch_zoom + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" platform: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index f544010..7061105 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,10 +62,13 @@ dev_dependencies: carousel_slider: ^4.2.1 fluttertoast: ^8.2.2 day_night_time_picker: ^1.3.0 + photo_view: ^0.14.0 + pinch_zoom: ^1.0.0 + dots_indicator: ^3.0.0 flutter_icons: - image_path_ios: 'images/logo.png' - image_path_android: 'images/logo.png' + image_path_ios: 'images/appicon.png' + image_path_android: 'images/appicon.png' android: true ios: true remove_alpha_ios: true