import 'package:diplomaticquarterapp/core/enum/Ambulate.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER.dart'; import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class BillAmount extends StatefulWidget { final Function changeCurrentTab; final PatientER patientER; final PatientER_RC patientER_RC; final AmRequestViewModel amRequestViewModel; BillAmount({Key key, this.changeCurrentTab, this.patientER, this.patientER_RC, this.amRequestViewModel}); @override _BillAmountState createState() => _BillAmountState(); } class _BillAmountState extends State { Ambulate _ambulate = Ambulate.None; String note = ""; @override void initState() { // if (widget.patientER_RC.transportationDetails.ambulate != null) { // setState(() { // _ambulate = widget.patientER.ambulate; // note = widget.patientER.requesterNote; // }); // } super.initState(); } @override Widget build(BuildContext context) { return AppScaffold( isShowDecPage: false, isShowAppBar: false, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( margin: EdgeInsets.only(left: 12, right: 12, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(TranslationBase.of(context).billAmount, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 10, ), Container( decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 3), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).patientShareToDo), ), Expanded( child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.price}', isBold: true), ) ], ), ), mDivider(Colors.grey[200]), Container( width: double.infinity, padding: EdgeInsets.only(top: 3, bottom: 3), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).patientTaxToDo), ), Expanded( child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceVAT}', isBold: true), ) ], ), ), mDivider(Colors.grey[200]), Container( width: double.infinity, padding: EdgeInsets.only(top: 3, bottom: 3), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), ), Expanded( child: _getNormalText(TranslationBase.of(context).sar + ' ${widget.patientER_RC.patientERTransportationMethod.priceTotal}', isBold: true, isTotal: true), ) ], ), ), ], ), ), ), SizedBox( height: 10, ), Text(TranslationBase.of(context).selectAmbulate, style: TextStyle(fontSize: 16.0, letterSpacing: -0.64, fontWeight: FontWeight.w600)), SizedBox( height: 5, ), Row( children: [ InkWell( onTap: () { setState(() { _ambulate = Ambulate.Wheelchair; }); }, child: Container( width: MediaQuery.of(context).size.width * 0.9, child: ListTile( contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), title: Row( children: [ Radio( value: Ambulate.Wheelchair, groupValue: _ambulate, onChanged: (value) { setState(() { _ambulate = value; }); }, ), Text( TranslationBase.of(context).wheelchair, style: TextStyle( fontSize: 12.0, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), ], ), ), ), ), ], ), Row( children: [ InkWell( onTap: () { setState(() { _ambulate = Ambulate.Walker; }); }, child: Container( width: MediaQuery.of(context).size.width * 0.9, child: ListTile( contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), title: Row( children: [ Radio( value: Ambulate.Walker, groupValue: _ambulate, onChanged: (value) { setState(() { _ambulate = value; }); }, ), Text( TranslationBase.of(context).walker, style: TextStyle( fontSize: 12.0, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), ], ), ), ), ), ], ), Row( children: [ InkWell( onTap: () { setState(() { _ambulate = Ambulate.Stretcher; }); }, child: Container( width: MediaQuery.of(context).size.width * 0.9, child: ListTile( contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), title: Row( children: [ Radio( value: Ambulate.Stretcher, groupValue: _ambulate, onChanged: (value) { setState(() { _ambulate = value; }); }, ), Text( TranslationBase.of(context).stretcher, style: TextStyle( fontSize: 12.0, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), ], ), ), ), ), ], ), Row( children: [ InkWell( onTap: () { setState(() { _ambulate = Ambulate.None; }); }, child: Container( width: MediaQuery.of(context).size.width * 0.9, child: ListTile( contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), title: Row( children: [ Radio( value: Ambulate.None, groupValue: _ambulate, onChanged: (value) { setState(() { _ambulate = value; }); }, ), Text( TranslationBase.of(context).none, style: TextStyle( fontSize: 12.0, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), ], ), ), ), ), ], ), SizedBox( height: 12, ), Container( decoration: cardRadius(10), child: Padding( padding: EdgeInsets.all(8.0), child: TextField( maxLines: 5, decoration: InputDecoration.collapsed( hintText: TranslationBase.of(context).notes, hintStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16)), onChanged: (value) { setState(() { note = value; }); }, ), ), ), SizedBox( height: 100, ), ], ), ), ), bottomSheet: Container( color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.all(12.0), child: DefaultButton( TranslationBase.of(context).next, () { setState(() { widget.patientER_RC.transportationDetails.ambulate = _ambulate.selectAmbulateNumber(); widget.patientER_RC.transportationDetails.ambulateTitle = _ambulate.getAmbulateTitle(context); widget.patientER_RC.transportationDetails.notes = note; // widget.patientER.selectedAmbulate = _ambulate.selectAmbulateNumber(); widget.changeCurrentTab(3); }); }, // label: TranslationBase.of(context).next, ), ), ); } _getNormalText(text, {bool isBold = false, bool isTotal = false}) { return Text( text, style: TextStyle( fontSize: isBold ? isTotal ? 16 : 12 : 10, letterSpacing: -0.5, color: isBold ? Colors.black : Colors.grey[700], fontWeight: FontWeight.w600, ), ); } }