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.
51 lines
2.0 KiB
Dart
51 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:tangheem/classes/const.dart';
|
|
|
|
class CommonTextFieldWidget extends StatelessWidget {
|
|
final String hint;
|
|
final TextEditingController controller;
|
|
final bool isPassword;
|
|
final String prefixIcon;
|
|
final bool showSuffix;
|
|
CommonTextFieldWidget({Key key, @required this.hint, @required this.controller, this.isPassword = false, this.prefixIcon, this.showSuffix = false}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
height: 50,
|
|
child: TextField(
|
|
textAlignVertical: TextAlignVertical.center,
|
|
controller: controller,
|
|
obscureText: isPassword,
|
|
textInputAction: TextInputAction.next,
|
|
style: TextStyle(color: Const.primaryBlack, fontSize: 14),
|
|
cursorColor: Const.primaryBlue,
|
|
decoration: InputDecoration(
|
|
contentPadding: EdgeInsets.fromLTRB(4, 4, 8, 4),
|
|
alignLabelWithHint: true,
|
|
fillColor: Colors.white,
|
|
filled: true,
|
|
hintStyle: TextStyle(color: Const.textGrey2, fontSize: 14),
|
|
hintText: hint,
|
|
suffixIcon: !showSuffix
|
|
? null
|
|
: Padding(
|
|
padding: EdgeInsets.only(left: 8, right: 0),
|
|
child: Icon(Icons.keyboard_arrow_down, size: 18, color: Const.secondaryOrange),
|
|
),
|
|
suffixIconConstraints: !showSuffix ? null : BoxConstraints(maxHeight: 30),
|
|
prefixIconConstraints: prefixIcon == null ? prefixIcon : BoxConstraints(maxHeight: 18),
|
|
prefixIcon: prefixIcon == null
|
|
? prefixIcon
|
|
: Padding(
|
|
padding: EdgeInsets.only(left: 4, right: 0),
|
|
child: SvgPicture.asset(prefixIcon, color: Const.textGrey2),
|
|
),
|
|
border: OutlineInputBorder(borderRadius: BorderRadius.circular(6), borderSide: BorderSide.none),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|