91 lines
2.7 KiB
Dart
91 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
class GroupTextFiled extends StatelessWidget {
|
|
final TextEditingController? controller;
|
|
final String? placeholder;
|
|
final double? height;
|
|
final int? maxLines;
|
|
final int? maxLength;
|
|
final Alignment? alignment;
|
|
final EdgeInsets? padding;
|
|
final double? radius;
|
|
final Color? bgColor;
|
|
final bool autoFocus;
|
|
final ValueChanged<String>? onSubmitted;
|
|
final TextInputAction? textInputAction;
|
|
final TextInputType? keyboardType;
|
|
final FocusNode? focusNode;
|
|
final TextStyle? textStyle;
|
|
final TextStyle? placeholderTextStyle;
|
|
final List<TextInputFormatter>? inputFormatters;
|
|
final bool? enabled;
|
|
final Decoration? decoration;
|
|
final TextAlign textAlign;
|
|
final Function(String)? onChangeCallback;
|
|
|
|
const GroupTextFiled({
|
|
super.key,
|
|
this.controller,
|
|
this.placeholder,
|
|
this.height,
|
|
this.maxLines,
|
|
this.maxLength,
|
|
this.alignment,
|
|
this.padding,
|
|
this.radius,
|
|
this.bgColor,
|
|
this.autoFocus = false,
|
|
this.onSubmitted,
|
|
this.textInputAction,
|
|
this.keyboardType,
|
|
this.focusNode,
|
|
this.textStyle,
|
|
this.placeholderTextStyle,
|
|
this.inputFormatters,
|
|
this.enabled,
|
|
this.decoration,
|
|
this.onChangeCallback,
|
|
this.textAlign = TextAlign.start,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(enableFeedback: false,
|
|
onTap: focusNode != null ? () => focusNode!.requestFocus() : null,
|
|
child: Container(
|
|
height: height ?? 40,
|
|
padding: padding ?? const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
alignment: alignment ?? Alignment.centerLeft,
|
|
decoration: decoration,
|
|
child: TextField(
|
|
cursorColor: Colors.blue.withValues(alpha: 0.5),
|
|
autofocus: autoFocus,
|
|
keyboardType: keyboardType,
|
|
textInputAction: textInputAction,
|
|
style: textStyle ?? const TextStyle(color: Colors.white, fontSize: 14),
|
|
controller: controller,
|
|
inputFormatters: inputFormatters,
|
|
maxLines: maxLines,
|
|
maxLength: maxLength,
|
|
onSubmitted: onSubmitted,
|
|
focusNode: focusNode,
|
|
enabled: enabled,
|
|
onChanged: onChangeCallback,
|
|
textAlign: textAlign,
|
|
decoration: InputDecoration(
|
|
hintText: placeholder,
|
|
border: InputBorder.none,
|
|
labelText: "",
|
|
counterText: "",
|
|
isDense: true,
|
|
isCollapsed: true,
|
|
floatingLabelBehavior: FloatingLabelBehavior.always,
|
|
hintStyle: placeholderTextStyle ?? const TextStyle(color: Color(0xff999999), fontSize: 14),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|