DraggableFloatWidget class
This is a draggable and floating Flutter widget.
- How to use:
// the first way
OverlayEntry _overlayEntry = OverlayEntry(
builder: (context) {
return DraggableFloatWidget(
width: 60,
height: 60,
config: OptimizeDragPositionConfig(
initPositionY: 100,
),
onTap: () => print("Draggable float widget onTap!"),
);
},
);
Overlay.of(context).insert(_overlayEntry);
// the second way (Not recommended)
Stack(
children: [
DraggableFloatWidget(
width: 60,
height: 60,
config: OptimizeDragPositionConfig(
isFullScreen: false,
initPositionY: 100,
),
onTap: () => print("Draggable float widget onTap!"),
),
],
)
- How to send events externally:
StreamController<OperateEvent> eventStreamController = StreamController.broadcast();
NotificationListener(
onNotification: (notification) {
if (notification is ScrollStartNotification) {
eventStreamController.add(OperateEvent.OPERATE_HIDE);
} else if (notification is ScrollEndNotification) {
eventStreamController.add(OperateEvent.OPERATE_SHOW);
}
return true;
},
child: ScrollView(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DraggableFloatWidget
Constructors
-
DraggableFloatWidget({Key? key, double width = defaultWidgetWidth, double height = defaultWidgetHeight, StreamController<
OperateEvent> ? eventStreamController, DraggableFloatWidgetBaseConfig config = const DraggableFloatWidgetBaseConfig(), required Widget? child, GestureTapCallback? onTap}) -
const
Properties
- child → Widget?
-
The child contained by the DraggableFloatWidget.
final
- config → DraggableFloatWidgetBaseConfig
-
The base config of DraggableFloatWidget.
final
-
eventStreamController
→ StreamController<
OperateEvent> ? -
The StreamController of
OperateEvent
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
The height of DraggableFloatWidget.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onTap → GestureTapCallback?
-
The click callback of DraggableFloatWidget.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double
-
The width of DraggableFloatWidget.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
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