Files
hjsq_android/lib/tools_base/widget/group_text_filed.dart
T
谢宇宁andClaude Opus 5.5 2d26ea8f90 Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 10:38:11 +07:00

88 lines
2.5 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 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 ValueChanged<String>? onChanged;
const GroupTextFiled({
super.key,
this.controller,
this.placeholder,
this.height,
this.maxLines,
this.maxLength,
this.alignment,
this.padding,
this.autoFocus = false,
this.onSubmitted,
this.textInputAction,
this.keyboardType,
this.focusNode,
this.textStyle,
this.placeholderTextStyle,
this.inputFormatters,
this.enabled,
this.decoration,
this.onChanged,
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 ?? EdgeInsets.zero,
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: onChanged,
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),
),
),
),
);
}
}