Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 935 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 662 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 650 KiB After Width: | Height: | Size: 219 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 817 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,123 @@
|
||||
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),),),),
|
||||
)*/
|
||||
|
||||
],
|
||||
),),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,230 @@
|
||||
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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,281 @@
|
||||
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)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
class AppImages {
|
||||
static const String pickupMarker = "assets/images/pickup_marker.png";
|
||||
static const String dropMarker = "assets/images/drop_marker.png";
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
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(),
|
||||
});
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
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}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,252 @@
|
||||
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))
|
||||
),
|
||||
)
|
||||
)),*/
|
||||
],
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
enum PaddingType { symmetric, only }
|
@ -0,0 +1,53 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|