Detector class

Detects user interactions in the child widget tree.

Scrollable widgets

To correctly monitor interactions with scrollable space a Detector has to be placed as a direct parent of that widget:

rs.Detector(
  areaID: id,
  child: ListView(
    children: /* children */,
  ),
)

Not supported / untested

  • Nested scroll views
  • Widgets changing their size
  • Directly using slivers

Widgets provided by Flutter, like ListView, SingleChildScrollView, GridView or CustomScrollView are recognised automatically. In case you are using a custom scrollable widget from an external package, and cannot put the Detector directly around one of the standard Flutter widgets, use the Detector.custom() constructor.

Popups & Dialogs

To monitor interactions with a popup place a Detector around the widget inside the builder (remember to also provide the route name):

showDialog(
  builder: (_) => round_spot.Detector(
    areaID: 'sample-dialog',
    child: SimpleDialog(title: Text('dialog')),
  ),
  routeSettings: RouteSettings(name: 'simple-dialog-route'),
  context: context,
);

Cumulative detectors

This option is designed to allow for capturing the overall usage of elements that appear in the same form on multiple pages. All cumulative detectors with the same areaID will be contributing to common heat maps. This is useful for common interface elements that are shared between pages, like a navigation bar or a menu. The cumulative detectors are "fall-through", meaning the interactions will be included here in addition to the default screen maps.

Inheritance

Constructors

Detector({required Widget child, required String areaID, bool cumulative = false})
Creates a widget detector observing the child widget tree
Detector.custom({required Widget child, required String areaID, bool cumulative = false, Axis scrollAxis = Axis.vertical, double initialScrollOffset = 0})
Creates a detector observing a custom scrollable child widget tree

Properties

areaID String
Consistently identifies the same visual region across widget tree rebuilds and multiple visits.
final
child Widget
The widget below this widget to be observed.
final
cumulative bool
Determines the scope of interactions that will be included in the output.
final
customInitialOffset double?
Holds the initial scroll offset of the custom scrollable child widget.
final
customScrollAxis Axis?
Specifies the scroll axis of the custom scrollable child widget.
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() → _DetectorState
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