@ -1,22 +1,26 @@
import ' package:doctor_app_flutter/config/config.dart ' ;
import ' package:doctor_app_flutter/core/model/pharmacy-intervention-model/intervention_history.dart ' ;
import ' package:doctor_app_flutter/utils/dr_app_toast_msg.dart ' ;
import ' package:doctor_app_flutter/utils/translations_delegate_base_utils.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/app_texts_widget.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart ' ;
import ' package:flutter/material.dart ' ;
class InterventionHistoryItem extends StatelessWidget {
final InterventionHistory interventionHistory ;
final Function ( InterventionHistory ) onAcceptClick ;
final Function ( InterventionHistory , String ) onAcceptClick ;
/ / string is index here
final Function( InterventionHistory ) onRejectClick ;
final Function ( InterventionHistory , String ) onRejectClick ;
final TextEditingController remarksController = TextEditingController ( ) ;
const InterventionHistoryItem ( {
InterventionHistoryItem ( {
super . key ,
required this . interventionHistory ,
required this . onAcceptClick ,
required this . onRejectClick ,
} ) ;
@ override
@ -56,6 +60,19 @@ class InterventionHistoryItem extends StatelessWidget {
color: Color ( 0xFF2B353E ) ,
) ,
SizedBox ( height: 8 , ) ,
AppTextFieldCustom (
hintText: TranslationBase . of ( context ) . addDoctorRemarks ,
controller: remarksController ,
maxLines: 48 ,
minLines: 2 ,
hasBorder: true ,
inputType: TextInputType . multiline ,
onClick: ( ) { } ,
onChanged: ( value ) { } ,
onFieldSubmitted: ( ) { } ,
) ,
SizedBox ( height: 16 , ) ,
Row ( children: [
Expanded (
child: SizedBox (
@ -69,7 +86,11 @@ class InterventionHistoryItem extends StatelessWidget {
color: AppGlobal . appRedColor ,
fontColor: Colors . white ,
onPressed: ( ) async {
onRejectClick ( interventionHistory ) ;
if ( remarksController . text . isEmpty = = true ) {
DrAppToastMsg . showErrorToast ( TranslationBase . of ( context ) . remarksNotAdded ) ;
return ;
}
onRejectClick ( interventionHistory , remarksController . text ) ;
} ,
) ,
) ,
@ -89,7 +110,11 @@ class InterventionHistoryItem extends StatelessWidget {
color: AppGlobal . appGreenColor ,
fontColor: Colors . white ,
onPressed: ( ) async {
onAcceptClick ( interventionHistory ) ;
if ( remarksController . text . isEmpty = = true ) {
DrAppToastMsg . showErrorToast ( TranslationBase . of ( context ) . remarksNotAdded ) ;
return ;
}
onAcceptClick ( interventionHistory , remarksController . text ) ;
} ,
) ,
) ,