PrivacyGate class

隐私协议门控:未同意前不构建 child

已同意过:先 await onAgreed(注册 GetX、初始化 HTTP 等),再展示 child, 避免主应用首帧内 Get.find 早于 onAgreed 执行。

首次同意:弹窗内点接受后 await onAgreed,再展示 child

Inheritance

Constructors

PrivacyGate({Key? key, required Widget child, PrivacyAgreementConfig config = const PrivacyAgreementConfig(), Future<void> onAgreed()?, ThemeData? theme})
const

Properties

child Widget
用户同意后展示的子应用
final
config PrivacyAgreementConfig
协议弹窗配置
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onAgreed Future<void> Function()?
用户同意后执行,用于 SDK 初始化、权限请求等(须在首帧构建 child 前完成)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
theme ThemeData?
弹窗阶段的主题(可选,默认使用 ColorScheme.fromSeed)
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PrivacyGate>
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