47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class BoxTextField extends StatelessWidget {
|
||
|
final String hintText;
|
||
|
final int maxLength;
|
||
|
final Function(String) onChanged;
|
||
|
final Function onPress;
|
||
|
final Color colorIcon;
|
||
|
final TextEditingController textEditingController;
|
||
|
|
||
|
const BoxTextField({
|
||
|
Key key,
|
||
|
this.hintText,
|
||
|
this.maxLength,
|
||
|
this.onChanged,
|
||
|
this.onPress, this.colorIcon, this.textEditingController,
|
||
|
}) : super(key: key);
|
||
|
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
||
|
decoration: BoxDecoration(
|
||
|
borderRadius: BorderRadius.circular(10),
|
||
|
color: Colors.grey[300],
|
||
|
),
|
||
|
alignment: Alignment.center,
|
||
|
child: TextField(
|
||
|
controller: textEditingController,
|
||
|
onChanged: onChanged,
|
||
|
maxLength: maxLength,
|
||
|
decoration: InputDecoration(
|
||
|
counterText: "",
|
||
|
hintText: hintText,
|
||
|
border: InputBorder.none,
|
||
|
suffixIcon: IconButton(
|
||
|
highlightColor: Colors.transparent,
|
||
|
splashColor: Colors.transparent,
|
||
|
icon: Icon(Icons.delete),
|
||
|
color: colorIcon,
|
||
|
iconSize: 20,
|
||
|
onPressed: onPress,
|
||
|
)),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|