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.
329 lines
10 KiB
Dart
329 lines
10 KiB
Dart
import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
class SelectBloodDialog extends StatefulWidget {
|
|
|
|
final Blood bloodType;
|
|
final Function(Blood) onValueSelected;
|
|
|
|
SelectBloodDialog({Key key, this.bloodType, this.onValueSelected});
|
|
|
|
|
|
|
|
@override
|
|
_SelectBloodDialogState createState() => _SelectBloodDialogState(this.bloodType);
|
|
}
|
|
|
|
class _SelectBloodDialogState extends State<SelectBloodDialog> {
|
|
_SelectBloodDialogState(this.bloodType);
|
|
Blood bloodType;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SimpleDialog(
|
|
children: [
|
|
Container(
|
|
child: Column(
|
|
children: [
|
|
Divider(),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.Oplus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("O+"),
|
|
leading: Radio(
|
|
value: Blood.Oplus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.Ominus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("O-"),
|
|
leading: Radio(
|
|
value: Blood.Ominus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.ABminus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("AB-"),
|
|
leading: Radio(
|
|
value: Blood.ABminus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.ABplus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("AB+"),
|
|
leading: Radio(
|
|
value: Blood.ABplus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.Aplus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("A+"),
|
|
leading: Radio(
|
|
value: Blood.Aplus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.Aminus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("A-"),
|
|
leading: Radio(
|
|
value: Blood.Aminus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.Bplus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("B+"),
|
|
leading: Radio(
|
|
value: Blood.Bplus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
bloodType = Blood.Bminus;
|
|
});
|
|
},
|
|
child: ListTile(
|
|
title: Text("B-"),
|
|
leading: Radio(
|
|
value: Blood.Bminus,
|
|
groupValue: bloodType,
|
|
activeColor: Colors.red[800],
|
|
onChanged: (Blood value) {
|
|
setState(() {
|
|
bloodType = 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(
|
|
TranslationBase.of(context).cancel.toUpperCase(),
|
|
color: Colors.red,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 1,
|
|
height: 30,
|
|
color: Colors.grey[500],
|
|
),
|
|
Expanded(
|
|
flex: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
widget.onValueSelected(bloodType);
|
|
Navigator.pop(context);
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Center(
|
|
child: Texts(
|
|
TranslationBase.of(context).ok,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|