OPopupTrigger class
It simplifies the process of creating a widget which triggers popup.
If you want to fully customize (for example size, alignment)
content of a popup, skip popupHeader
and popupActionRow
fields
and set your own widget to popupContent
field.
Typical usage is as follows:
OPopupTrigger(
barrierDismissible: false, // by default barrier is dismissible, you can change it though
barrierColor: Colors.black.withOpacity(0.1), // control over color and opacity of a barrier
barrierAnimationDuration: const Duration(milliseconds: 150), // control over barrier animation
triggerWidget: Text('Some text'), // or any [Widget]
popupHeader: OPopupContent.standardizedHeader('Header text here'), // or any [Widget]
popupContent: OPopupContent.standardizedText( // or any [Widget]
'Some content',
),
popupActionRow: Row( // or any [Widget]
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
OutlineButton(
textColor: Colors.white,
child: Text('Yes'),
onPressed: () => Navigator.of(context).pop(),
),
OutlineButton(
textColor: Colors.white,
child: Text('No'),
onPressed: () => Navigator.of(context).pop(),
),
],
),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- OPopupTrigger
Constructors
- OPopupTrigger({Key? key, required Widget triggerWidget, Widget? popupHeader, Widget? popupContent, Widget? popupActionRow, Color? barrierColor, bool barrierDismissible = true, Duration? barrierAnimationDuration})
-
Creates an instance of OPopupTrigger
const
Properties
- barrierAnimationDuration → Duration?
-
The duration the transition of popup going forwards and in reverse.
final
- barrierColor → Color?
-
Fill the barrier with this color.
final
- barrierDismissible → bool
-
Whether you can dismiss popup route by tapping the modal barrier.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- popupActionRow → Widget?
-
Popup action row.
final
- popupContent → Widget?
-
Popup content.
final
- popupHeader → Widget?
-
Popup header.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- triggerWidget → Widget
-
Widget which fires popup.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _OPopupTriggerState -
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