You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
4.3 KiB
Dart
130 lines
4.3 KiB
Dart
4 years ago
|
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
||
|
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
|
||
|
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class SelectPatientInfoDialog extends StatefulWidget {
|
||
|
final List<PatientInfo> patientInfoList ;
|
||
|
final Function(PatientInfo) onValueSelected;
|
||
|
PatientInfo selectedPatientInfo;
|
||
|
|
||
|
SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected,this.selectedPatientInfo});
|
||
|
|
||
|
@override
|
||
|
_SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState();
|
||
|
}
|
||
|
|
||
|
class _SelectPatientInfoDialogState extends State<SelectPatientInfoDialog> {
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
widget.selectedPatientInfo = widget.selectedPatientInfo?? widget.patientInfoList[0];
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return SimpleDialog(
|
||
|
children: [
|
||
|
Column(
|
||
|
children: [
|
||
|
Divider(),
|
||
|
...List.generate(
|
||
|
widget.patientInfoList.length,
|
||
|
(index) => Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
SizedBox(
|
||
|
height: 2,
|
||
|
),
|
||
|
Row(
|
||
|
children: <Widget>[
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: InkWell(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
widget.selectedPatientInfo = widget.patientInfoList[index];
|
||
|
});
|
||
|
},
|
||
|
child: ListTile(
|
||
|
title: Text(widget.patientInfoList[index].fullName),
|
||
|
leading: Radio(
|
||
|
value: widget.patientInfoList[index],
|
||
|
groupValue: widget.selectedPatientInfo,
|
||
|
activeColor: Colors.red[800],
|
||
|
onChanged: (value) {
|
||
|
setState(() {
|
||
|
widget.selectedPatientInfo = value;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
],
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 5.0,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
SizedBox(
|
||
|
height: 5.0,
|
||
|
),
|
||
|
Row(
|
||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: <Widget>[
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: InkWell(
|
||
|
onTap: () {
|
||
|
Navigator.pop(context);
|
||
|
},
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: Container(
|
||
|
child: Center(
|
||
|
child: Texts(
|
||
|
'CANCEL',
|
||
|
color: Colors.red,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Container(
|
||
|
width: 1,
|
||
|
height: 30,
|
||
|
color: Colors.grey[500],
|
||
|
),
|
||
|
Expanded(
|
||
|
flex: 1,
|
||
|
child: InkWell(
|
||
|
onTap: () {
|
||
|
widget.onValueSelected(widget.selectedPatientInfo);
|
||
|
Navigator.pop(context);
|
||
|
},
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: Center(
|
||
|
child: Texts(
|
||
|
'Ok',
|
||
|
fontWeight: FontWeight.w400,
|
||
|
)),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
)
|
||
|
],
|
||
|
)
|
||
|
],
|
||
|
);
|
||
|
}
|
||
|
}
|