Compare commits

..

No commits in common. 'master' and 'test' have entirely different histories.
master ... test

@ -1,21 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arminta.doctor">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<application
android:label="doctor"
android:name="${applicationName}"
@ -46,7 +30,5 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDJpK9RVhlBejtJu9xSGfneuTN6HOfJgSM"/>
</application>
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 935 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 662 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -1,9 +1,4 @@
import 'dart:convert';
import 'package:doctor/common/qrcode_display.dart';
import 'package:doctor/common/updateprofile.dart';
import 'package:doctor/connected_patients/connected_patients.dart';
import 'package:doctor/patient_dashboard/patient_dashboard.dart';
import 'package:doctor/resources/resources.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
@ -134,19 +129,19 @@ class _DashboardState extends State<Dashboard> {
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/myconnections.png"), // picked file
"images/seekopinion.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
/* Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ConnectedPatients()),
);
builder: (context) => const SeekOpinion()),
);*/
},
),
Text(
'My Connections',
'Seek Opinion',
style: dashboardTextStyle(),
),
],
@ -162,19 +157,19 @@ class _DashboardState extends State<Dashboard> {
shape: BoxShape.circle,
image: DecorationImage(
image: AssetImage(
"images/patient_dashboard.png"), // picked file
"images/reports.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const PatientDashboard()),
);
builder: (context) => const AllReports()),
);*/
},
),
Text(
'Patient Dashboard',
'Records',
style: dashboardTextStyle(),
),
],
@ -183,43 +178,6 @@ class _DashboardState extends State<Dashboard> {
),
),
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/resources.png"), // picked file
fit: BoxFit.fitHeight)),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Resources()),
);
},
),
Text(
'Resources',
style: dashboardTextStyle(),
),
],
),
],
),
),
/*Padding(
padding: EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
@ -330,7 +288,7 @@ class _DashboardState extends State<Dashboard> {
),
],
),
)*/
)
]));
}
@ -340,9 +298,16 @@ class _DashboardState extends State<Dashboard> {
devicedetection();
}
/*Future<void> uploadProfileApi(image) async {
var payload = new Map<String, dynamic>();
payload["formData"] = image.toString();
var response1 = await AppSettings.updateProfilePicture(payload);
print(response1);
}*/
Future pickImageFromGallery() async {
try {
/* try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
@ -357,11 +322,11 @@ class _DashboardState extends State<Dashboard> {
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}*/
}
Future takeImageFromCamera() async {
try {
/*try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
@ -375,7 +340,7 @@ class _DashboardState extends State<Dashboard> {
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}*/
}
showLogoutAlertDialog(context) {
@ -462,143 +427,82 @@ class _DashboardState extends State<Dashboard> {
children: [
DrawerHeader(
decoration: const BoxDecoration(
color: secondaryColor,
color: buttonColors,
),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height:
child: GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .20,
height:
MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: (AppSettings.profilePictureUrl !=
'' &&
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: (AppSettings.profilePictureUrl !=
'' &&
AppSettings.profilePictureUrl !=
'null')
? NetworkImage(AppSettings
.profilePictureUrl)
as ImageProvider
: AssetImage(
? NetworkImage(AppSettings
.profilePictureUrl)
as ImageProvider
: AssetImage(
"images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment:
fit: BoxFit.fitWidth)),
),
onTap: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCamera();
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context)
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCamera();
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context)
.size
.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGallery();
Navigator.pop(context);
},
),
],
.20,
),
),
);
});
},
),
Container(
child: AppSettings.qrCode==''?TextButton(
child: Text(
'GetQR',
style: TextStyle(
fontSize: 15,
color: Colors.white,
decoration: TextDecoration.underline,
),
),
onPressed: () async{
AppSettings.preLoaderDialog(context);
try{
var value = await AppSettings.generateQRCode();
var valueResponse = jsonDecode(value);
String dataUri = jsonDecode(value)['qrCodeData'];
List<String> parts = dataUri.split(",");
String? base64String = parts.length == 2 ? parts[1] : null;
if (base64String != null) {
print(base64String);
AppSettings.qrCode=base64String;
} else {
print("Invalid data URI");
}
Navigator.of(context, rootNavigator: true).pop();
}
catch(e){
Navigator.of(context, rootNavigator: true).pop();
}
},
):GestureDetector(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const DisplayQrCode()),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGallery();
Navigator.pop(context);
},
),
],
),
),
);
},
child: Container(
height:MediaQuery.of(context).size.height * .20,
width:MediaQuery.of(context).size.width * .1,
child: Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode))),
),
),
)
],
});
},
),
),
Text(
AppSettings.doctorName,
AppSettings.userName,
style: drawerHeaderTextStyleNew(),
),
Text(
@ -632,8 +536,7 @@ class _DashboardState extends State<Dashboard> {
)
],
),
Container()
],
)),
ListTile(
@ -654,44 +557,16 @@ class _DashboardState extends State<Dashboard> {
],
),
onTap: () {
Navigator.push(
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UpdateProfile()),
);
);*/
},
),
Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: [
Image(
image: const AssetImage('images/editprofile.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
const SizedBox(
width: 10,
),
const SizedBox(
width: 10,
),
Text('Video Call', style: drawerListItemsTextStyle()),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UpdateProfile()),
);
},
),
/*Divider(
color: Colors.grey,
),
ListTile(
title: Row(
children: [
@ -882,7 +757,6 @@ class _DashboardState extends State<Dashboard> {
},
),
*/
Divider(
color: Colors.grey,
),

@ -104,7 +104,6 @@ class _LoginState extends State<Login> {
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
style: textFormFieldFilledTextStyle(),
keyboardType: TextInputType.number,
decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
@ -113,30 +112,29 @@ class _LoginState extends State<Login> {
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: secondaryColor,
cursorColor: greyColor,
obscureText: isObscureText,
controller: passwordController,
style: textFormFieldFilledTextStyle(),
decoration: InputDecoration(
fillColor: primaryColor,
fillColor: Colors.white,
filled: true,
labelText: 'Password',
prefixIcon: const Icon(Icons.lock, color: secondaryColor,),
prefixIcon: const Icon(Icons.password, color: greyColor,),
labelStyle: const TextStyle(
color: secondaryColor,fontWeight: FontWeight.bold //<-- SEE HERE
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: secondaryColor)),
borderSide: BorderSide(color: primaryColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: secondaryColor),
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: secondaryColor),
borderSide: BorderSide(color: primaryColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isObscureText==true?greyColor:secondaryColor,
color: isObscureText==true?greyColor:primaryColor,
),
onPressed: () {
@ -183,7 +181,7 @@ class _LoginState extends State<Login> {
),
onPressed: () async{
if (mobileNumberController.text != '' &&
/* if (mobileNumberController.text != '' &&
passwordController.text != '') {
AppSettings.preLoaderDialog(context);
@ -229,7 +227,7 @@ class _LoginState extends State<Login> {
else{
AppSettings.longFailedToast("Please enter valid details");
}
}*/
},
child: const Text('Login'),

@ -162,7 +162,7 @@ class _OtpScreenState extends State<OtpScreen> {
_fieldSix.text;
});
if (_otp!.length == 6) {
/*if (_otp!.length == 6) {
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
@ -200,7 +200,7 @@ class _OtpScreenState extends State<OtpScreen> {
}
else{
}
}*/
},
child: const Text('Submit')),
)

@ -1,123 +0,0 @@
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:doctor/common/settings.dart';
import 'package:flutter_share/flutter_share.dart';
import 'package:share/share.dart';
import 'dart:typed_data';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;
class DisplayQrCode extends StatefulWidget {
const DisplayQrCode({Key? key}) : super(key: key);
@override
State<DisplayQrCode> createState() => _DisplayQrCodeState();
}
class _DisplayQrCodeState extends State<DisplayQrCode> {
Future<void> share(var qr) async {
await FlutterShare.share(
title: 'Example share',
text: 'Example share text',
linkUrl: qr,
chooserTitle: 'Example Chooser Title');
}
Future<void> shareQRCodeImage1(qrData) async {
final tempDir = await getTemporaryDirectory();
final file = File('${tempDir.path}/qr_code.png');
await file.writeAsBytes(Uint8List.fromList(base64.decode(qrData)));
// Share the image using the share package
Share.shareFiles([file.path], text: 'Check out this QR code');
}
String imagePath = '';
Future<void> downloadQRImage() async {
final response = await http.get(Uri.parse(AppSettings.qrCode));
if (response.statusCode == 200) {
final directory = await getApplicationDocumentsDirectory();
final filePath = '${directory.path}/qr_image.png';
final File file = File(filePath);
await file.writeAsBytes(response.bodyBytes);
setState(() {
imagePath = filePath;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Qr Code'),
body: Container(
child: Padding(padding: EdgeInsets.all(10),
child: Column(
children: [
Center(
child: Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
width: MediaQuery.of(context).size.width * .60, // Set the desired width
height: MediaQuery.of(context).size.height * .35, // Set the desired height
child:
Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode),),
fit: BoxFit.fill),
),
),
SizedBox(
height:MediaQuery.of(context).size.height * .05,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
//share(AppSettings.qrCode);
shareQRCodeImage1(AppSettings.qrCode);
},
icon: Icon(
Icons.share,
color: primaryColor,
size: 40,
),
),
/*IconButton(
onPressed: () {
downloadQRImage();
},
icon: Icon(
Icons.download,
color: primaryColor,
size: 40,
),
),*/
],
)
/*Container(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
child: Center(child: Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode),),),),
)*/
],
),),
),
);
}
}

File diff suppressed because it is too large Load Diff

@ -36,10 +36,6 @@ class _SignUpState extends State<SignUp> {
TextEditingController userAddressCapturingController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController confirmPasswordController = TextEditingController();
FocusNode myFocusNode = new FocusNode();
String? gender;
var genderUnitItems = [
'Male',
'Female',
@ -69,6 +65,11 @@ class _SignUpState extends State<SignUp> {
isConfirmPwdObscureText = true;
super.initState();
}
PickResult? selectedPlace;
bool _mapsInitialized = false;
@ -162,7 +163,6 @@ class _SignUpState extends State<SignUp> {
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(
@ -180,15 +180,15 @@ class _SignUpState extends State<SignUp> {
),
Container(
child: TextFormField(
cursorColor: secondaryColor,
controller: nameController,
style: textFormFieldFilledTextStyle(),
textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration(Icons.person,'Enter Name'),
),
), //name
cursorColor: greyColor,
controller: nameController,
textCapitalization: TextCapitalization.words,
decoration: textFormFieldDecoration(Icons.person,'Enter Name'),
/*Container(
),
), //name
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: DropdownButtonFormField(
// Initial Value
value: genderUnit,
@ -235,14 +235,13 @@ class _SignUpState extends State<SignUp> {
genderUnit = newValue!;
});
},
),),*/
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: secondaryColor,
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.phone,
style: textFormFieldFilledTextStyle(),
maxLength: 10,
decoration: textFormFieldDecoration(Icons.phone_android,'Enter Mobile Number'),
),
@ -251,9 +250,8 @@ class _SignUpState extends State<SignUp> {
GestureDetector(
child: Container(
child: TextFormField(
cursorColor: secondaryColor,
cursorColor: greyColor,
controller: userAddressCapturingController,
style: textFormFieldFilledTextStyle(),
onTap:()
{
@ -358,7 +356,6 @@ class _SignUpState extends State<SignUp> {
},
keyboardType: TextInputType.streetAddress,
readOnly: true,
decoration:textFormFieldDecoration(Icons.location_on_rounded,'Click to select address(map)'),
),
@ -370,85 +367,42 @@ class _SignUpState extends State<SignUp> {
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: secondaryColor,
cursorColor: greyColor,
controller: userAddressDescriptionController,
style: textFormFieldFilledTextStyle(),
keyboardType: TextInputType.emailAddress,
decoration: textFormFieldDecoration(Icons.plagiarism_outlined,'Address Description (Ex: Flat No)'),
),
),//address description
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Select Gender',style: textFormFieldFilledTextStyle(),),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: TextStyle(color: secondaryColor,fontSize: 11)),
value: "male",
groupValue: gender,
activeColor: secondaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style:TextStyle(color: secondaryColor,fontSize: 11)),
value: "female",
groupValue: gender,
activeColor: secondaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: TextStyle(color: secondaryColor,fontSize: 11)),
value: "other",
groupValue: gender,
activeColor: secondaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),
Container(
child: TextFormField(
cursorColor: secondaryColor,
cursorColor: greyColor,
obscureText: isPwdObscureText,
controller: passwordController,
style: textFormFieldFilledTextStyle(),
decoration: InputDecoration(
fillColor: primaryColor,
fillColor: Colors.white,
filled: true,
labelText: 'Create Password',
prefixIcon: const Icon(
Icons.lock,
color: secondaryColor,
color: greyColor,
),
labelStyle: const TextStyle(
color: secondaryColor,fontWeight: FontWeight.bold //<-- SEE HERE
color: Colors.black, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: secondaryColor)),
borderSide: BorderSide(color: primaryColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: secondaryColor),
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: secondaryColor),
borderSide: BorderSide(color: primaryColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isPwdObscureText?greyColor:secondaryColor,
color: isPwdObscureText?greyColor:primaryColor,
),
onPressed: () {
setState(() {
@ -469,75 +423,73 @@ class _SignUpState extends State<SignUp> {
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (nameController.text != '' &&
/* if (nameController.text != '' &&
passwordController.text != '' &&
mobileNumberController.text != ''&&gender!='') {
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["doctorName"] = nameController.text.toString();
payload["password"] =
passwordController.text.toString();
payload["phone"] =
mobileNumberController.text.toString();
payload["emails"] = [
{"email": emailController.text.toString()}
];
payload["address1"] = userAddressCapturingController.text;
payload["address2"] = '';
payload["latitude"] = lat;
payload["longitude"] = lng;
payload["gender"] = gender.toString();
bool signUpStatus = await AppSettings.signUp(payload);
try {
if (signUpStatus) {
var smsPayload = new Map<String, dynamic>();
smsPayload["mobileNumbers"] = mobileNumberController.text.toString();
bool sendSms = await AppSettings.sendSms(smsPayload);
if(sendSms){
Navigator.of(context, rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OtpScreen(myObject: mobileNumberController.text.toString(),)),
);
}
else{
Navigator.of(context, rootNavigator: true).pop();
}
mobileNumberController.text != '') {
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["username"] = nameController.text.toString();
payload["password"] =
passwordController.text.toString();
payload["phone"] =
mobileNumberController.text.toString();
payload["firstName"] = nameController.text.toString();
payload["emails"] = [
{"email": emailController.text.toString()}
];
payload["lastName"] = '';
payload["address1"] = userAddressCapturingController.text;
payload["address2"] = '';
payload["city"] = '';
payload["state"] = '';
payload["zip"] = '';
payload["country"] = '';
payload["notes"] = '';
payload["latitude"] = lat;
payload["longitude"] = lng;
payload["fcmId"] = AppSettings.fcmId;
payload["age"] = 0;
payload["gender"] = genderUnit.toString();
bool signUpStatus = await AppSettings.signUp(payload);
try {
if (signUpStatus) {
var smsPayload = new Map<String, dynamic>();
smsPayload["mobileNumbers"] = mobileNumberController.text.toString();
bool sendSms = await AppSettings.sendSms(smsPayload);
if(sendSms){
Navigator.of(context, rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OtpScreen(myObject: mobileNumberController.text.toString(),)),
);
}
else {
else{
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast(
"Mobile number already exists");
}
} catch (exception) {
print(exception);
}
else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("Please enter valid details");
AppSettings.longFailedToast(
"Mobile number already exists");
}
}
else{
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('Please check your internet connection'),));
} 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

@ -1,7 +1,6 @@
import 'dart:convert';
import 'package:doctor/common/zoom_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -20,25 +19,11 @@ class UpdateProfile extends StatefulWidget {
class _UpdateprofileState extends State<UpdateProfile> {
bool isPwdObscureText=true;
bool isFirstAddButtonShow=false;
bool isSecondAddButtonShow=false;
bool is2ndPlaceOfPracticeControllerVisible=false;
bool is3rdPlaceOfPracticeControllerVisible=false;
bool isConfirmPwdObscureText=true;
TextEditingController nameController = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController ageController = TextEditingController();
TextEditingController specializationController = TextEditingController();
TextEditingController qualificationController = TextEditingController();
TextEditingController hospitalNameController1 = TextEditingController();
TextEditingController hospitalNameController2 = TextEditingController();
TextEditingController hospitalNameController3 = TextEditingController();
TextEditingController practiceAddressController1 = TextEditingController();
TextEditingController practiceAddressController2 = TextEditingController();
TextEditingController practiceAddressController3 = TextEditingController();
String? gender;
List placeOfPractices=[];
@ -47,19 +32,10 @@ class _UpdateprofileState extends State<UpdateProfile> {
void initState() {
isPwdObscureText=true;
isConfirmPwdObscureText=true;
nameController.text=AppSettings.doctorName;
nameController.text=AppSettings.userName;
mobileNumberController.text=AppSettings.phoneNumber;
emailController.text=AppSettings.email;
specializationController.text=AppSettings.specialization;
qualificationController.text=AppSettings.qualification;
ageController.text=AppSettings.age;
gender=AppSettings.gender;
hospitalNameController1.text=AppSettings.placeOfPractice1;
hospitalNameController2.text=AppSettings.placeOfPractice2;
hospitalNameController3.text=AppSettings.placeOfPractice3;
practiceAddressController1.text=AppSettings.placeOfPracticeAddress1;
practiceAddressController2.text=AppSettings.placeOfPracticeAddress2;
practiceAddressController3.text=AppSettings.placeOfPracticeAddress3;
super.initState();
@ -69,7 +45,7 @@ class _UpdateprofileState extends State<UpdateProfile> {
final ImagePicker _picker = ImagePicker();
Future pickImageFromGallery() async {
try {
/* try {
final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return;
final imageTemp = File(image.path);
@ -83,11 +59,11 @@ class _UpdateprofileState extends State<UpdateProfile> {
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}*/
}
Future takeImageFromCamera() async {
try {
/*try {
final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return;
final imageTemp = File(image.path);
@ -101,7 +77,7 @@ class _UpdateprofileState extends State<UpdateProfile> {
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}*/
}
@ -125,552 +101,207 @@ class _UpdateprofileState extends State<UpdateProfile> {
},
child: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(
height:MediaQuery.of(context).size.height * .02,
child: Column(
children: <Widget>[
SizedBox(
height: 40,
),
/*Container(
child: Image(
image: AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .10,
)),*/
Container(child: GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .20,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ?
NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth)),
),
Container(child: GestureDetector(
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .20,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ?
NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth)),
),
onTap: () {
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Profile',imageDetails:AppSettings.profilePictureUrl)));
},
),),
TextButton(
child: const Text(
'Change',
style: TextStyle(decoration: TextDecoration.underline,color: primaryColor,fontSize: 12),
),
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCamera();
Navigator.pop(context);
},
onTap: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
SizedBox(
width:
MediaQuery.of(context).size.width * .20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGallery();
Navigator.pop(context);
},
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);
},
),
],
),
);
});
//signup screen
},
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'DoctorName',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
);
});
},
),),
SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
),
),//name
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: emailController,
keyboardType: TextInputType.emailAddress,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.email,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter email ID',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
),
), //email
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone_android,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter Mobile Number',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
),
), //mobile
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: ageController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
labelText: 'Username',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Select Gender',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: RadioListTile(
title: Text("Male",style: TextStyle(color: primaryColor,fontSize: 11)),
value: "male",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Female",style:TextStyle(color: primaryColor,fontSize: 11)),
value: "female",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
Expanded(child: RadioListTile(
title: Text("Others",style: TextStyle(color: primaryColor,fontSize: 11)),
value: "other",
groupValue: gender,
activeColor: primaryColor,
onChanged: (value){
setState(() {
gender = value.toString();
});
},
),),
],
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: qualificationController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.quickreply,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter qualification',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),//name
const SizedBox(
height: 15,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: emailController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.email,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter email ID',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: specializationController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.folder_special,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter specialization',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
), //email
SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone_android,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter Mobile Number',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Place of practice',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice address',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: hospitalNameController1.text!='',
child: IconButton(
onPressed: (){
setState(() {
is2ndPlaceOfPracticeControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
), //mobile
SizedBox(
height: 10,
),
SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: ageController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:hospitalNameController2.text!=''&&hospitalNameController2.text!='null'||is2ndPlaceOfPracticeControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice place',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: hospitalNameController2.text!='',
child: IconButton(
onPressed: (){
setState(() {
is3rdPlaceOfPracticeControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible: hospitalNameController3.text!=''&&hospitalNameController3.text!='null'||is3rdPlaceOfPracticeControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: hospitalNameController3,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter hospital name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
TextFormField(
cursorColor: greyColor,
controller: practiceAddressController3,
onChanged:(val) {
},
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_on,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter practice place',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
],
),
),
Container(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
),),
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: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async{
if(hospitalNameController1!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController1.text,
'address': practiceAddressController1.text
});
}
if(hospitalNameController2!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController2.text,
'address': practiceAddressController2.text
});
}
if(hospitalNameController3!=''){
placeOfPractices.add({
'hospitalName': hospitalNameController3.text,
'address': practiceAddressController3.text
});
}
onPressed: () async{
int age=0;
if(ageController.text.toString()!=''||ageController.text.toString()!='null'){
/*int age=0;
if(ageController.text.toString()!=''){
age=int.parse(ageController.text.toString());
}
else{
age=0;
}
var payload = new Map<String, dynamic>();
payload["doctorName"] = nameController.text.toString();
payload["username"] = nameController.text.toString();
payload["phone"] = mobileNumberController.text.toString();
payload["age"] = age;
payload["gender"] = gender;
payload["specialization"] = specializationController.text;
payload["qualification"] =qualificationController.text ;
payload["placeOfPractice"] =placeOfPractices ;
payload["emails"] = [{"email":emailController.text.toString()}];
bool signUpStatus = await AppSettings.updateProfile(payload);
try{
@ -689,17 +320,15 @@ class _UpdateprofileState extends State<UpdateProfile> {
catch(exception){
print(exception);
AppSettings.longFailedToast("Please enter valid details");
}
},
child: Text('Update'),
)
),
}*/
},
child: Text('Update'),
)
),
],
),
)
],
),
)),
),
]));

@ -15,43 +15,17 @@ class _ImageZoomPageState extends State<ImageZoomPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppBar(
backgroundColor: primaryColor,
title: Text(widget.imageName),
actions: [
IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.cancel,
color: buttonColors,
size: 30,
),
),
],
),
appBar: AppSettings.appBar(widget.imageName),
body: Container(
//width: MediaQuery.of(context).size.width * .10,
//height: MediaQuery.of(context).size.height * .50,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(padding:EdgeInsets.fromLTRB(10,10,10,0),
child: Text('Use two fingers to zoom/double tap',style: TextStyle(color: Colors.black,fontSize: 12),),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Expanded(
child: PhotoView(
imageProvider: NetworkImage(widget.imageDetails) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
//width: MediaQuery.of(context).size.width * .10,
//height: MediaQuery.of(context).size.height * .50,
child: PhotoView(
imageProvider: NetworkImage(widget.imageDetails) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
),
)
],
)
),

@ -1,230 +0,0 @@
import 'dart:convert';
import 'package:doctor/common/settings.dart';
import 'package:doctor/connected_patients/patient_records.dart';
import 'package:doctor/models/connected_patients_model.dart';
import 'package:flutter/material.dart';
class ConnectedPatients extends StatefulWidget {
const ConnectedPatients({Key? key}) : super(key: key);
@override
State<ConnectedPatients> createState() => _ConnectedPatientsState();
}
class _ConnectedPatientsState extends State<ConnectedPatients> {
bool isConnectedPatientsDataLoading=false;
bool isSereverIssue=false;
List<GetConnectedPatientsModel> connectedPatientsList = [];
Future<void> getAllConnectedPatients() async {
isConnectedPatientsDataLoading=true;
try {
var response = await AppSettings.getAllConectedPatients();
setState(() {
connectedPatientsList = ((jsonDecode(response)) as List)
.map((dynamic model) {
return GetConnectedPatientsModel.fromJson(model);
}).toList();
connectedPatientsList=connectedPatientsList.reversed.toList();
isConnectedPatientsDataLoading = false;
});
} catch (e) {
setState(() {
isConnectedPatientsDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
getAllConnectedPatients();
super.initState();
}
Widget _patients(){
if(connectedPatientsList.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: connectedPatientsList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: (){
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new PatientRecords(patientDetails: connectedPatientsList[index],)));
},
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding:EdgeInsets.all(8) ,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Patient Name',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Phone Number',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Age',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Gender',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(connectedPatientsList[index].user_name.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
connectedPatientsList[index].phone_number,
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
connectedPatientsList[index].age+' Yrs',
style: valuesTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
connectedPatientsList[index].gender,
style: valuesTextStyle(),
),
],
),
],
),
),
],
),
],
),
),
),
);
});
}
else{
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: MediaQuery.of(context).size.height * .25,),
Text('No Connected patients available'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.info,
color: Colors.white,
),
onPressed: () async {
/*Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports())).then((value) {
getAllRecords();
});*/
},
),
)
],
),
)
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Connected Patients'),
body: Container(
child: isConnectedPatientsDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _patients(),
),
);
}
}

File diff suppressed because it is too large Load Diff

@ -1,281 +0,0 @@
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/common/zoom_image.dart';
class AllRecordsOnClick extends StatefulWidget {
var recordDetails;
var initialIndex;
AllRecordsOnClick({this.recordDetails,this.initialIndex});
@override
State<AllRecordsOnClick> createState() => _AllRecordsOnClickState();
}
class _AllRecordsOnClickState extends State<AllRecordsOnClick>
with TickerProviderStateMixin {
final ImagePicker imagePicker = ImagePicker();
List imageFileList = [];
final ImagePicker _picker = ImagePicker();
@override
void initState() {
super.initState();
}
Widget findings(var obj){
if(obj.findingsImages.length!=0){
return Container(
//color: secondaryColor,
width: double.infinity,
height: MediaQuery.of(context).size.height * .20,
child: Row(
children: [
Expanded(child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: obj.findingsImages.length,
itemBuilder: (context, index) {
return Row(
children: [
Card(
child: GestureDetector(
onTap: (){
//showPicDialog(obj.prescriptionImages[index]['url']);
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Findings',imageDetails:obj.findingsImages[index]['url'])));},
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(
obj.findingsImages[index]['url'])
as ImageProvider, // picked file
fit: BoxFit.fill)),
),
),
)
],
);
}),),
],
)
);
}
else{
return GestureDetector(
child: Row(
children: [
Icon(
Icons.info,
color: Colors.green,
size: 40,
),
Text('No Findings found',style: textButtonStyle(),)
],
),
);
}
}
Widget reports(var obj){
if(obj.reportImages.length!=0){
return Container(
//color: secondaryColor,
width: double.infinity,
height: MediaQuery.of(context).size.height * .20,
child: Row(
children: [
Expanded(child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: obj.reportImages.length,
itemBuilder: (context, index) {
return Row(
children: [
Card(
child: GestureDetector(
onTap: (){
//showPicDialog(obj.prescriptionImages[index]['url']);
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Findings',imageDetails:obj.reportImages[index]['url'])));},
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(
obj.reportImages[index]['url'])
as ImageProvider, // picked file
fit: BoxFit.fill)),
),
),
)
],
);
}),),
],
)
);
}
else{
return GestureDetector(
child: Row(
children: [
Icon(
Icons.info,
color: Colors.green,
size: 40,
),
Text('No Reports found',style: textButtonStyle(),)
],
),
);
}
}
Widget prescriptions(var obj){
if(obj.prescriptionImages.length!=0){
return Container(
//color: secondaryColor,
width: double.infinity,
height: MediaQuery.of(context).size.height * .20,
child: Row(
children: [
Expanded(child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: obj.prescriptionImages.length,
itemBuilder: (context, index) {
return Row(
children: [
Card(
child: GestureDetector(
onTap: (){
//showPicDialog(obj.prescriptionImages[index]['url']);
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Prescriptions',imageDetails:obj.prescriptionImages[index]['url'])));},
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(
obj.prescriptionImages[index]['url'])
as ImageProvider, // picked file
fit: BoxFit.fill)),
),
),
)
],
);
}),),
],
)
);
}
else{
return GestureDetector(
child: Row(
children: [
Icon(
Icons.info,
color: Colors.green,
size: 40,
),
Text('No Prescriptions found',style: textButtonStyle(),)
],
),
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Records'),
body: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: MediaQuery.of(context).size.height * .15,
width: double.infinity,
child: Padding(
padding: EdgeInsets.all(0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Problem: ' +
widget.recordDetails.problem.toString().toUpperCase(),
style: problemTextStyle()),
Text(widget.recordDetails.doctorName.toString().toUpperCase(),
style: valuesTextStyle()),
Text(
widget.recordDetails.hospitalName
.toString()
.toUpperCase(),
style: valuesTextStyle()),
Text(widget.recordDetails.date.toString().toUpperCase(),
style: valuesTextStyle()),
Text('Patient details: ', style: problemTextStyle()),
Text(
widget.recordDetails.patient_name
.toString()
.toUpperCase(),
style: valuesTextStyle()),
Row(
children: [
Text(widget.recordDetails.gender.toString().toUpperCase(),
style: valuesTextStyle()),
SizedBox(
width: MediaQuery.of(context).size.width * .05,
),
Text(
widget.recordDetails.age.toString().toUpperCase() +
" Yrs",
style: valuesTextStyle()),
],
),
],
),
),
),
Text('Findings',style: TextStyle(color: Colors.red,fontSize: 16,fontWeight: FontWeight.bold),),
findings(widget.recordDetails),
Text('Reports',style: TextStyle(color: Colors.red,fontSize: 16,fontWeight: FontWeight.bold),),
reports(widget.recordDetails),
Text('Prescriptions',style: TextStyle(color: Colors.red,fontSize: 16,fontWeight: FontWeight.bold),),
prescriptions(widget.recordDetails)
],
),
),
);
}
}

@ -1,5 +1,4 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:uuid/uuid.dart';

@ -1,32 +0,0 @@
import 'package:flutter/material.dart';
import 'helper.dart';
class AppColors {
AppColors._();
static const Color primaryColor = Color(0xffed1846);
static const Color secondaryColor = Color(0xff5bcb84);
static const Color tColor = Color(0xfff087ca);
static const Color rColor = Color(0xfff08c87);
static const Color statusColorPending = Color(0xfff8c942);
static const Color statusColorInProgress = Color(0xff587add);
static const Color statusColorConfirm = Color(0xff30d300);
static const Color pageBgColor = Color(0xFFF6F6F6);
static const Color grey100Color = Color(0xFFEEEEEE);
static const Color grey200Color = Color(0xFFEEEEEE);
static const Color grey300Color = Color(0xFFE0E0E0);
static const Color grey400Color = Color(0xFFBDBDBD);
static const Color grey500Color = Color(0xFF9E9E9E);
static const Color grey600Color = Color(0xFF757575);
static const Color grey700Color = Color(0xFF616161);
static const Color grey800Color = Color(0xFF424242);
static const Color grey900Color = Color(0xFF212121);
static const Color errorColor = Color(0xFFD50000);
static const Color error100Color = Color(0xffFF5252);
static const Color mainBgColor = Color(0xfff7f7f7);
static const Color logoColor = Color(0xfff1ea0c);
static MaterialColor primaryMaterialColor = getSwatch(primaryColor);
static MaterialColor errorMaterialColor = getSwatch(errorColor);
static MaterialColor tableRowMaterialColor = getSwatch(grey500Color);
}

@ -1,4 +0,0 @@
class AppImages {
static const String pickupMarker = "assets/images/pickup_marker.png";
static const String dropMarker = "assets/images/drop_marker.png";
}

@ -1,25 +0,0 @@
import 'dart:ui';
import 'package:get/get.dart';
class AppSizes {
// get height and width from getX
static final double deviceHeight = Get.height;
static final double deviceWidth = Get.width;
static const int height1060 = 1060;
static const int height880 = 880;
static const int height740 = 740;
static const int height490 = 490;
static const int width1060 = 1060;
static const int width880 = 880;
static const int width740 = 740;
static const int width490 = 490;
static const int screen720x1280 = 490;
static final double mapPinSize = (deviceWidth * window.devicePixelRatio);
}

@ -1,34 +0,0 @@
import 'package:flutter/material.dart';
MaterialColor getSwatch(Color color) {
final hslColor = HSLColor.fromColor(color);
final lightness = hslColor.lightness;
/// if [500] is the default color, there are at LEAST five
/// steps below [500]. (i.e. 400, 300, 200, 100, 50.) A
/// divisor of 5 would mean [50] is a lightness of 1.0 or
/// a color of #ffffff. A value of six would be near white
/// but not quite.
const lowDivisor = 6;
/// if [500] is the default color, there are at LEAST four
/// steps above [500]. A divisor of 4 would mean [900] is
/// a lightness of 0.0 or color of #000000
const highDivisor = 5;
final lowStep = (1.0 - lightness) / lowDivisor;
final highStep = lightness / highDivisor;
return MaterialColor(color.value, {
50: (hslColor.withLightness(lightness + (lowStep * 5))).toColor(),
100: (hslColor.withLightness(lightness + (lowStep * 4))).toColor(),
200: (hslColor.withLightness(lightness + (lowStep * 3))).toColor(),
300: (hslColor.withLightness(lightness + (lowStep * 2))).toColor(),
400: (hslColor.withLightness(lightness + lowStep)).toColor(),
500: (hslColor.withLightness(lightness)).toColor(),
600: (hslColor.withLightness(lightness - highStep)).toColor(),
700: (hslColor.withLightness(lightness - (highStep * 2))).toColor(),
800: (hslColor.withLightness(lightness - (highStep * 3))).toColor(),
900: (hslColor.withLightness(lightness - (highStep * 4))).toColor(),
});
}

@ -1,120 +0,0 @@
import 'dart:developer';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
import 'app_images.dart';
import 'app_sizes.dart';
import 'permission_alert.dart';
class LocationController<T> extends GetxController {
Location location = Location();
// final Rx<LatLng?> locationPosition = const LatLng(0.0, 0.0).obs;
/*final Rx<LatLng?> locationPosition =
const LatLng(12.90618717, 77.5844983).obs;*/
final Rx<LatLng?> locationPosition =
const LatLng(0, 0).obs;
bool locationServiceActive = true;
BitmapDescriptor? pickupMarker;
BitmapDescriptor? dropMarker;
@override
void onInit() async {
await _getBytesFromAsset(AppImages.pickupMarker, AppSizes.mapPinSize * 0.1);
await _getBytesFromAsset(AppImages.dropMarker, AppSizes.mapPinSize * 0.05);
super.onInit();
refreshToLiveLocation();
}
Future<void> _getBytesFromAsset(String path, double size) async {
ByteData data = await rootBundle.load(path);
ui.Codec codec = await ui.instantiateImageCodec(
data.buffer.asUint8List(),
targetWidth: size.toInt(),
allowUpscaling: true,
);
ui.FrameInfo fi = await codec.getNextFrame();
if (path == AppImages.pickupMarker) {
pickupMarker = BitmapDescriptor.fromBytes(
(await fi.image.toByteData(format: ui.ImageByteFormat.png))!
.buffer
.asUint8List());
} else if (path == AppImages.dropMarker) {
dropMarker = BitmapDescriptor.fromBytes(
(await fi.image.toByteData(format: ui.ImageByteFormat.png))!
.buffer
.asUint8List());
} else {}
}
refreshToLiveLocation() async {
log("initiating");
bool serviceEnabled;
PermissionStatus permissionGranted;
serviceEnabled = await location.serviceEnabled();
if (!serviceEnabled) {
serviceEnabled = await location.requestService();
locationPosition.value = null;
return;
}
log("permission check");
permissionGranted = await location.hasPermission();
if (permissionGranted == PermissionStatus.denied) {
permissionGranted = await location.requestPermission();
if (permissionGranted != PermissionStatus.granted) {
showPermissionAlertDialog(
requestMsg:
"Location access needed. Go to Android settings, tap App permissions and tap Allow.",
barrierDismissible: false,
);
} else {
await location.changeSettings(
accuracy: LocationAccuracy.high,
interval: 2000,
distanceFilter: 2);
location.onLocationChanged.listen((LocationData currentLocation) async {
var lat = currentLocation.latitude;
var long = currentLocation.longitude;
if (lat != null && long != null) {
locationPosition.value = LatLng(
lat,
long,
);
log("live location ${locationPosition.value}");
}
});
}
} else {
await location.changeSettings(
accuracy: LocationAccuracy.high,
interval: 2000,
distanceFilter: 2);
location.onLocationChanged.listen((LocationData currentLocation) async {
var lat = currentLocation.latitude;
var long = currentLocation.longitude;
if (lat != null && long != null) {
locationPosition.value = LatLng(
lat,
long,
);
log("live location ${locationPosition.value}");
}
});
}
}
}

@ -1,252 +0,0 @@
import 'dart:async';
import 'dart:developer';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
import 'location_controller.dart';
class OrderTrackingPage extends StatefulWidget {
var lat;
var lng;
var d_lat;
var d_lng;
var u_address;
OrderTrackingPage({
this.lat,
this.lng,
this.d_lat,
this.d_lng,
this.u_address
});
@override
OrderTrackingPageState createState() => OrderTrackingPageState();
}
class OrderTrackingPageState extends State<OrderTrackingPage> {
final Completer<GoogleMapController> mapController = Completer();
PolylinePoints polylinePoints = PolylinePoints();
double latitude=0;
double longitude=0;
double d_latitude=0;
double d_longitude=0;
String u_address = '';
LocationData? currentLocation;
String googleAPiKey ="AIzaSyDJpK9RVhlBejtJu9xSGfneuTN6HOfJgSM";
Set<Marker> markers = {};
Map<PolylineId, Polyline> polylines = {};
late LatLng startLocation ;
late LatLng user_location;
LocationController locationController = Get.put(LocationController());
double distance = 0.0;
@override
void initState() {
super.initState();
latitude=widget.lat;
longitude=widget.lng;
d_latitude=widget.d_lat;
d_longitude=widget.d_lng;
u_address=widget.u_address;
user_location = LatLng(widget.lat,widget.lng);
startLocation = LatLng(widget.d_lat,widget.d_lng);
LatLng delivery_Location = LatLng(widget.d_lat,widget.d_lng);
//LatLng endLocation = LatLng(17.4968,78.3614);
ever<LatLng?>(locationController.locationPosition, (value) {
if (value != null) {
// log("${value.latitude} ${value.longitude}");
var latitude = value.latitude;
var longitude = value.longitude;
startLocation = LatLng(widget.d_lat, widget.d_lng);
getDirections(user_location);
}
});
getDirections(user_location); //fetch direction polylines from Google API
}
getDirections(user_location) async {
markers.clear();
markers.add(Marker(
markerId: MarkerId(startLocation.toString()),
position: startLocation,
infoWindow: const InfoWindow(
title: 'Starting Point',
snippet: 'Start Marker',
),
icon: locationController.pickupMarker ?? BitmapDescriptor.defaultMarker,
));
markers.add(Marker(
markerId: MarkerId(user_location.toString()),
position: user_location, //position of marker
infoWindow: const InfoWindow(
title: 'Destination Point ',
snippet: 'Destination Marker',
),
icon: locationController.dropMarker ?? BitmapDescriptor.defaultMarker,
));
List<LatLng> polylineCoordinates = [];
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
googleAPiKey,
PointLatLng(startLocation.latitude, startLocation.longitude),
PointLatLng(user_location.latitude, user_location.longitude),
travelMode: TravelMode.driving,
);
if (result.points.isNotEmpty) {
for (var point in result.points) {
polylineCoordinates.add(LatLng(point.latitude, point.longitude));
}
} else {
// log(result.errorMessage ?? "Something went wrong");
}
//polulineCoordinates is the List of longitute and latidtude.
double totalDistance = 0;
for(var i = 0; i < polylineCoordinates.length-1; i++){
totalDistance += calculateDistance(
polylineCoordinates[i].latitude,
polylineCoordinates[i].longitude,
polylineCoordinates[i+1].latitude,
polylineCoordinates[i+1].longitude);
}
print(totalDistance);
setState(() {
distance = totalDistance;
});
addPolyLine(polylineCoordinates);
}
addPolyLine(List<LatLng> polylineCoordinates) async {
PolylineId id = const PolylineId("poly");
Polyline polyline = Polyline(
polylineId: id,
color: Colors.deepPurpleAccent,
points: polylineCoordinates,
width:8,
);
polylines[id] =polyline;
var position = CameraPosition(
target: LatLng(latitude,longitude),
zoom: 16);
final GoogleMapController controller = await mapController.future;
controller.animateCamera(CameraUpdate.newCameraPosition(position));
setState(() {});
}
double calculateDistance(lat1, lon1, lat2, lon2){
var p = 0.017453292519943295;
var a = 0.5 - cos((lat2 - lat1) * p)/2 +
cos(lat1 * p) * cos(lat2 * p) *
(1 - cos((lon2 - lon1) * p))/2;
return 12742 * asin(sqrt(a));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
GoogleMap(
//Map widget from google_maps_flutter package
zoomGesturesEnabled: true,
//enable Zoom in, out on map
initialCameraPosition: CameraPosition(
//innital position in map
target: startLocation, //initial position
zoom: 8.0, //initial zoom level
),
markers: markers,
//markers to show on map
polylines: Set<Polyline>.of(polylines.values),
//polylines
mapType: MapType.normal,
//map type
onMapCreated: (controller) {
//method called when map is created
if (!mapController.isCompleted) {
mapController.complete(controller);
}
},
),
const SizedBox(
height: 95,
),
Positioned(
bottom: 100,
left: 50,
child: Container(
child: Card(
child: Container(
padding: EdgeInsets.all(20),
child: Text("Total Distance: " + distance.toStringAsFixed(2) + " KM",
style: TextStyle(fontSize: 20, fontWeight:FontWeight.bold))
),
)
)),
/* const SizedBox(
height: 30,
),
Positioned(
bottom: 80,
left: 0,
child: Container(
child: Card(
child: Container(
padding: EdgeInsets.all(20),
child: Text("User Address: " + u_address.toString() ,
style: TextStyle(fontSize: 15, fontWeight:FontWeight.bold,overflow: TextOverflow.ellipsis))
),
)
)),
const SizedBox(
height: 30,
),
Positioned(
bottom: 10,
left: 50,
child: Container(
child: Card(
child: Container(
padding: EdgeInsets.all(20),
child: Text("Total DistanceD: " + distance.toStringAsFixed(2) + " KM",
style: TextStyle(fontSize: 20, fontWeight:FontWeight.bold))
),
)
)),*/
],
)
);
}
}

@ -1 +0,0 @@
enum PaddingType { symmetric, only }

@ -1,53 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:permission_handler/permission_handler.dart';
import 'app_colors.dart';
import 'primary_button.dart';
import 'primary_text.dart';
void showPermissionAlertDialog({
String title = "Need Permission",
required String requestMsg,
bool barrierDismissible = true,
}) {
Get.defaultDialog(
title: title,
middleText: "",
backgroundColor: Colors.white,
contentPadding: const EdgeInsets.only(top: 30, bottom: 30.0),
radius: 10,
barrierDismissible: barrierDismissible,
titlePadding: const EdgeInsets.only(top: 15),
titleStyle: const TextStyle(
color: AppColors.grey900Color,
fontSize: 18,
fontWeight: FontWeight.w600,
),
/*cancel: PrimaryButton(
title: "DISMISS",
onPressed: () {},
textSize: AppSizes.font_13,
bgColor: AppColors.grey500Color,
),*/
confirm: PrimaryButton(
title: "GO TO SETTINGS",
onPressed: () {
openAppSettings();
Get.back();
},
textSize: 13,
),
content: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: PrimaryText(
requestMsg,
textAlign: TextAlign.center,
fontColor: AppColors.grey800Color,
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
);
}

@ -1,65 +0,0 @@
import 'package:flutter/material.dart';
import 'app_colors.dart';
import 'primary_text.dart';
class PrimaryButton extends StatelessWidget {
final String title;
final VoidCallback onPressed;
final double verticalPadding;
final bool textAllCaps;
final double textSize;
final FontWeight textWeight;
final Color textColor;
final TextDecoration textDecoration;
final int letterSpacing;
final bool isResponsive;
final Color bgColor;
final double horizontalPadding;
const PrimaryButton({
Key? key,
required this.title,
required this.onPressed,
this.verticalPadding = 10.0,
this.textAllCaps = true,
this.textSize = 14,
this.textWeight = FontWeight.w500,
this.textColor = Colors.white,
this.textDecoration = TextDecoration.none,
this.letterSpacing = 1,
this.isResponsive = true,
this.bgColor = AppColors.primaryColor,
this.horizontalPadding = 25.0,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40),
),
color: bgColor,
child: InkWell(
onTap: onPressed,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: verticalPadding,
horizontal: horizontalPadding,
),
child: PrimaryText(
textAllCaps ? title.toUpperCase() : title,
// title.toUpperCase(),
textAlign: TextAlign.center,
fontSize: textSize,
fontWeight: textWeight,
fontColor: textColor,
textDecoration: textDecoration,
isResponsive: isResponsive,
),
),
),
);
}
}

@ -1,88 +0,0 @@
import 'package:flutter/material.dart';
import 'app_sizes.dart';
import 'padding_type_enum.dart';
class PrimaryText extends StatelessWidget {
final String text;
final Color? fontColor;
final double fontSize;
final FontWeight fontWeight;
final double horizontalPadding;
final double verticalPadding;
final TextAlign textAlign;
final bool isResponsive;
final TextDecoration? textDecoration;
final PaddingType paddingType;
final double leftPadding;
final double rightPadding;
final double lineHeight;
final FontStyle fontStyle;
final TextOverflow textOverflow;
final bool textAllCaps;
final double letterSpacing;
const PrimaryText(
this.text, {
Key? key,
this.fontColor = Colors.black,
this.fontSize = 16,
this.fontWeight = FontWeight.w600,
this.horizontalPadding = 0.0,
this.verticalPadding = 0.0,
this.textAlign = TextAlign.start,
this.isResponsive = true,
this.textDecoration,
this.paddingType = PaddingType.symmetric,
this.leftPadding = 0.0,
this.rightPadding = 0.0,
this.lineHeight = 1.5,
this.fontStyle = FontStyle.normal,
this.textOverflow = TextOverflow.visible,
this.textAllCaps = false,
this.letterSpacing = 0,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: paddingType == PaddingType.symmetric
? EdgeInsets.symmetric(
horizontal: horizontalPadding,
vertical: verticalPadding,
)
: EdgeInsets.only(
left: leftPadding,
right: rightPadding,
),
child: Text(
textAllCaps ? text.toUpperCase() : text,
style: TextStyle(
fontSize: responsiveTextSize(),
fontWeight: fontWeight,
color: fontColor,
decoration: textDecoration,
height: lineHeight,
fontStyle: fontStyle,
letterSpacing: letterSpacing,
),
textScaleFactor: 1,
textAlign: textAlign,
),
);
}
double responsiveTextSize() {
if (isResponsive) {
if (AppSizes.deviceHeight < AppSizes.height490) {
return fontSize - 3;
} else if (AppSizes.deviceHeight < AppSizes.height740) {
return fontSize - 2;
} else if (AppSizes.deviceHeight < AppSizes.height880) {
return fontSize - 1;
}
}
return fontSize;
}
}

@ -1,33 +0,0 @@
import 'package:intl/intl.dart';
class AllProblemsModel {
String problem='';
String audio='';
String description='';
String video='';
String date='';
String problemId='';
List picture = [];
String image='';
bool isAudioButtonEnabled=false;
DateTime dateForFilter=new DateTime.now();
String dateNew='';
AllProblemsModel();
factory AllProblemsModel.fromJson(Map<String, dynamic> json){
AllProblemsModel rtvm = new AllProblemsModel();
rtvm.problem = json['name'] ?? '';
rtvm.audio = json['audio'] ?? '';
rtvm.description = json['description'] ?? '';
rtvm.video = json['video'] ?? '';
rtvm.date = json['date'] ?? '';
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
rtvm.problemId = json['reportId'] ?? '';
rtvm.picture = json['picture'] ?? [];
rtvm.image=json['picture'][0]['url']??'';
return rtvm;
}
}

@ -1,55 +0,0 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class BmiHistoryModel {
String bmiValue = '';
String height= '';
String weight= '';
String date= '';
String actualDate= '';
String displayDate='';
DateTime dateForFilter=new DateTime.now();
String bmiInfoId = '';
String bmiText = '';
Color bmiTextColor = Colors.black;
var number1;
var number2;
BmiHistoryModel();
factory BmiHistoryModel.fromJson(Map<String, dynamic> json){
BmiHistoryModel rtvm = new BmiHistoryModel();
rtvm.bmiValue = json['bmivalue'].toString() ?? '';
rtvm.bmiInfoId = json['bmiinfoid'].toString() ?? '';
rtvm.height = json['height'].toString() ?? '';
rtvm.weight = json['weight'].toString() ?? '';
rtvm.number1 = double.parse( rtvm.bmiValue);
rtvm.number2 = double.parse( rtvm.bmiValue);
rtvm.date = json['createdAt'].toString() ?? '';
rtvm.actualDate = json['date'].toString() ?? '';
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
if(double.parse(rtvm.bmiValue)<18.5){
rtvm.bmiText='Underweight';
rtvm.bmiTextColor=Colors.red;
}
else if(double.parse(rtvm.bmiValue)>=18.5&&double.parse(rtvm.bmiValue)<=24.9){
rtvm.bmiText='Normal weight';
rtvm.bmiTextColor=buttonColors;
}
else if(double.parse(rtvm.bmiValue)>=25&&double.parse(rtvm.bmiValue)<=29.9){
rtvm.bmiText='Overweight';
rtvm.bmiTextColor=Colors.red;
}
else if(double.parse(rtvm.bmiValue)>=30){
rtvm.bmiText='Obesity';
rtvm.bmiTextColor=Colors.red;
}
return rtvm;
}
}

@ -1,34 +0,0 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class BPHistoryModel {
String bpText = '';
String systolic= '';
String diastolic= '';
String date= '';
String bpId= '';
String displayDate='';
String actualDate='';
DateTime dateForFilter=new DateTime.now();
BPHistoryModel();
factory BPHistoryModel.fromJson(Map<String, dynamic> json){
BPHistoryModel rtvm = new BPHistoryModel();
rtvm.bpText = json['bpCategory'].toString() ?? '';
rtvm.systolic = json['Systolic'].toString() ?? '';
rtvm.diastolic = json['Diastolic'].toString() ?? '';
rtvm.date = json['createdAt'].toString() ?? '';
rtvm.actualDate = json['date'].toString() ?? '';
rtvm.bpId= json['bpinfoid'].toString() ?? '';
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
return rtvm;
}
}

@ -1,27 +0,0 @@
class GetConnectedPatientsModel {
String user_name='';
String customer_id='';
String phone_number='';
String age='';
String gender='';
GetConnectedPatientsModel();
factory GetConnectedPatientsModel.fromJson(Map<String, dynamic> json){
GetConnectedPatientsModel rtvm = new GetConnectedPatientsModel();
rtvm.user_name = json['username'] ?? '';
rtvm.customer_id = json['customerId'] ?? '';
rtvm.phone_number = json['phone'] ?? '';
rtvm.age = json['age'].toString() ?? '';
rtvm.gender = json['gender'] ?? '';
return rtvm;
}
}

@ -1,30 +0,0 @@
class GetConnectedDoctorsModel {
String doctor_name='';
String doctor_id='';
String specialization='';
String qualification='';
String practiceplace1='';
String practiceplace2='';
String practiceplace3='';
String hospital_name='';
GetConnectedDoctorsModel();
factory GetConnectedDoctorsModel.fromJson(Map<String, dynamic> json){
GetConnectedDoctorsModel rtvm = new GetConnectedDoctorsModel();
rtvm.doctor_name = json['doctorName'] ?? '';
rtvm.specialization = json['specialization'] ?? '';
rtvm.qualification = json['qualification'] ?? '';
rtvm.doctor_id = json['doctorId'] ?? '';
rtvm.hospital_name = json['placeOfPractice'][0]['hospitalName'] ?? '';
return rtvm;
}
}

@ -1,66 +0,0 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class PatientRecordsModel {
String patient_name='';
String age='';
String gender='';
String patient_type='';
String problem='';
String doctorName='';
String hospitalName='';
String date='';
String recordId='';
String customerId='';
String problem_category='';
String doctorId='';
bool isDoctorVerify=false;
bool isDynamicDigitsVisible=false;
bool isDoctorPinVerify=false;
bool isReportVisible=false;
List findingsImages = [];
List reportImages = [];
List prescriptionImages = [];
DateTime dateForFilter=new DateTime.now();
PatientRecordsModel();
factory PatientRecordsModel.fromJson(Map<String, dynamic> json){
PatientRecordsModel rtvm = new PatientRecordsModel();
rtvm.patient_type = json['patientType'] ?? '';
rtvm.doctorName = json['doctorName'] ?? '';
rtvm.hospitalName = json['hospitalName'] ?? '';
rtvm.problem = json['problem'] ?? '';
rtvm.date = json['date'] ?? '';
rtvm.recordId = json['recordId'] ?? '';
rtvm.doctorId = json['doctorId'] ?? '';
rtvm.customerId = json['customerId'] ?? '';
rtvm.problem_category = json['problemCategory'] ?? '';
rtvm.findingsImages = json['findings'] ?? [];
rtvm.reportImages = json['reports'] ?? [];
rtvm.prescriptionImages = json['prescription'] ?? [];
rtvm.isDoctorVerify = json['isDoctorVerify'] ?? false;
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
if(rtvm.patient_type.toString().toLowerCase()=='self'){
}
else{
rtvm.age=json['others']['age'].toString();
rtvm.gender=json['others']['gender'];
rtvm.patient_name=json['others']['name'];
}
if(rtvm.doctorId==AppSettings.doctorId || rtvm.problem_category.toString().toLowerCase()=='general'){
rtvm.isReportVisible=true;
rtvm.isDoctorPinVerify=true;
}
return rtvm;
}
}

@ -1,40 +0,0 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
class PrescriptionsModel {
String prescription_name = '';
String patient_name='';
String prescription_url='';
String age='';
String gender='';
String patient_type='';
List prescriptionUrls=[];
PrescriptionsModel();
factory PrescriptionsModel.fromJson(Map<String, dynamic> json){
PrescriptionsModel rtvm = new PrescriptionsModel();
rtvm.prescriptionUrls=json['precription']??[];
/*rtvm.prescription_name = json['name'] ?? '';
rtvm.patient_type = json['patientType'] ?? '';
rtvm.prescription_url = json['pictureUrl'][0] ?? '';
if(rtvm.patient_type.toString().toLowerCase()=='self'){
rtvm.age=AppSettings.age;
rtvm.gender=AppSettings.gender;
rtvm.patient_name=AppSettings.userName;
}
else{
rtvm.age=json['others']['age'].toString();
rtvm.gender=json['others']['gender'];
rtvm.patient_name=json['others']['name'];
}*/
return rtvm;
}
}

@ -1,45 +0,0 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class ReportsModel {
String patient_name='';
String age='';
String gender='';
String patient_type='';
String problem='';
String doctorName='';
String hospitalName='';
String date='';
String recordId='';
List findingsImages = [];
List reportImages = [];
List prescriptionImages = [];
DateTime dateForFilter=new DateTime.now();
ReportsModel();
factory ReportsModel.fromJson(Map<String, dynamic> json){
ReportsModel rtvm = new ReportsModel();
rtvm.patient_type = json['patientType'] ?? '';
rtvm.doctorName = json['doctorName'] ?? '';
rtvm.hospitalName = json['hospitalName'] ?? '';
rtvm.problem = json['problem'] ?? '';
rtvm.date = json['date'] ?? '';
rtvm.recordId = json['recordId'] ?? '';
rtvm.findingsImages = json['findings'] ?? [];
rtvm.reportImages = json['reports'] ?? [];
rtvm.prescriptionImages = json['prescription'] ?? [];
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date);
if(rtvm.patient_type.toString().toLowerCase()!='self'){
rtvm.age=json['others']['age'].toString();
rtvm.gender=json['others']['gender'];
rtvm.patient_name=json['others']['name'];
}
return rtvm;
}
}

@ -1,27 +0,0 @@
class ResourcesModel {
String resource_name='';
String resource_id='';
List dos=[];
List donts=[];
List urls=[];
ResourcesModel();
factory ResourcesModel.fromJson(Map<String, dynamic> json){
ResourcesModel rtvm = new ResourcesModel();
rtvm.resource_name = json['resourceName'] ?? '';
rtvm.resource_id = json['resourceId'] ?? '';
rtvm.dos = json['dos'] ?? '';
rtvm.donts = json['doNots'] ?? '';
rtvm.urls = json['url'] ?? '';
return rtvm;
}
}

@ -1,62 +0,0 @@
import 'package:flutter/material.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class SugarHistoryModel {
String sugartText = '';
String sugarValue = '';
String fasting= '';
String postPrandial= '';
String date= '';
String displayDate='';
String actualDate='';
String sugarInfoId='';
DateTime dateForFilter=new DateTime.now();
Color sugarValueColor=Colors.black;
SugarHistoryModel();
factory SugarHistoryModel.fromJson(Map<String, dynamic> json){
SugarHistoryModel rtvm = new SugarHistoryModel();
rtvm.sugartText = json['sugarCategory'].toString() ?? '';
rtvm.sugarValue = json['sugarValue'].toString() ?? '';
rtvm.fasting = json['fasting'].toString() ?? '';
rtvm.postPrandial = json['postPrandial'].toString() ?? '';
rtvm.date = json['createdAt'].toString() ?? '';
rtvm.actualDate = json['date'].toString() ?? '';
rtvm.sugarInfoId = json['sugarinfoid'].toString() ?? '';
if(rtvm.sugartText.toUpperCase().toUpperCase()=='VERY HIGH BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='HIGH BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='PREDIABETES (IMPAIRED FASTING GLUCOSE)'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='VERY LOW BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='LOW BLOOD SUGAR'){
rtvm.sugarValueColor=Colors.red;
}
else if(rtvm.sugartText.toUpperCase().toUpperCase()=='NORMAL BLOOD SUGAR (HEALTHY RANGE)'){
rtvm.sugarValueColor=buttonColors;
}
else{
rtvm.sugarValueColor=Colors.black;
}
//DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(rtvm.date);
rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.actualDate);
return rtvm;
}
}

@ -1,539 +0,0 @@
import 'dart:convert';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/BMI/bmi_history.dart';
import 'package:doctor/common/settings.dart';
class BMICalculator extends StatefulWidget {
String? customerId;
BMICalculator({this.customerId});
@override
State<BMICalculator> createState() => _BMICalculatorState();
}
class _BMICalculatorState extends State<BMICalculator> {
TextEditingController heightController = TextEditingController();
TextEditingController inchesController = TextEditingController();
TextEditingController cmsController = TextEditingController();
TextEditingController weightController = TextEditingController();
TextEditingController ageController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String bmiValue = '';
String bmiText = '';
Color bmiTextColor = Colors.black;
var heightUnitItems = [
'feet',
'cm',
];
var heightUnits = 'feet';
var weightUnitItems = [
'kg',
];
var weightUnits = 'kg';
@override
void initState() {
ageController.text = AppSettings.age;
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Calculate BMI'),
body: SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
cursorColor: greyColor,
controller: ageController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
suffixText: "Yrs",
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
DropdownButtonFormField(
// Initial Value
value: heightUnits,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.ac_unit_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Height 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: heightUnitItems.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(() {
heightUnits = newValue!;
});
},
),
SizedBox(height: 10),
Visibility(
visible: heightUnits == 'feet',
child: Container(
//height: 60,
child: Row(
children: [
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: heightController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Feets',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: inchesController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Inches',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
],
),
),
),
Visibility(
visible: heightUnits == 'cm',
child: Container(
//height: 60,
child: Row(
children: [
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: cmsController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter height in cms',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
],
),
),
),
SizedBox(height: 10),
Container(
//height: 40,
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Row(
children: [
Expanded(
child: TextFormField(
cursorColor: greyColor,
controller: weightController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.line_weight_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Weight',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),
SizedBox(width: 5),
Expanded(
child: DropdownButtonFormField(
// Initial Value
value: weightUnits,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.ac_unit_outlined,
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: weightUnitItems.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(() {
weightUnits = newValue!;
});
},
),
)
],
),
),
SizedBox(height: 10),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: dateInput,
decoration: textFormFieldDecorationBMI(
Icons.calendar_today, 'Enter Date'),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateInput.text =
formattedDate; //set output date to TextField value.
});
} else {}
},
),
),
SizedBox(height: 10),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (ageController.text != '' &&
heightController.text != '' ||
cmsController.text != '' &&
weightController.text != '' &&
dateInput.text != '') {
if (int.parse(heightController.text) > 7) {
AppSettings.longFailedToast(
'Please enter feet below 8 feets');
} else if (int.parse(inchesController.text) > 12) {
AppSettings.longFailedToast(
'Please enter inches below 12');
} else if (int.parse(heightController.text) == 0 &&
int.parse(inchesController.text) < 6) {
AppSettings.longFailedToast(
'Please enter inches above 6');
} else {
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
if (heightUnits.toString().toLowerCase() ==
'feet') {
cmsController.text = '';
} else {
heightController.text = '';
inchesController.text = '';
}
payload["age"] =
int.parse(ageController.text.toString());
payload["feet"] = heightController.text.toString();
payload["inches"] =
inchesController.text.toString();
payload["height"] = cmsController.text.toString();
payload["weight"] =
weightController.text.toString();
payload["heightUnit"] = heightUnits.toString();
payload["weightUnit"] = weightUnits.toString();
payload["date"] = dateInput.text.toString();
try {
var value =
await AppSettings.calculateBmi(payload,widget.customerId);
var valueResponse = jsonDecode(value);
Navigator.of(context, rootNavigator: true).pop();
heightController.clear();
cmsController.clear();
inchesController.clear();
weightController.clear();
dateInput.clear();
setState(() {
bmiValue = valueResponse['userDetails']
['bmivalue']
.toString();
if (double.parse(bmiValue) < 18.5) {
bmiText = 'Underweight';
bmiTextColor=Colors.red;
} else if (double.parse(bmiValue) >= 18.5 &&
double.parse(bmiValue) <= 24.9) {
bmiText = 'Normal weight';
bmiTextColor=buttonColors;
} else if (double.parse(bmiValue) >= 25 &&
double.parse(bmiValue) <= 29.9) {
bmiText = 'Overweight';
bmiTextColor=Colors.red;
} else if (double.parse(bmiValue) >= 30) {
bmiText = 'Obesity';
bmiTextColor=Colors.red;
}
});
} catch (e) {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast(
'Calculating BMI failed');
}
}
} else {
AppSettings.longFailedToast(
'Please enter valid details');
}
},
child: const Text('Calculate BMI'),
)),
SizedBox(height: 20),
Container(
child: Row(
children: [
Text(
'Your BMI value: $bmiValue',
style:
TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
SizedBox(
width: 10,
),
Text(bmiText,
style: TextStyle(
color: bmiTextColor, fontWeight: FontWeight.bold,fontSize: 20)),
],
)),
SizedBox(height: 30),
Container(
child: Text(
'Underweight = <18.5',
style: bmiTextStyle(),
),
),
SizedBox(height: 10),
Container(
child:
Text('Normal weight = 18.524.9', style: bmiTextStyle()),
),
SizedBox(height: 10),
Container(
child: Text('Overweight = 2529.9', style: bmiTextStyle()),
),
SizedBox(height: 10),
Container(
child: Text('Obesity = BMI of 30 or greater',
style: bmiTextStyle()),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BMIHistory(customerId: widget.customerId,)),
);
},
icon: Icon(
Icons.history,
color: primaryColor,
size: 40,
),
),
SizedBox(height: 10),
Padding(
padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Container(
child: Text('History',
style: TextStyle(
color: Colors.black,
fontSize: 12,
fontWeight: FontWeight.bold,
)),
),
)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
],
),
)),
));
}
}

@ -1,424 +0,0 @@
import 'dart:convert';
import 'package:doctor/patient_dashboard/BMI/bmi_caluculator.dart';
import 'package:flutter/material.dart';
import 'package:doctor/models/bmi_history_model.dart';
import 'package:doctor/common/settings.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class BMIHistory extends StatefulWidget {
String? customerId;
BMIHistory({this.customerId});
@override
State<BMIHistory> createState() => _BMIHistoryState();
}
class _BMIHistoryState extends State<BMIHistory> {
bool isLoading = false;
List<BmiHistoryModel> bmiHistoryList = [];
List<BmiHistoryModel> FilteredList = [];
var dateItems = [
'All',
'last 7 days',
'last one month',
'last one year',
];
var dateItemsVariable = 'All';
Future<void> getBmiHistoryDetails(var selectedRange) async {
isLoading = true;
var response1 = await AppSettings.getBmiHistory(widget.customerId);
print(response1);
setState(() {
bmiHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
return BmiHistoryModel.fromJson(model);
}).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
var now_1m = new DateTime(now.year, now.month - 1, now.day);
var now_1y = new DateTime(now.year - 1, now.month, now.day);
if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
//reportsList=reportsListOriginal.reversed.toList();
}).toList();
}
else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
}
else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = bmiHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
}
else {
FilteredList = bmiHistoryList;
}
isLoading = false;
});
}
@override
void initState() {
getBmiHistoryDetails(dateItemsVariable);
super.initState();
}
deleteBmiHistory(bmiId) async{
AppSettings.preLoaderDialog(context);
bool status = await AppSettings.deleteBMIDetails(bmiId,widget.customerId);
if(status){
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("BMI record deleted successfully");
await getBmiHistoryDetails(dateItemsVariable);
}
else{
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("BMI record deletion failed");
}
}
Widget renderzUi() {
if (FilteredList.length != 0) {
FilteredList.sort((a, b) => a.actualDate.compareTo(b.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: DropdownButtonFormField(
// Initial Value
value: dateItemsVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: dateItems.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(() {
dateItemsVariable = newValue!;
});
getBmiHistoryDetails(dateItemsVariable);
},
),
),
IconButton(
onPressed: () {
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BmiChart()),
);*/
/*Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new BmiChart(myObject: FilteredList)));*/
// showBMIAdddialog();
},
icon: Icon(
Icons.auto_graph,
color: primaryColor,
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
return Slidable(
key: const ValueKey(0),
endActionPane: ActionPane(
// A motion is a widget used to control how the pane animates.
motion: ScrollMotion(),
dragDismissible: false,
// A pane can dismiss the Slidable.
dismissible: DismissiblePane(onDismissed: () {
deleteBmiHistory(FilteredList[index].bmiInfoId);
}),
// All actions are defined in the children parameter.
children: [
// A SlidableAction can have an icon and/or a label.
SlidableAction(
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
label: 'Delete',
onPressed: (BuildContext context) {
deleteBmiHistory(FilteredList[index].bmiInfoId);
},
),
/*SlidableAction(
onPressed: doNothing,
backgroundColor: Color(0xFF21B7CA),
foregroundColor: Colors.white,
icon: Icons.share,
label: 'Share',
),*/
],
),
child: Card(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width * .55,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.height
.toString()
.toUpperCase() +
' cms',
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/weight.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.weight
.toString()
.toUpperCase() +
' Kgs',
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image:
const AssetImage('images/date.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.actualDate
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/bmi.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.bmiValue
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/bmi.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index].bmiText
.toString()
.toUpperCase(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,color: FilteredList[index].bmiTextColor
)),
)
],
),
],
),
),
],
),
),
),
);
})),
]);
}
else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * .25,
),
Text('No Data'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BMICalculator(customerId:widget.customerId))).then((value) {
getBmiHistoryDetails(dateItemsVariable);
});
},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Body Mass Index'),
body: isLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: renderzUi(),
floatingActionButton: Visibility(
visible:FilteredList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BMICalculator(customerId: widget.customerId,))).then((value) {
getBmiHistoryDetails(dateItemsVariable);
});
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
);
}
}

@ -1,228 +0,0 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/BP/bp_history.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class BPCalculator extends StatefulWidget {
String? customerId;
BPCalculator({this.customerId});
@override
State<BPCalculator> createState() => _BPCalculatorState();
}
class _BPCalculatorState extends State<BPCalculator> {
TextEditingController systoloicController = TextEditingController();
TextEditingController diastolicController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String bpValue = '';
String bpText = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Blood Pressure'),
body: SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
cursorColor: greyColor,
controller: systoloicController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.upload,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter systolic value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
TextFormField(
cursorColor: greyColor,
controller: diastolicController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.download,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Enter diastolic value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: dateInput,
decoration: textFormFieldDecorationBMI(
Icons.calendar_today, 'Enter Date'),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateInput.text =
formattedDate; //set output date to TextField value.
});
} else {}
},
),
),
SizedBox(height: 10),
Container(
width: double.infinity,
height:
MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (systoloicController.text != '' &&
diastolicController.text != ''&&dateInput.text!='') {
if(int.parse(systoloicController.text)>int.parse(diastolicController.text)){
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["Systolic"] = double.parse(systoloicController.text.toString());
payload["Diastolic"] = double.parse(diastolicController.text.toString());
payload["date"] =dateInput.text.toString();
var value = await AppSettings.calculateBP(payload,widget.customerId);
var valueResponse = jsonDecode(value);
print(valueResponse);
setState(() {
bpValue = valueResponse['userDetails']['bpCategory'].toString();
});
systoloicController.clear();
diastolicController.clear();
dateInput.clear();
Navigator.of(context,rootNavigator: true).pop();
}
else{
AppSettings.longFailedToast('Please enter diastolic value less than systolic value');
}
}
else{
AppSettings.longFailedToast('Please enter valid details');
}
},
child: const Text('Check BP'),
)),
SizedBox(height: 20),
Container(
child: Row(
children: [
Text(bpValue,style: TextStyle(color: Colors.red,fontWeight: FontWeight.bold,fontSize: 15),),
],
)
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BPHistory(customerId: widget.customerId,)),
);
},
icon: Icon(
Icons.history,
color: primaryColor,
size: 40,
),
),
SizedBox(height: 10),
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0),
child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
),)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
],
),
)
),
)
);
}
}

@ -1,372 +0,0 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/BP/bp_calculator.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/models/bp_history_model.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class BPHistory extends StatefulWidget {
String? customerId;
BPHistory({this.customerId});
@override
State<BPHistory> createState() => _BPHistoryState();
}
class _BPHistoryState extends State<BPHistory> {
bool isLoading = false;
List<BPHistoryModel> BpHistoryList = [];
List<BPHistoryModel> FilteredList = [];
var dateItems = [
'All',
'last 7 days',
'last one month',
'last one year',
];
var dateItemsVariable = 'All';
Future<void> getBPHistoryDetails(var selectedRange) async {
isLoading = true;
var response1 = await AppSettings.getBPHistory(widget.customerId);
print(response1);
setState(() {
BpHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
return BPHistoryModel.fromJson(model);
}).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
var now_1m = new DateTime(now.year, now.month - 1, now.day);
var now_1y = new DateTime(now.year - 1, now.month, now.day);
if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = BpHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
} else {
FilteredList = BpHistoryList;
}
isLoading = false;
});
}
@override
void initState() {
getBPHistoryDetails(dateItemsVariable);
super.initState();
}
deleteBpRecord(bpId) async {
AppSettings.preLoaderDialog(context);
bool status = await AppSettings.deleteBPDetails(bpId,widget.customerId);
if (status) {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("BP record deleted successfully");
await getBPHistoryDetails(dateItemsVariable);
} else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("BP record deletion failed");
}
}
Widget renderzUi() {
if (FilteredList.length != 0) {
FilteredList.sort((a, b) => b.actualDate.compareTo(a.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: DropdownButtonFormField(
// Initial Value
value: dateItemsVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: dateItems.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(() {
dateItemsVariable = newValue!;
});
getBPHistoryDetails(dateItemsVariable);
},
),
),
IconButton(
onPressed: () {
/* Navigator.push(
context,
MaterialPageRoute(builder: (context) => Bpchart()),
);*/
// showBMIAdddialog();
},
icon: Icon(
Icons.auto_graph,
color: primaryColor,
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
return Slidable(
key: const ValueKey(0),
endActionPane: ActionPane(
// A motion is a widget used to control how the pane animates.
motion: ScrollMotion(),
dragDismissible: false,
// A pane can dismiss the Slidable.
dismissible: DismissiblePane(onDismissed: () {
deleteBpRecord(FilteredList[index].bpId);
}),
// All actions are defined in the children parameter.
children: [
// A SlidableAction can have an icon and/or a label.
SlidableAction(
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
label: 'Delete',
onPressed: (BuildContext context) {
deleteBpRecord(FilteredList[index].bpId);
},
),
],
),
child: Card(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8),
child: Container(
//width: MediaQuery.of(context).size.width * .55,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/* Image(
image: const AssetImage('images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),*/
Text(
'Systolic',
style: TextStyle(color: primaryColor),
),
SizedBox(
width: 5,
),
Padding(
padding: EdgeInsets.all(1),
child: Text(
FilteredList[index]
.systolic
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Diastolic',
style: TextStyle(color: primaryColor),
),
Padding(
padding: EdgeInsets.all(1),
child: Text(
FilteredList[index]
.diastolic
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image: const AssetImage(
'images/height.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.bpText
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image(
image:
const AssetImage('images/date.png'),
height: 25,
width: 25,
fit: BoxFit.fill),
Padding(
padding: EdgeInsets.all(5),
child: Text(
FilteredList[index]
.actualDate
.toString()
.toUpperCase(),
style: valuesTextStyle()),
)
],
),
],
),
),
),
));
})),
]);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * .25,
),
Text('No data'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BPCalculator(customerId: widget.customerId,))).then((value) {
getBPHistoryDetails(dateItemsVariable);
});
},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Blood Pressure'),
body: isLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: renderzUi(),
floatingActionButton: Visibility(
visible:FilteredList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => BPCalculator(customerId: widget.customerId,))).then((value) {
getBPHistoryDetails(dateItemsVariable);
});
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,257 +0,0 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/Sugar/sugar_history.dart';
import 'package:doctor/common/settings.dart';
import 'package:intl/intl.dart';
class SugarCalculator extends StatefulWidget {
String? customerId;
SugarCalculator({this.customerId});
@override
State<SugarCalculator> createState() => _SugarCalculatorState();
}
class _SugarCalculatorState extends State<SugarCalculator> {
TextEditingController fastingValueController = TextEditingController();
TextEditingController postParandialValueController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String sugarValue = '';
Color sugarValueColor = Colors.black;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Diabetes'),
body: SingleChildScrollView(
child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
cursorColor: greyColor,
controller: fastingValueController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
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: 'Enter fasting blood sugar value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
TextFormField(
cursorColor: greyColor,
controller: postParandialValueController,
textCapitalization: TextCapitalization.characters,
keyboardType: TextInputType.number,
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: 'Enter PostPrandial value',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height: 10),
SizedBox(height: 10),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: dateInput,
decoration: textFormFieldDecorationBMI(
Icons.calendar_today, 'Enter Date'),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateInput.text =
formattedDate; //set output date to TextField value.
});
} else {}
},
),
),
SizedBox(height: 10),
Container(
width: double.infinity,
height:
MediaQuery.of(context).size.height * .05,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
if (fastingValueController.text != '' &&
postParandialValueController.text != ''&& dateInput.text!='') {
if(int.parse(fastingValueController.text)>int.parse(postParandialValueController.text)){
AppSettings.longFailedToast('Please enter post parandial value is higher than fasting blood sugar value details');
}
else{
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["fasting"] = double.parse(fastingValueController.text.toString());
payload["postPrandial"] = double.parse(postParandialValueController.text.toString());
payload["date"] = dateInput.text.toString();
var value = await AppSettings.calculateSugar(payload,widget.customerId);
var valueResponse = jsonDecode(value);
print(valueResponse);
setState(() {
sugarValue = valueResponse['userSugarDetails']['sugarCategory'].toString();
if(sugarValue.toUpperCase().toUpperCase()=='VERY HIGH BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='HIGH BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='PREDIABETES (IMPAIRED FASTING GLUCOSE)'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='VERY LOW BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='LOW BLOOD SUGAR'){
sugarValueColor=Colors.red;
}
else if(sugarValue.toUpperCase().toUpperCase()=='NORMAL BLOOD SUGAR (HEALTHY RANGE)'){
sugarValueColor=buttonColors;
}
});
fastingValueController.clear();
postParandialValueController.clear();
dateInput.clear();
Navigator.of(context,rootNavigator: true).pop();
}
}
else{
AppSettings.longFailedToast('Please enter valid details');
}
},
child: const Text('Check Diabetes'),
)),
SizedBox(height: 10),
Container(
child: Row(
children: [
Text(sugarValue,style: TextStyle(color: sugarValueColor,fontWeight: FontWeight.bold,fontSize: 20),),
Visibility(
visible:sugarValue!='' ,
child: Icon(
Icons.emoji_emotions_outlined,
color: buttonColors,
size: 40,
),)
],
)
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SugarHistory(customerId: widget.customerId,)),
);
},
icon: Icon(
Icons.history,
color: primaryColor,
size: 40,
),
),
SizedBox(height: 10),
Padding(padding: EdgeInsets.fromLTRB(10,0,0,0),
child: Container(
child: Text('History',style:TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,)),
),)
],
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: buttonColors, // background
onPrimary: Colors.black, // foreground
),
onPressed: () async {
Navigator.pop(context);
},
child: const Text('Cancel'),
)
],
)
],
),
)
),
)
);
}
}

@ -1,354 +0,0 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:doctor/patient_dashboard/Sugar/sugar_calculator.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/models/sugar_history_model.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class SugarHistory extends StatefulWidget {
String? customerId;
SugarHistory({this.customerId});
@override
State<SugarHistory> createState() => _SugarHistoryState();
}
class _SugarHistoryState extends State<SugarHistory> {
bool isLoading = false;
List<SugarHistoryModel> sugarHistoryList = [];
List<SugarHistoryModel> FilteredList = [];
var dateItems = [
'All',
'last 7 days',
'last one month',
'last one year',
];
var dateItemsVariable = 'All';
Future<void> getSugarHistoryDetails(var selectedRange) async {
isLoading = true;
var response1 = await AppSettings.getSugarHistory(widget.customerId);
print(response1);
setState(() {
sugarHistoryList = ((jsonDecode(response1)) as List).map((dynamic model) {
return SugarHistoryModel.fromJson(model);
}).toList();
var now = new DateTime.now();
var now_1w = now.subtract(Duration(days: 7));
var now_1m = new DateTime(now.year, now.month - 1, now.day);
var now_1y = new DateTime(now.year - 1, now.month, now.day);
if (selectedRange.toString().toUpperCase() == 'LAST 7 DAYS') {
FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1w.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE MONTH') {
FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1m.isBefore(date);
}).toList();
} else if (selectedRange.toString().toUpperCase() == 'LAST ONE YEAR') {
FilteredList = sugarHistoryList.where((product) {
final date = product.dateForFilter;
return now_1y.isBefore(date);
}).toList();
} else {
FilteredList = sugarHistoryList;
}
isLoading = false;
});
}
@override
void initState() {
getSugarHistoryDetails(dateItemsVariable);
super.initState();
}
deleteSugarRecord(sugarInfoId) async {
AppSettings.preLoaderDialog(context);
bool status = await AppSettings.deleteSugarDetails(sugarInfoId,widget.customerId);
if (status) {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longSuccessToast("BP record deleted successfully");
await getSugarHistoryDetails(dateItemsVariable);
} else {
Navigator.of(context, rootNavigator: true).pop();
AppSettings.longFailedToast("BP record deletion failed");
}
}
Widget renderzUi() {
if (FilteredList.length != 0) {
FilteredList.sort((a, b) => b.actualDate.compareTo(a.actualDate));
return Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: DropdownButtonFormField(
// Initial Value
value: dateItemsVariable,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.calendar_month,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Select Date Range',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: dateItems.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(() {
dateItemsVariable = newValue!;
});
getSugarHistoryDetails(dateItemsVariable);
},
),
),
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(0),
itemCount: FilteredList.length,
itemBuilder: (BuildContext context, int index) {
return Slidable(
key: const ValueKey(0),
endActionPane: ActionPane(
// A motion is a widget used to control how the pane animates.
motion: ScrollMotion(),
dragDismissible: false,
// A pane can dismiss the Slidable.
dismissible: DismissiblePane(onDismissed: () {
deleteSugarRecord(FilteredList[index].sugarInfoId);
}),
// All actions are defined in the children parameter.
children: [
// A SlidableAction can have an icon and/or a label.
SlidableAction(
backgroundColor: Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
label: 'Delete',
onPressed: (BuildContext context) {
deleteSugarRecord(FilteredList[index].sugarInfoId);
},
),
],
),
child: Card(
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8),
child:
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Fasting Sugar Value',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'PostPrandial Sugar Value',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Sugar Status',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
'Date',
style: labelTextStyle(),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
':',
style: labelTextStyle(),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Expanded(child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
FilteredList[index]
.fasting
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.postPrandial
.toString()
.toUpperCase(),
style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.sugartText
.toString()
.toUpperCase(),
style: TextStyle(
color: FilteredList[index]
.sugarValueColor,
fontSize: 12,
fontWeight: FontWeight.bold,
overflow: TextOverflow.ellipsis,
)),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Text(
FilteredList[index]
.actualDate
.toString()
.toUpperCase(),
style: valuesTextStyle()),
],
),)
],
),
),
));
})),
]);
} else {
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * .25,
),
Text('No data'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => SugarCalculator(customerId:widget.customerId))).then((value) {
getSugarHistoryDetails(dateItemsVariable);
});
},
),
)
],
),
));
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Diabetes'),
body: isLoading
? Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
)
: renderzUi(),
floatingActionButton: Visibility(
visible:FilteredList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => SugarCalculator(customerId: widget.customerId,))).then((value) {
getSugarHistoryDetails(dateItemsVariable);
});
},
),
],
),
),
),
);
}
}

@ -1,163 +0,0 @@
import 'dart:convert';
import 'package:doctor/common/settings.dart';
import 'package:doctor/patient_dashboard/patient_dshboard_details.dart';
import 'package:flutter/material.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import 'package:flutter/services.dart';
class PatientDashboard extends StatefulWidget {
const PatientDashboard({Key? key}) : super(key: key);
@override
State<PatientDashboard> createState() => _PatientDashboardState();
}
class _PatientDashboardState extends State<PatientDashboard> {
bool isScannerVisible=true;
TextEditingController mobileNumberController = TextEditingController();
String mobileNumber='';
final List<String> images = [
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
'https://via.placeholder.com/150',
];
Future<void> scanQR() async {
String barcodeScanRes;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
'#ff6666', 'Cancel', true, ScanMode.QR);
print(barcodeScanRes);
setState(() {
mobileNumber=jsonDecode(barcodeScanRes)['contactNumber'];
mobileNumberController.text=mobileNumber;
});
} on PlatformException {
barcodeScanRes = 'Failed to get platform version.';
}}
Future<bool> onWillPop() async {
final shouldPop = await showDialog<bool>(context: context, builder: (context) {
return AlertDialog(
title: const Text('Do you want to leave this page',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
actionsAlignment: MainAxisAlignment.spaceBetween,
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: const Text('Yes',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: const Text('No',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
],
);
},
);
return shouldPop!;
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => onWillPop(),
child: Scaffold(
appBar: AppSettings.appBar('Patient Dashboard'),
body: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(
height:MediaQuery.of(context).size.height * .02,
),
Visibility(
visible: isScannerVisible,
child:Center(
child: Container(
child: Column(
children: [
IconButton(
onPressed: (){
scanQR();
},
icon: Icon(
Icons.qr_code_scanner,
color: primaryColor,
),
),
Text('Scan Qr Code',style: TextStyle(fontSize: 12,color: primaryColor),)
],
)
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: primaryColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
textCapitalization: TextCapitalization.characters,
decoration: textFormFieldDecorationInsideApp(Icons.phone,'Enter mobile number'),
),
),
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.white, // foreground
),
onPressed: () async {
if(mobileNumberController.text!=''){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PatientDashboardDetails(mobileNumber: mobileNumberController.text.toString(),)),
);
}
else{
AppSettings.longFailedToast('Please enter details');
}
},
child: Text('Go to details'),
)),
]
))) ) ),
);
}
}

@ -1,246 +0,0 @@
import 'dart:convert';
import 'package:doctor/common/settings.dart';
import 'package:doctor/patient_dashboard/BMI/bmi_history.dart';
import 'package:doctor/patient_dashboard/BP/bp_history.dart';
import 'package:doctor/patient_dashboard/Reports/allreports.dart';
import 'package:doctor/patient_dashboard/Sugar/sugar_history.dart';
import 'package:doctor/patient_dashboard/prescriptions/prescriptions.dart';
import 'package:doctor/patient_dashboard/problems/all_problems.dart';
import 'package:flutter/material.dart';
class PatientDashboardDetails extends StatefulWidget {
String? mobileNumber;
PatientDashboardDetails({this.mobileNumber});
@override
State<PatientDashboardDetails> createState() => _PatientDashboardDetailsState();
}
class _PatientDashboardDetailsState extends State<PatientDashboardDetails> {
bool isDataLoading=false;
bool isSereverIssue=false;
String? customerId;
String? patientName;
String? patientAge;
String? patientGender;
String? patientContactNumber;
final List<String> images = [
'images/bp.png',
'images/sugar.png',
'images/bmi.png',
'images/health_records.png',
'images/prescriptions.png',
'images/medicines.png',
'images/new_problem.png',
'images/get_checkup.png',
'images/myresources.png',
];
final List<String> labels = [
'Bp',
'Sugar',
'BMI',
'Health Records',
'Prescriptions',
'Medicines',
'New Problem',
'Get Checkup',
'Resources',
];
Map<String,dynamic> patDetails={};
Future<void> getPatientInformation() async {
isDataLoading=true;
try {
var response = await AppSettings.getPatientInformationBasedOnMobileNumber(widget.mobileNumber);
print(jsonDecode(response));
setState(() {
customerId=jsonDecode(response)[0]['customerId'];
patientName=jsonDecode(response)[0]['profile']['firstName'];
patientAge=jsonDecode(response)[0]['age'].toString();
patientGender=jsonDecode(response)[0]['gender'];
patientContactNumber=jsonDecode(response)[0]['profile']['contactNumber'];
isDataLoading = false;
});
} catch (e) {
setState(() {
isDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
getPatientInformation();
super.initState();
}
_onTap(int index){
if(index==0){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BPHistory(customerId:customerId,)),
);
}
else if(index==1){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SugarHistory(customerId:customerId,)),
);
}
else if(index==2){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BMIHistory(customerId:customerId,)),
);
}
else if(index==3){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllReports(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
else if(index==4){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Prescriptions(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
else if(index==6){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllProblemsReportMyself(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
else if(index==7){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AllProblemsReportMyself(customerId:customerId,patName: patientName,patAge: patientAge,patGender: patientGender,)),
);
}
}
Widget _dashboard(){
return Column(
children: [
Padding(padding: EdgeInsets.all(10),
child: Align(child: Text('Patient Information',style: TextStyle(color: primaryColor,fontSize: 16),),
alignment: Alignment.topLeft),),
Padding(padding: EdgeInsets.all(10),
child: Card(child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Name'),
Text('Age'),
Text('Gender'),
Text('Contact Number')
],
),
SizedBox(
width:MediaQuery.of(context).size.width * .02,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(':'),
Text(':'),
Text(':'),
Text(':')
],
),
SizedBox(
width:MediaQuery.of(context).size.width * .02,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(patientName!),
Text(patientAge!),
Text(patientGender!),
Text(patientContactNumber!)
],
),
],
),),),
Expanded(child: Container(
child: Padding(
padding: EdgeInsets.all(10),
child: GridView.builder(
itemCount: images.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 4.0,
mainAxisSpacing: 4.0,
),
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () {
_onTap(index);
},
child: Column(
children: [
Expanded(child: Container(
decoration: BoxDecoration(
color: secondaryColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
image: AssetImage(images[index],) , // picked file
fit: BoxFit.fill)),
//color: secondaryColor,
)),
Padding(padding: EdgeInsets.all(10),
child: Text(labels[index]),),
/*Divider(
color: Colors.grey,
height: 1.0,
),*/
],
)
);
},
),
)
))
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Patient Dashboard Details'),
body: Container(
child: isDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _dashboard(),
),
);
}
}

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

@ -1,976 +0,0 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:doctor/patient_dashboard//Reports/add_reports.dart';
import 'package:doctor/common/settings.dart';
import 'package:doctor/common/zoom_image.dart';
import 'package:doctor/models/reports_model.dart';
import 'package:image_picker/image_picker.dart';
import 'package:photo_view/photo_view.dart';
import 'package:intl/intl.dart';
class Prescriptions extends StatefulWidget {
String? customerId;
String? patName;
String? patAge;
String? patGender;
Prescriptions({this.customerId,this.patName,this.patAge,this.patGender});
@override
State<Prescriptions> createState() => _PrescriptionsState();
}
class _PrescriptionsState extends State<Prescriptions> {
final ImagePicker _picker = ImagePicker();
String Url = '';
List<ReportsModel> reportsList = [];
List<ReportsModel> reportsListOriginal = [];
bool isPharmacyDataLoading = false;
bool isPrescriptionsDataLoading = false;
bool isSereverIssue = false;
double lat = 0;
double lng = 0;
String userAddress = '';
String dropdownArea = '2';
var AreaItems = ['2', '5', '10', '25', '50', '100'];
List pharmaciesCheckboxes = [];
bool isLoading=false;
final ImagePicker imagePicker = ImagePicker();
List imageFileList = [];
List uiPrescriptionImages = [];
TextEditingController searchController = TextEditingController();
TextEditingController dateInput = TextEditingController();
String dropdownSearchType = 'Problem';
var typeOfSearchItems = [
'Problem',
'Doctor',
'Date',
];
Future<void> getAllRecords() async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getRecordsByProblemName(var problem) async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
reportsList= reportsListOriginal.where(
(x) => x.problem.toString().toLowerCase().contains(problem.toString().toLowerCase())
).toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getRecordsByDoctorName(var doctor) async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
reportsList= reportsListOriginal.where(
(x) => x.doctorName.toString().toLowerCase().contains(doctor.toString().toLowerCase())
).toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
Future<void> getRecordsByDate(var date) async {
isPrescriptionsDataLoading=true;
try {
var response = await AppSettings.getAllRecords(widget.customerId);
setState(() {
reportsListOriginal = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ReportsModel.fromJson(model);
}).toList();
reportsList=reportsListOriginal.reversed.toList();
reportsList= reportsListOriginal.where(
(x) => x.date.toString().toLowerCase().contains(date.toString().toLowerCase())
).toList();
isPrescriptionsDataLoading = false;
});
} catch (e) {
setState(() {
isPrescriptionsDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
getAllRecords();
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,widget.customerId);
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,widget.customerId);
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 pickImageFromGalleryForUpdate(var recordId) async {
imageFileList = [];
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
AppSettings.preLoaderDialog(context);
if (selectedImages!.isNotEmpty) {
imageFileList.addAll(selectedImages);
}
var res = await AppSettings.updatePrescriptionsGallery(imageFileList,recordId,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
getAllRecords();
}
Future takeImageFromCameraForUpdate(var recordId) 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.updatePrescriptionsCamera(image,recordId,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
getAllRecords();
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
showPicDialog(var imageUrl){
return showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return AlertDialog(
title: const Text(''),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * .10,
height: MediaQuery.of(context).size.height * .50,
child: PhotoView(
imageProvider: NetworkImage(imageUrl) as ImageProvider,
maxScale: PhotoViewComputedScale.contained * 4.0,
minScale: PhotoViewComputedScale.contained,
initialScale: PhotoViewComputedScale.contained,
basePosition: Alignment.center,
)
)
],
),
),
actions: <Widget>[
TextButton(
child: Text('Close', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
},
);
}
Widget prescriptions(var obj){
if(obj.prescriptionImages.length!=0){
return Container(
//color: secondaryColor,
width: double.infinity,
height: MediaQuery.of(context).size.height * .20,
child: Row(
children: [
Expanded(child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: obj.prescriptionImages.length,
itemBuilder: (context, index) {
return Row(
children: [
Card(
child: GestureDetector(
onTap: (){
//showPicDialog(obj.prescriptionImages[index]['url']);
Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Prescriptions',imageDetails:obj.prescriptionImages[index]['url'])));},
child: Container(
width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .15,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(
obj.prescriptionImages[index]['url'])
as ImageProvider, // picked file
fit: BoxFit.fill)),
child: Stack(children: [
Positioned(
right: 0,
child: Container(
child: IconButton(
iconSize: 30,
icon: const Icon(
Icons.delete,
color: Colors.red,
),
onPressed: () async {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) => AlertDialog(
title:
const Text('Do you want to delete image?',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
actionsAlignment:
MainAxisAlignment.spaceBetween,
actions: [
TextButton(
onPressed: () async {
AppSettings.preLoaderDialog(context);
String fileName = obj.prescriptionImages[index]['url']
.split('/')
.last;
var payload =
new Map<String, dynamic>();
payload["urlType"] = 'prescription';
payload["url"] = obj.prescriptionImages[index]['url'];
try {
var res = await AppSettings.deleteRecordsNew(payload, obj.recordId,widget.customerId);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).pop(true);
AppSettings.longSuccessToast("Image deleted Successfully");
setState(() {
obj.prescriptionImages =
jsonDecode(
res)['remainingUrls'];
});
} catch (e) {
print(e);
Navigator.of(context,
rootNavigator: true)
.pop();
Navigator.of(context).pop(true);
AppSettings.longFailedToast(
"Image deletion failed");
}
},
child: const Text('Yes',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: const Text('No',
style: TextStyle(
color: primaryColor,
fontSize: 20,
)),
),
],
),
);
},
),
),
)
]),
),
),
)
],
);
}),),
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.green,
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCameraForUpdate(obj.recordId);
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGalleryForUpdate(obj.recordId);
Navigator.pop(context);
},
),
],
),
),
);
});
},
)
],
)
);
}
else{
return Row(
children: [
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.green,
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCameraForUpdate(obj.recordId);
Navigator.pop(context);
},
),
SizedBox(
width: MediaQuery.of(context).size.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGalleryForUpdate(obj.recordId);
Navigator.pop(context);
},
),
],
),
),
);
});
},
),
Text('Add Prescriptions',style: textButtonStyle(),)
],
);
}
}
Widget _filtereddata(){
if (reportsList.length != 0) {
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child:ListView.builder(
padding: EdgeInsets.all(0),
itemCount: reportsList.length,
itemBuilder: (BuildContext context, int index) {
if(reportsList[index].patient_type.toString().toLowerCase()=='self'){
reportsList[index].age=widget.patAge!;
reportsList[index].gender=widget.patGender!;
reportsList[index].patient_name=widget.patName!;
}
else{
reportsList[index].age=reportsList[index].age;
reportsList[index].gender=reportsList[index].gender;
reportsList[index].patient_name=reportsList[index].patient_name;
}
return Visibility(
visible: true,
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding:EdgeInsets.all(8) ,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width * .55,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Problem: '+reportsList[index].problem.toString().toUpperCase(),style: problemTextStyle()),
Text(reportsList[index].doctorName.toString().toUpperCase(),style: valuesTextStyle()),
Text(reportsList[index].hospitalName.toString().toUpperCase(),style: valuesTextStyle()),
Text(reportsList[index].date.toString().toUpperCase(),style: valuesTextStyle()),
Text('Patient Details: ',style: problemTextStyle()),
Text(reportsList[index].patient_name.toString().toUpperCase(),style: valuesTextStyle()),
Row(
children: [
Text(reportsList[index].gender.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(width:MediaQuery.of(context).size.width * .05,),
Text(reportsList[index].age.toString().toUpperCase()+" Yrs",style: valuesTextStyle()),
],
),
],
),
),
],
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
prescriptions(reportsList[index]),
],
),
),
));
}) ),
]);
}
else{
return Padding(padding: EdgeInsets.fromLTRB(60,10,60,10),
child: Column(
children: [
Text('No prescriptions found related to your search'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: Colors.red,
radius: 30,
child: const Icon(
Icons.info,
color: Colors.white,
),
)
],
),);
}
}
Widget _allPrescriptions(){
if(reportsListOriginal.length!=0){
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: DropdownButtonFormField(
// Initial Value
value: dropdownSearchType,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.search,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Search By',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Select Search Type'),
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: typeOfSearchItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items),
);
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dropdownSearchType = newValue!;
});
},
),
),
Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='problem' ,
child: Container(
height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5),
child: Center(child: TextField(
cursorColor: primaryColor,
controller: searchController,
onChanged: (string) {
if(string.length>=1){
getRecordsByProblemName(string);
}
else{
getAllRecords();
}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
color: primaryColor,
),
/*suffixIcon: Icon(
Icons.clear,
color: greyColor,
),*/
suffixIcon: searchController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
searchController.text='';
});
getAllRecords();
},
):IconButton(
icon: Icon(
Icons.clear,
color: Colors.transparent,
),
onPressed: () {
},
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
//labelText: 'Search by phone number',
hintText: 'Search by problem',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),)
),),
Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='doctor' ,
child: Container(
height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5),
child: Center(child: TextField(
cursorColor: primaryColor,
controller: searchController,
onChanged: (string) {
if(string.length>=1){
getRecordsByDoctorName(string);
}
else{
getAllRecords();
}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
color: primaryColor,
),
/*suffixIcon: Icon(
Icons.clear,
color: greyColor,
),*/
suffixIcon: searchController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
searchController.text='';
});
getAllRecords();
},
):IconButton(
icon: Icon(
Icons.clear,
color: Colors.transparent,
),
onPressed: () {
},
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
//labelText: 'Search by phone number',
hintText: 'Search by doctor',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),)
),),
Visibility(
visible:dropdownSearchType.toString().toLowerCase()=='date' ,
child: Container(
height: MediaQuery.of(context).size.height * .07,
padding: EdgeInsets.all(5),
child: Center(child: TextField(
cursorColor: primaryColor,
controller: searchController,
onChanged: (string) {
if(string.length>=1){
getRecordsByDate(string);
}
else{
getAllRecords();
}
},
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1950),
lastDate: DateTime.now(),
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.dark().copyWith(
colorScheme: ColorScheme.dark(
primary: buttonColors,
onPrimary: Colors.white,
surface: buttonColors,
onSurface: Colors.white,
),
dialogBackgroundColor: primaryColor,
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('dd-MM-yyyy').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
searchController.text = formattedDate; //set output date to TextField value.
});
getRecordsByDate(searchController.text);
} else {}
},
decoration: InputDecoration(
prefixIcon: Icon(
Icons.search,
color: primaryColor,
),
suffixIcon: searchController.text!=''?IconButton(
icon: Icon(
Icons.clear,
color: Colors.red,
),
onPressed: () {
setState(() {
searchController.text='';
});
getAllRecords();
},
):IconButton(
icon: Icon(
Icons.clear,
color: Colors.transparent,
),
onPressed: () {
},
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
borderRadius: BorderRadius.circular(30),
),
//labelText: 'Search by phone number',
hintText: 'Search by date',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),)
),
),
Expanded(child: _filtereddata()),
Padding(
padding: EdgeInsets.fromLTRB(8, 8, 8, 8),
child: CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async{
/*await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddPrescription()),
);*/
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports(customerId:widget.customerId,patName: widget.patName,patAge: widget.patAge,patGender: widget.patGender,))).then((value) {
getAllRecords();
});
//showBoreAddingDialog();
},
),
/* Padding(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Text(
'Add Tanks ',
style: TextStyle(color: Colors.white),
),
)*/
],
),
),
),
]);
}
else{
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: MediaQuery.of(context).size.height * .25,),
Text('Click below icon to add new Record'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => AddReports(customerId:widget.customerId,patName: widget.patName,patAge: widget.patAge,patGender: widget.patGender,))).then((value) {
getAllRecords();
});
},
),
)
],
),
)
);
}
}
/**/
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Prescriptions'),
body: isPrescriptionsDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _allPrescriptions(),
);
}
}

File diff suppressed because it is too large Load Diff

@ -1,59 +0,0 @@
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:flick_video_player/flick_video_player.dart';
class ProblemVideo extends StatefulWidget {
var videoUrl;
ProblemVideo({this.videoUrl});
@override
State<ProblemVideo> createState() => _ProblemVideoState();
}
class _ProblemVideoState extends State<ProblemVideo> {
late VideoPlayerController _controller;
late Future<void> _initializeVideoPlayerFuture;
late FlickManager flickManager;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.networkUrl(
Uri.parse(widget.videoUrl,),
);
flickManager = FlickManager(
videoPlayerController:
VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl,),)
);
_initializeVideoPlayerFuture = _controller.initialize();
_controller.setLooping(false);
}
@override
void dispose() {
// Ensure disposing of the VideoPlayerController to free up resources.
_controller.dispose();
flickManager.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * .30,
width: double.infinity,
child:FlickVideoPlayer(
flickManager: flickManager,
flickVideoWithControls: FlickVideoWithControls(
videoFit: BoxFit.fill,
controls: FlickPortraitControls(
progressBarSettings:
FlickProgressBarSettings(playedColor: Colors.green),
),
),
),
);
}
}

@ -1,880 +0,0 @@
import 'dart:convert';
import 'dart:io';
import 'package:doctor/common/settings.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:multi_image_picker/multi_image_picker.dart';
class AddResources extends StatefulWidget {
const AddResources({Key? key}) : super(key: key);
@override
State<AddResources> createState() => _AddResourcesState();
}
class _AddResourcesState extends State<AddResources> {
TextEditingController nameController = TextEditingController();
TextEditingController youtubeLinkUrlController = TextEditingController();
TextEditingController dosController1 = TextEditingController();
TextEditingController dosController2 = TextEditingController();
TextEditingController dosController3 = TextEditingController();
TextEditingController donotsController1 = TextEditingController();
TextEditingController donotsController2 = TextEditingController();
TextEditingController donotsController3 = TextEditingController();
TextEditingController urlController1 = TextEditingController();
TextEditingController urlController2 = TextEditingController();
TextEditingController urlController3 = TextEditingController();
bool isSecondAddButtonShow=false;
bool is2nddosControllerVisible=false;
bool is3rddosControllerVisible=false;
bool is4thdosControllerVisible=false;
bool is5thdosControllerVisible=false;
bool is2nddonotsControllerVisible=false;
bool is3rddonotsControllerVisible=false;
bool is4thdonotsControllerVisible=false;
bool is5thdonotsControllerVisible=false;
bool is2ndurlControllerVisible=false;
bool is3rdurlControllerVisible=false;
bool is4thurlControllerVisible=false;
bool is5thurlControllerVisible=false;
List dos=[];
List donots=[];
List urls=[];
List images=[];
List videos=[];
List uiImages = [];
List imageFileListResources = [];
final ImagePicker _picker = ImagePicker();
String Url = '';
final ImagePicker imagePicker = ImagePicker();
Future takeImageFromCameraForReports() 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.uploadResourceCamera(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
uiImages = jsonDecode(res)['pictures'];
images= jsonDecode(res)['pictures'];
//reports=jsonDecode(res)['reportsPictureUpload'];
//reportsPictureId=jsonDecode(res)['reportsPictureUpload']['reportsPictureId'];
});
} on PlatformException catch (e) {
print('Failed to pick image: $e');
}
}
Future pickImageFromGalleryForReports() async {
imageFileListResources = [];
final List<XFile>? selectedImages = await imagePicker.pickMultiImage();
AppSettings.preLoaderDialog(context);
if (selectedImages!.isNotEmpty) {
imageFileListResources.addAll(selectedImages);
}
var res = await AppSettings.uploadResourcesGallery(imageFileListResources);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
uiImages = jsonDecode(res)['pictures'];
images= jsonDecode(res)['pictures'];
//reports=jsonDecode(res)['reportsPictureUpload'];
//reportsPictureId=jsonDecode(res)['reportsPictureUpload']['reportsPictureId'];
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppSettings.appBar('Add Resources'),
body: Stack(children: <Widget>[
Container(
decoration: const BoxDecoration(
/* image: DecorationImage(
image: AssetImage("images/backgroundimage.png"),
fit: BoxFit.cover,
),*/
),
),
GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
children: <Widget>[
SizedBox(
height:MediaQuery.of(context).size.height * .02,
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
child: TextFormField(
cursorColor: greyColor,
controller: nameController,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Resource name',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),//name
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Dos',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: dosController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: dosController1.text!='',
child: IconButton(
onPressed: (){
setState(() {
is2nddosControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:dosController2.text!=''&&dosController2.text!='null'||is2nddosControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: dosController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: dosController2.text!='',
child: IconButton(
onPressed: (){
setState(() {
is3rddosControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible: dosController3.text!=''&&dosController3.text!='null'||is3rddosControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: dosController3,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
/*Visibility(
visible: dosController3.text!='',
child: IconButton(
onPressed: (){
setState(() {
is4thdosControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))*/
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Donts',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: donotsController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: donotsController1.text!='',
child: IconButton(
onPressed: (){
setState(() {
is2nddonotsControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:donotsController2.text!=''&&donotsController2.text!='null'||is2nddonotsControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: donotsController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: donotsController2.text!='',
child: IconButton(
onPressed: (){
setState(() {
is3rddonotsControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible: donotsController3.text!=''&&donotsController3.text!='null'||is3rddonotsControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: donotsController3,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.location_city,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Description',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
/*Visibility(
visible: dosController3.text!='',
child: IconButton(
onPressed: (){
setState(() {
is4thdosControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))*/
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Text('Urls',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: urlController1,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.link,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter video link url if any',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: urlController1.text!='',
child: IconButton(
onPressed: (){
setState(() {
is2ndurlControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible:urlController2.text!=''&&urlController2.text!='null'||is2ndurlControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: urlController2,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.link,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter video link url if any',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
Visibility(
visible: urlController2.text!='',
child: IconButton(
onPressed: (){
setState(() {
is3rdurlControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))
],
),
),
),),
SizedBox(height:MediaQuery.of(context).size.height * .02,),
Visibility(
visible: urlController3.text!=''&&urlController3.text!='null'||is3rdurlControllerVisible,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: secondaryColor,
border: Border.all(
//width: 10,
color: Colors.white,
),
borderRadius: BorderRadius.circular(
20,
)),
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
cursorColor: greyColor,
controller: urlController3,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.link,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter video link url if any',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
/*Visibility(
visible: dosController3.text!='',
child: IconButton(
onPressed: (){
setState(() {
is4thdosControllerVisible=true;
});
},
icon: Icon(Icons.add_box, color: primaryColor,)))*/
],
),
),
),),
Visibility(
visible: uiImages.length == 0,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 200,
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
child: Icon(
Icons.camera_alt_outlined,
size: 100,
color: primaryColor,
),
onTap: () async {
await takeImageFromCameraForReports();
Navigator.pop(context);
},
),
SizedBox(
width:
MediaQuery.of(context).size.width *
.20,
),
GestureDetector(
child: Icon(
Icons.photo,
size: 100,
color: primaryColor,
),
onTap: () async {
await pickImageFromGalleryForReports();
Navigator.pop(context);
},
),
],
),
),
);
});
},
child: const Text('Select Image'),
),
),
Visibility(
visible: uiImages.length > 0,
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * .20,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: uiImages.length,
itemBuilder: (context, index) {
return Column(
children: [
Card(
child: GestureDetector(
onTap: () {
/* Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new ImageZoomPage(imageName:'Reports',imageDetails:uiReportsImages[index]['url'])));
*/
},
child: Container(
width: MediaQuery.of(context).size.width *
.30,
height:
MediaQuery.of(context).size.height *
.15,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: NetworkImage(
uiImages[0])
as ImageProvider, // picked file
fit: BoxFit.fill)),
child: Stack(children: [
/*Positioned(
right: 0,
child: Container(
child: IconButton(
iconSize: 30,
icon: const Icon(
Icons.cancel,
color: Colors.red,
),
onPressed: () async {
AppSettings.preLoaderDialog(context);
String fileName = uiReportsImages[index]['url'].split('/').last;
var response = await AppSettings.deleteReports(fileName,reportsPictureId);
print(jsonDecode(response));
Navigator.of(context, rootNavigator: true).pop();
setState(() {
uiReportsImages = jsonDecode(response)['reportsPictureUpload']['reports'];
});
},
),
),
)*/
]),
),
)
),
/*Expanded(child:IconButton(
icon: const Icon(Icons.remove,color: Colors.red,),
onPressed: () async{
},
),)*/
],
);
}),
)),
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: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: () async{
if(dosController1!=''){
dos.add({
'dos': dosController1.text,
});
}
if(dosController2!=''){
dos.add({
'dos': dosController2.text,
});
}
if(dosController3!=''){
dos.add({
'dos': dosController3.text,
});
}
if(donotsController1!=''){
donots.add({
'doNots': donotsController1.text,
});
}
if(donotsController2!=''){
donots.add({
'doNots': donotsController2.text,
});
}
if(donotsController3!=''){
donots.add({
'doNots': donotsController3.text,
});
}
if(urlController1!=''){
urls.add({
'url': urlController1.text,
});
}
if(urlController2!=''){
urls.add({
'url': urlController2.text,
});
}
if(urlController3!=''){
urls.add({
'url': urlController3.text,
});
}
AppSettings.preLoaderDialog(context);
var payload = new Map<String, dynamic>();
payload["resourceName"] = nameController.text.toString();
payload["dos"] =dos ;
payload["doNots"] =donots ;
payload["url"] =urls ;
payload["image"] =images;
payload["createdBy"] =AppSettings.doctorName ;
payload["updatedBy"] =AppSettings.doctorName ;
bool addResourcesState = await AppSettings.addResource(payload);
try{
if(addResourcesState){
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longSuccessToast('Resource added successfully');
Navigator.pop(context);
}
else{
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('Fail to add Resource details');
}
}
catch(e){
print(e);
Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast('Fail to add Resource details');
}
},
child: Text('Add Resource'),
)
),
],
),
)
)),
),
]));
}
}

@ -1,323 +0,0 @@
import 'dart:convert';
import 'package:doctor/common/settings.dart';
import 'package:doctor/models/resources_model.dart';
import 'package:doctor/resources/add_resurces.dart';
import 'package:flutter/material.dart';
class Resources extends StatefulWidget {
const Resources({Key? key}) : super(key: key);
@override
State<Resources> createState() => _ResourcesState();
}
class _ResourcesState extends State<Resources> {
bool isDataLoading=false;
bool isSereverIssue=false;
List<ResourcesModel> resourcecList = [];
Future<void> getAllResources() async {
isDataLoading=true;
try {
var response = await AppSettings.getAllResources();
setState(() {
resourcecList = ((jsonDecode(response)) as List)
.map((dynamic model) {
return ResourcesModel.fromJson(model);
}).toList();
resourcecList=resourcecList.reversed.toList();
isDataLoading = false;
});
} catch (e) {
setState(() {
isDataLoading = false;
isSereverIssue = true;
});
}
}
@override
void initState() {
getAllResources();
super.initState();
}
Widget _dos(dos){
if(dos.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: dos.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Text(dos[index]['dos'].toString(),style: valuesTextStyle()),
);
});
}
else{
return Text('No dos found for this resource',style: valuesTextStyle());
}
}
Widget _donots(donots){
if(donots.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: donots.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Text(donots[index]['doNots'].toString(),style: valuesTextStyle()),
);
});
}
else{
return Text('No doNots found for this resource',style: valuesTextStyle());
}
}
Widget _urls(urls){
if(urls.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: urls.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Text(urls[index]['url'].toString(),style: valuesTextStyle()),
);
});
}
else{
return Text('No urls found for this resource',style: valuesTextStyle());
}
}
Widget _resources(){
if(resourcecList.length!=0){
return ListView.builder(
padding: EdgeInsets.all(0),
itemCount: resourcecList.length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: (){
},
child: Card(
//color: prescriptionsList[index].cardColor,
child: Padding(
padding:EdgeInsets.all(8) ,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Resource Name',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
child: Text(
'Dos',
style: labelTextStyle(),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
child: Text(
'DoNots',
style: labelTextStyle(),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
child: Text(
'Urls',
style: labelTextStyle(),
),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
':',
style: labelTextStyle(),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
child: Text(
':',
style: labelTextStyle(),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
child: Text(
':',
style: labelTextStyle(),
),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
child: Text(
':',
style: labelTextStyle(),
),
),
],
),
SizedBox(width:MediaQuery.of(context).size.width * .01,),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(resourcecList[index].resource_name.toString().toUpperCase(),style: valuesTextStyle()),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
width:MediaQuery.of(context).size.width * .80,
child: _dos(resourcecList[index].dos),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
width:MediaQuery.of(context).size.width * .80,
child: _donots(resourcecList[index].donts),
),
SizedBox(height:MediaQuery.of(context).size.height * .01,),
Container(
height:MediaQuery.of(context).size.height * .10,
width:MediaQuery.of(context).size.width * .80,
child: _urls(resourcecList[index].urls),
)
],
),
],
),
),
],
),
],
),
),
),
);
});
}
else{
return Center(
child: Padding(
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: MediaQuery.of(context).size.height * .25,),
Text('Click below icon to add new resource'),
SizedBox(
height: 20,
),
CircleAvatar(
backgroundColor: primaryColor,
radius: 40,
child: IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.white,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => AddResources())).then((value) {
getAllResources();
});
},
),
)
],
),
)
);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Resources'),
body: Container(
child: isDataLoading?Center(
child: CircularProgressIndicator(
color: primaryColor,
strokeWidth: 5.0,
),
): _resources(),
),
floatingActionButton: Visibility(
visible:resourcecList.length!=0,
child: CircleAvatar(
backgroundColor: buttonColors,
radius: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
iconSize: 40,
icon: const Icon(
Icons.add,
color: Colors.black,
),
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => AddResources())).then((value) {
getAllResources();
});
},
),
],
),
),
),
);
}
}

@ -1,19 +0,0 @@
import 'package:doctor/common/settings.dart';
import 'package:flutter/material.dart';
class VideoCall extends StatefulWidget {
const VideoCall({Key? key}) : super(key: key);
@override
State<VideoCall> createState() => _VideoCallState();
}
class _VideoCallState extends State<VideoCall> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Video Call'),
body: Container(),
);
}
}

@ -370,13 +370,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_barcode_scanner:
dependency: "direct main"
description:
name: flutter_barcode_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_cupertino_datetime_picker:
dependency: "direct main"
description:
@ -399,7 +392,7 @@ packages:
source: hosted
version: "0.4.0"
flutter_launcher_icons:
dependency: "direct main"
dependency: "direct dev"
description:
name: flutter_launcher_icons
url: "https://pub.dartlang.org"
@ -454,13 +447,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
flutter_share:
dependency: "direct main"
description:
name: flutter_share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
flutter_slidable:
dependency: "direct main"
description:
@ -1073,13 +1059,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
share:
dependency: "direct main"
description:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences:
dependency: "direct main"
description:

@ -58,10 +58,6 @@ dependencies:
assets_audio_player: ^3.0.3+3
path: ^1.8.0
visibility_detector: ^0.4.0+2
flutter_launcher_icons: ^0.11.0
share: ^2.0.4
flutter_share: ^2.0.0
flutter_barcode_scanner: ^2.0.0
dev_dependencies:
flutter_test:
@ -69,11 +65,7 @@ dev_dependencies:
flutter_lints: ^2.0.0
flutter_icons:
image_path: "images/appicon.png" # Update this path as necessary
android: true
ios: true
flutter_launcher_icons: ^0.11.0
flutter:

Loading…
Cancel
Save