Files
SkyJourney 61017f1c39 chore: 初始化脚手架 — sunny_mochi 企业级 Flutter 模板
Core 基础设施:Flavor 三包体系、Drift+SQLCipher 加密数据库
7 拦截器 Dio 网络栈、CrashReporter 崩溃日志、Sealed Failure 错误体系
5 色板主题系统、Auth 认证骨架(Clean Architecture)、Dev Panel、Mock Adapter

通过验证:flutter analyze(0 errors)、flutter test(全绿)、staging APK 74.8MB
2026-05-14 12:51:05 +08:00

61 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
/// 带标签、错误提示、前/后缀的通用输入框。
class AppTextField extends StatelessWidget {
const AppTextField({
super.key,
this.controller,
this.label,
this.hint,
this.errorText,
this.prefixIcon,
this.suffix,
this.obscureText = false,
this.keyboardType,
this.onChanged,
this.onSubmitted,
this.maxLength,
this.enabled = true,
this.readOnly = false,
this.focusNode,
});
final TextEditingController? controller;
final String? label;
final String? hint;
final String? errorText;
final Widget? prefixIcon;
final Widget? suffix;
final bool obscureText;
final TextInputType? keyboardType;
final ValueChanged<String>? onChanged;
final ValueChanged<String>? onSubmitted;
final int? maxLength;
final bool enabled;
final bool readOnly;
final FocusNode? focusNode;
@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
focusNode: focusNode,
obscureText: obscureText,
keyboardType: keyboardType,
onChanged: onChanged,
onSubmitted: onSubmitted,
maxLength: maxLength,
enabled: enabled,
readOnly: readOnly,
decoration: InputDecoration(
labelText: label,
hintText: hint,
errorText: errorText,
prefixIcon: prefixIcon,
suffix: suffix,
counterText: '',
),
);
}
}