Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into hijri_calender
Conflicts: lib/screens/patients/register_patient/RegisterSearchPatientPage.dartmerge-requests/883/head
commit
0bdb15b14e
@ -0,0 +1,77 @@
|
|||||||
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CountryTextField extends StatefulWidget {
|
||||||
|
final dynamic element;
|
||||||
|
final String elementError;
|
||||||
|
final List<dynamic> elementList;
|
||||||
|
final String keyName;
|
||||||
|
final String keyId;
|
||||||
|
final String hintText;
|
||||||
|
final double width;
|
||||||
|
final Function(dynamic) okFunction;
|
||||||
|
|
||||||
|
CountryTextField(
|
||||||
|
{Key key,
|
||||||
|
@required this.element,
|
||||||
|
@required this.elementError,
|
||||||
|
this.width,
|
||||||
|
this.elementList,
|
||||||
|
this.keyName,
|
||||||
|
this.keyId,
|
||||||
|
this.hintText,
|
||||||
|
this.okFunction})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_CountryTextfieldState createState() => _CountryTextfieldState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CountryTextfieldState extends State<CountryTextField> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: widget.width ?? null,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: widget.elementList != null
|
||||||
|
? () {
|
||||||
|
Helpers.hideKeyboard(context);
|
||||||
|
ListSelectDialog dialog = ListSelectDialog(
|
||||||
|
list: widget.elementList,
|
||||||
|
attributeName: '${widget.keyName}',
|
||||||
|
attributeValueId: widget.elementList.length == 1
|
||||||
|
? widget.elementList[0]['${widget.keyId}']
|
||||||
|
: '${widget.keyId}',
|
||||||
|
okText: TranslationBase.of(context).ok,
|
||||||
|
okFunction: (selectedValue) =>
|
||||||
|
widget.okFunction(selectedValue),
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return dialog;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: AppTextFieldCustom(
|
||||||
|
hintText: widget.hintText,
|
||||||
|
dropDownText: widget.elementList.length == 1
|
||||||
|
? widget.elementList[0]['${widget.keyName}']
|
||||||
|
: widget.element != null
|
||||||
|
? widget.element['${widget.keyName}']
|
||||||
|
: null,
|
||||||
|
isTextFieldHasSuffix: true,
|
||||||
|
validationError:
|
||||||
|
widget.elementList.length != 1 ? widget.elementError : null,
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue