add auto complete search
parent
e73ca8af71
commit
8220ef7700
@ -0,0 +1,44 @@
|
|||||||
|
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_field_error.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_fields_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../Text.dart';
|
||||||
|
|
||||||
|
class CustomAutoCompleteTextField extends StatelessWidget {
|
||||||
|
final bool isShowError;
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
const CustomAutoCompleteTextField({
|
||||||
|
Key key,
|
||||||
|
this.isShowError,
|
||||||
|
this.child,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
decoration: TextFieldsUtils.containerBorderDecoration(
|
||||||
|
Color(0Xffffffff),
|
||||||
|
isShowError ? Colors.red.shade700 : Color(0xFFEFEFEF),
|
||||||
|
),
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(top: 0.2, bottom: 2.0, left: 8.0, right: 0.0),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
if (isShowError)
|
||||||
|
TextFieldsError(
|
||||||
|
error: TranslationBase.of(context).emptyMessage,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class TextFieldsUtils{
|
||||||
|
static BoxDecoration containerBorderDecoration(
|
||||||
|
Color containerColor, Color borderColor,
|
||||||
|
{double borderWidth = -1}) {
|
||||||
|
return BoxDecoration(
|
||||||
|
color: containerColor,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
border: Border.fromBorderSide(BorderSide(
|
||||||
|
color: borderColor,
|
||||||
|
width: borderWidth == -1 ? 2.0 : borderWidth,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static InputDecoration textFieldSelectorDecoration(
|
||||||
|
String hintText, String selectedText, bool isDropDown,
|
||||||
|
{IconData suffixIcon, Color dropDownColor}) {
|
||||||
|
return InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
disabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
border: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0Xffffffff)),
|
||||||
|
),
|
||||||
|
/*focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
disabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),*/
|
||||||
|
hintText: selectedText != null ? selectedText : hintText,
|
||||||
|
suffixIcon: Icon(suffixIcon??null, color: Colors.grey.shade600,),
|
||||||
|
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue