|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'app_texts_widget.dart';
|
|
|
|
|
@ -19,6 +20,7 @@ class AppTextFieldCustom extends StatefulWidget {
|
|
|
|
|
final int maxLines;
|
|
|
|
|
final List<TextInputFormatter> inputFormatters;
|
|
|
|
|
final Function(String) onChanged;
|
|
|
|
|
final String validationError;
|
|
|
|
|
|
|
|
|
|
AppTextFieldCustom({
|
|
|
|
|
this.height = 0,
|
|
|
|
|
@ -36,6 +38,7 @@ class AppTextFieldCustom extends StatefulWidget {
|
|
|
|
|
this.maxLines = 1,
|
|
|
|
|
this.inputFormatters,
|
|
|
|
|
this.onChanged,
|
|
|
|
|
this.validationError,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -45,12 +48,19 @@ class AppTextFieldCustom extends StatefulWidget {
|
|
|
|
|
class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: widget.height != 0 ? widget.height + 8 : null,
|
|
|
|
|
decoration: widget.hasBorder
|
|
|
|
|
? containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF))
|
|
|
|
|
? containerBorderDecoration(
|
|
|
|
|
Color(0Xffffffff),
|
|
|
|
|
widget.validationError == null
|
|
|
|
|
? Color(0xFFEFEFEF)
|
|
|
|
|
: Colors.red.shade700)
|
|
|
|
|
: null,
|
|
|
|
|
padding: EdgeInsets.only(top: 4.0, bottom: 4.0, left: 8.0, right: 8.0),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(top: 4.0, bottom: 4.0, left: 8.0, right: 8.0),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: widget.onClick ?? null,
|
|
|
|
|
child: Row(
|
|
|
|
|
@ -58,7 +68,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: widget.dropDownText == null ? EdgeInsets.symmetric(vertical: 0): EdgeInsets.symmetric(vertical: 8),
|
|
|
|
|
padding: widget.dropDownText == null
|
|
|
|
|
? EdgeInsets.symmetric(vertical: 0)
|
|
|
|
|
: EdgeInsets.symmetric(vertical: 8),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
@ -91,11 +103,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
|
|
|
|
|
? widget.inputFormatters
|
|
|
|
|
: [],
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
if (widget.onChanged != null){
|
|
|
|
|
if (widget.onChanged != null) {
|
|
|
|
|
widget.onChanged(value);
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
@ -122,6 +132,31 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (widget.validationError != null)
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 8, right: 8, left: 8, bottom: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
DoctorApp.warning,
|
|
|
|
|
size: 20,
|
|
|
|
|
color: Colors.red.shade700,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 12,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
widget.validationError,
|
|
|
|
|
fontFamily: 'Poppins',
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.7,
|
|
|
|
|
color: Colors.red.shade700,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|