EasterEggTrigger class
The EasterEggTrigger widget allow you to easily call a function when a combination of gestures have been detected on a given widget
Please find a working and concrete example here: https://gitlab.com/mrdiez/flutter_scaffold in the ./lib/components/images/main.logo.dart file
Sample call :
EasterEggTrigger(
action: () => print("Easter Egg !!!"),
child: Image.network('https://picsum.photos/250?image=9')
);
This example will print "Easter Egg !!!" in your console when you do these gestures on the image:
Swipe Up, Swipe Up, Swipe Down, Swipe Down, Swipe Left, Swipe Right, Swipe Left, Swipe Right, Tap, Long Press
Yes this is the famous Konami code: ↑ ↑ ↓ ↓ ← → ← → B A note that I replaced B button by Tap and A button by Long Press
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- EasterEggTrigger
Constructors
- EasterEggTrigger({Function? action, Widget? child, dynamic codes})
- The constructor
Properties
- action → Function?
-
The action that will be executed
final
- child → Widget?
-
The child on which the gestures will be listened to
final
-
codes
→ List<
EasterEggTriggers> -
The list of gestures to be carried out to call action()
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _EasterEggTriggerState -
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}) → 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
Constants
-
KonamiCode
→ const List<
EasterEggTriggers> - The default list of gestures (the famous Konami code)