import 'package:diplomaticquarterapp/core/model/er/TriageInformationRequest.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/EdOnlineViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../Constants.dart'; class EdOnlineSelectedHospitalPage extends StatefulWidget { final Function changePageViewIndex; TriageInformationRequest triageInformationRequest; EdOnlineSelectedHospitalPage( {Key key, this.changePageViewIndex,this.triageInformationRequest}) : super(key: key); @override _EdOnlineSelectedHospitalPageState createState() => _EdOnlineSelectedHospitalPageState(); } class _EdOnlineSelectedHospitalPageState extends State { @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getHospitals(), builder: (_, model, w) => AppScaffold( baseViewModel: model, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Column( children: [ ...List.generate( model.hospitals.length, (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 2, ), Row( children: [ Expanded( flex: 1, child: InkWell( onTap: () { setState(() { widget.triageInformationRequest.selectedHospital = model.hospitals[index]; widget.triageInformationRequest.projectID = model.hospitals[index].iD; }); }, child: ListTile( title: Text(model.hospitals[index].name + ' ${model.hospitals[index].distanceInKilometers} ' + TranslationBase.of(context).km), leading: Radio( value: model.hospitals[index], groupValue: widget.triageInformationRequest.selectedHospital, activeColor: secondaryColor, onChanged: (value) { setState(() { widget.triageInformationRequest.selectedHospital = model.hospitals[index]; widget.triageInformationRequest.projectID = model.hospitals[index].iD; }); }, ), ), ), ) ], ), SizedBox( height: 5.0, ), ], ), ) ], ), ), bottomSheet: Container( height: 76, child: Padding( padding: const EdgeInsets.all(8.0), child: SecondaryButton( // textColor: Colors.white, color: Theme.of(context).primaryColor, label: TranslationBase.of(context).next.toUpperCase(), disabled: widget.triageInformationRequest.selectedHospital==null, onTap: () => widget.changePageViewIndex(1)), ), ), ), ); } }