BitCaptcha class
Inline slide puzzle. Height = width / 2 + 12 + the slider bar.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BitCaptcha
Constructors
-
BitCaptcha({Key? key, required String captchaId, required String apiBase, required void onVerify(BitCaptchaResult result), void onError(Object error)?, VoidCallback? onReady, double width = 320, bool fluid = true, double minWidth = 280, double maxWidth = 400, String lang = 'auto', Map<
String, String> ? i18n, BitCaptchaTheme theme = const BitCaptchaTheme(), int maxErrors = 5, BitCaptchaClient? client, bool lazy = true}) -
const
Properties
- apiBase → String
-
API origin, e.g.
https://shudun.bitbeam.cn. Must be https except for localhost.final - captchaId → String
-
Site id from the console. Safe to ship inside the app.
final
- client → BitCaptchaClient?
-
Custom API client, e.g. to inject an
http.Client; built from captchaId / apiBase when null.final - fluid → bool
-
Fill the parent width, clamped to minWidth / maxWidth; false uses the fixed width.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
i18n
→ Map<
String, String> ? -
Overrides built-in strings by key, see BitCaptchaStrings.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- lang → String
-
UI language: zh-CN / zh-TW / en / ja / ko, or 'auto' to follow the system locale.
final
- lazy → bool
-
Fetch the challenge only once the widget scrolls near the viewport; false fetches at once.
final
- maxErrors → int
-
Consecutive failures allowed before the panel collapses and asks for a refresh.
final
- maxWidth → double
-
Upper bound of the width when fluid is true.
final
- minWidth → double
-
Lower bound of the width when fluid is true.
final
- onError → void Function(Object error)?
-
Called with a BitCaptchaException when loading or checking fails; rate limits retry by themselves.
final
- onReady → VoidCallback?
-
Called once a challenge has loaded and the widget is interactive.
final
- onVerify → void Function(BitCaptchaResult result)
-
Called when the user passes; send BitCaptchaResult.validate to your backend for verification.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → BitCaptchaTheme
-
Colors; use
const BitCaptchaTheme.dark()on dark surfaces.final - width → double
-
Fixed width in logical pixels, used when fluid is false.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BitCaptcha> -
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