Pharmacy intervention fixes

update_flutter_3.16.0_sdk-upgrade
haroon amjad 4 months ago
parent ba68ad8679
commit 80207d5942

@ -13,7 +13,9 @@ const DOCTOR_ROTATION = 'https://doctorrota.hmg.com/';
// const BASE_URL = 'http://10.20.200.111:1010/'; // const BASE_URL = 'http://10.20.200.111:1010/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://webservices.hmg.com/'; // const BASE_URL = 'https://webservices.hmg.com/';
// //

@ -1,3 +1,5 @@
import 'package:flutter/cupertino.dart';
class InterventionHistoryList{ class InterventionHistoryList{
List<InterventionHistory>? history = []; List<InterventionHistory>? history = [];
InterventionHistoryList.fromJson(Map<String, dynamic> json){ InterventionHistoryList.fromJson(Map<String, dynamic> json){
@ -19,6 +21,7 @@ class InterventionHistory {
String? interventionDesc; String? interventionDesc;
int? interventionId; int? interventionId;
String? remark; String? remark;
TextEditingController remarksController = TextEditingController();
InterventionHistory({ InterventionHistory({
this.authizationFormText, this.authizationFormText,

@ -9,7 +9,7 @@ class NoData extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return SingleChildScrollView(
child: Container( child: Container(
child: ErrorMessage(error: TranslationBase.of(context).noDataAvailable), child: ErrorMessage(error: TranslationBase.of(context).noDataAvailable),
), ),

@ -436,7 +436,8 @@ class _InsuranceApprovalsDetailsState extends State<InsuranceApprovalsDetails> {
AppText('Sample') AppText('Sample')
], ],
), ),
Row( model.insuranceApproval[indexInsurance].rceiptOn != null
? Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context).receiptOn + ": ", TranslationBase.of(context).receiptOn + ": ",
@ -450,7 +451,8 @@ class _InsuranceApprovalsDetailsState extends State<InsuranceApprovalsDetails> {
), ),
), ),
], ],
), )
: SizedBox.shrink(),
Row( Row(
children: [ children: [
AppText( AppText(

@ -1,3 +1,5 @@
import 'dart:ui';
import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart'; import 'package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
@ -19,6 +21,7 @@ class PharmacyIntervention extends StatefulWidget {
} }
class _PharmacyInterventionState extends State<PharmacyIntervention> { class _PharmacyInterventionState extends State<PharmacyIntervention> {
bool isBottomSheetShown = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyInterventionViewModel>(onModelReady: (model) { return BaseView<PharmacyInterventionViewModel>(onModelReady: (model) {
@ -29,7 +32,8 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
]); ]);
}); });
}, builder: (_, model, __) { }, builder: (_, model, __) {
if (model.interventionHistoryList != null) { if (model.interventionHistoryList != null && !model.isBottomSheetShown) {
model.toggleBottomOpenValue(true);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
showBottomSheet( showBottomSheet(
context, context,
@ -117,28 +121,23 @@ class _PharmacyInterventionState extends State<PharmacyIntervention> {
showModalBottomSheet( showModalBottomSheet(
isDismissible: true, isDismissible: true,
context: context, context: context,
isScrollControlled: true,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topRight: Radius.circular(20))), topLeft: Radius.circular(20), topRight: Radius.circular(20))),
builder: (_) { builder: (_) {
return DraggableScrollableSheet( return Padding(
key: _sheet, padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
initialChildSize: 0.7, child: InterventionHistoryBottomSheet(
minChildSize: 0.7,
maxChildSize: 1,
snapSizes: [
0.7, // constraints.maxHeight,
1,
],
expand: false,
controller: _controller,
builder: (_, controller) => InterventionHistoryBottomSheet(
interventionList: interventionHistory, interventionList: interventionHistory,
model: model, model: model,
controller: controller, ),
)); );
}, },
).then((value) => model.toggleShowBottomSheetValue()); ).then((value) {
model.toggleShowBottomSheetValue();
model.toggleBottomOpenValue(false);
});
} }
void SearchDialog(BuildContext context, PharmacyInterventionViewModel model) { void SearchDialog(BuildContext context, PharmacyInterventionViewModel model) {

@ -12,6 +12,7 @@ import 'package:intl/intl.dart';
class PharmacyInterventionViewModel extends BaseViewModel { class PharmacyInterventionViewModel extends BaseViewModel {
PharmacyInterventionService _service = locator<PharmacyInterventionService>(); PharmacyInterventionService _service = locator<PharmacyInterventionService>();
MedicationList? medicationList; MedicationList? medicationList;
bool isBottomSheetShown = false;
// MedicationList? medicationList = MedicationList.fromJson({ // MedicationList? medicationList = MedicationList.fromJson({
// "entityList": [ // "entityList": [
@ -630,4 +631,8 @@ class PharmacyInterventionViewModel extends BaseViewModel {
toggleShowBottomSheetValue() { toggleShowBottomSheetValue() {
interventionHistoryList = null; interventionHistoryList = null;
} }
toggleBottomOpenValue(bool bottomSheetValue){
isBottomSheetShown = bottomSheetValue;
}
} }

@ -8,28 +8,27 @@ import 'package:flutter/material.dart';
class InterventionHistoryBottomSheet extends StatelessWidget { class InterventionHistoryBottomSheet extends StatelessWidget {
final List<InterventionHistory> interventionList; final List<InterventionHistory> interventionList;
final ScrollController controller;
// final ScrollController controller;
final PharmacyInterventionViewModel model; final PharmacyInterventionViewModel model;
const InterventionHistoryBottomSheet( const InterventionHistoryBottomSheet({super.key, required this.interventionList, required this.model});
{super.key, required this.interventionList, required this.controller, required this.model});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return SizedBox(
height: MediaQuery.sizeOf(context).height * (interventionList.length == 1 ? 0.5 : 0.7),
child: Material(
color: Color(0xFFF7F7F7), color: Color(0xFFF7F7F7),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 32), padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 32),
child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase TranslationBase.of(context).histories,
.of(context)
.histories,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 24, fontSize: 24,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
@ -37,22 +36,19 @@ class InterventionHistoryBottomSheet extends StatelessWidget {
SizedBox( SizedBox(
height: 16, height: 16,
), ),
Expanded( Column(
child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded( ListView.separated(
child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
controller: controller,
itemCount: interventionList.length, itemCount: interventionList.length,
itemBuilder: (context, index) => physics: BouncingScrollPhysics(),
Material( itemBuilder: (context, index) => Material(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
borderRadius: BorderRadius.circular(10)),
color: Colors.white, color: Colors.white,
child: InterventionHistoryItem( child: InterventionHistoryItem(
remarksController: interventionList[index].remarksController,
interventionHistory: interventionList[index], interventionHistory: interventionList[index],
onAcceptClick: (intervention, remarks) { onAcceptClick: (intervention, remarks) {
model.updateInterventionDiseaseStatus( model.updateInterventionDiseaseStatus(
@ -68,21 +64,20 @@ class InterventionHistoryBottomSheet extends StatelessWidget {
remarks: remarks, remarks: remarks,
interventionID: interventionList[index].interventionId.toString(), interventionID: interventionList[index].interventionId.toString(),
successMessage: TranslationBase.of(context).interventionRejectedSuccessfully, successMessage: TranslationBase.of(context).interventionRejectedSuccessfully,
errorMessage: TranslationBase.of(context).unableToPerformTheAction errorMessage: TranslationBase.of(context).unableToPerformTheAction);
);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
), ),
separatorBuilder: (_, __) => Divider(), separatorBuilder: (_, __) => Divider(),
)) )
], ],
),
) )
], ],
), ),
), ),
),
),
); );
} }
} }

@ -12,7 +12,7 @@ class InterventionHistoryItem extends StatelessWidget {
final Function(InterventionHistory, String) onAcceptClick; final Function(InterventionHistory, String) onAcceptClick;
final Function(InterventionHistory, String) onRejectClick; final Function(InterventionHistory, String) onRejectClick;
final TextEditingController remarksController = TextEditingController(); final TextEditingController remarksController;
InterventionHistoryItem({ InterventionHistoryItem({
@ -20,6 +20,7 @@ class InterventionHistoryItem extends StatelessWidget {
required this.interventionHistory, required this.interventionHistory,
required this.onAcceptClick, required this.onAcceptClick,
required this.onRejectClick, required this.onRejectClick,
required this.remarksController,
}); });

@ -141,8 +141,17 @@ class Utils {
} }
static Future<bool> checkConnection() async { static Future<bool> checkConnection() async {
List<ConnectivityResult> result = await (Connectivity().checkConnectivity()); List<ConnectivityResult> connectivityResult = await (Connectivity().checkConnectivity());
return result.contains(ConnectivityResult.wifi)||result.contains(ConnectivityResult.mobile); if (connectivityResult.contains(ConnectivityResult.mobile) ||
connectivityResult.contains(ConnectivityResult.wifi) ||
connectivityResult.contains(ConnectivityResult.ethernet) ||
connectivityResult.contains(ConnectivityResult.bluetooth) ||
connectivityResult.contains(ConnectivityResult.vpn)) {
return true;
} else {
return false;
}
// return result.contains(ConnectivityResult.wifi)||result.contains(ConnectivityResult.mobile);
} }
static List<WorkingHours> getWorkingHours(String workingHours) { static List<WorkingHours> getWorkingHours(String workingHours) {

Loading…
Cancel
Save