SecureInputField class

安全输入框组件(SecureInputField)

用于构建一个具备增强安全性的输入表单组件,适用于涉及敏感信息的 UI 场景(如:账号、密码、密保、交易 PIN 等)。

该组件在传统 TextFormField 基础上增加以下特性:

-SQL 注入特征检测(默认启用) -粘贴行为禁止(可选) -屏幕截图与录屏防护(自动启用/恢复) -禁止输入联想/纠错(提升保密性)

配合 flutter_defend 安全库使用,适用于需要输入加固的企业 App、金融系统、CTF 类平台等高安全场景。

Inheritance

Constructors

SecureInputField.new({Key? key, required TextEditingController controller, bool obscureText = false, String? validator(String?)?, bool preventScreenshot = false, bool preventPaste = false, InputDecoration? decoration, TextInputType keyboardType = TextInputType.text})
const

Properties

controller TextEditingController
文本控制器,用于控制/获取输入框内容。
final
decoration InputDecoration?
输入框装饰(Decoration),用于控制样式、标签、边框等。
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType TextInputType
键盘输入类型(如 text、number、email、phone 等)。
final
obscureText bool
是否启用密码模式(字符隐藏),默认关闭。
final
preventPaste bool
是否禁止用户粘贴内容,默认关闭。
final
preventScreenshot bool
是否禁止屏幕截图与录屏,默认关闭。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validator String? Function(String?)?
可选的输入验证器函数(FormField validator)。
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SecureInputField>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited