Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/src/animated_child.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class AnimatedChild extends AnimatedWidget {
final String? heroTag;
final bool useColumn;
final bool switchLabelPosition;
final EdgeInsets? margin;
final EdgeInsetsGeometry? margin;

final EdgeInsets childMargin;
final EdgeInsets childPadding;
final EdgeInsetsGeometry childMargin;
final EdgeInsetsGeometry childPadding;

const AnimatedChild({
Key? key,
Expand Down
45 changes: 30 additions & 15 deletions lib/src/speed_dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ class SpeedDial extends StatefulWidget {
final Duration animationDuration;

/// The margin of each child
final EdgeInsets childMargin;
final EdgeInsetsGeometry childMargin;

/// The padding of each child
final EdgeInsets childPadding;
final EdgeInsetsGeometry childPadding;

/// Add a space at between speed dial and children
final double? spacing;
Expand Down Expand Up @@ -542,7 +542,7 @@ class _ChildrensOverlay extends StatelessWidget {
),
index: index,
margin: widget.spaceBetweenChildren != null
? EdgeInsets.fromLTRB(
? EdgeInsetsDirectional.fromSTEB(
widget.direction.isRight ? widget.spaceBetweenChildren! : 0,
widget.direction.isDown ? widget.spaceBetweenChildren! : 0,
widget.direction.isLeft ? widget.spaceBetweenChildren! : 0,
Expand Down Expand Up @@ -583,6 +583,9 @@ class _ChildrensOverlay extends StatelessWidget {

@override
Widget build(BuildContext context) {
TextDirection textDirection = Directionality.of(context);
bool isRTL = textDirection == TextDirection.rtl;

return Stack(
fit: StackFit.loose,
children: [
Expand All @@ -593,30 +596,42 @@ class _ChildrensOverlay extends StatelessWidget {
? Alignment.topLeft
: Alignment.topRight
: widget.direction.isUp
? widget.switchLabelPosition
? widget.switchLabelPosition || isRTL
? Alignment.bottomLeft
: Alignment.bottomRight
: widget.direction.isLeft
? Alignment.centerRight
: widget.direction.isRight
: widget.direction.isRight || isRTL
? Alignment.centerLeft
: Alignment.center,
offset: widget.direction.isDown
? Offset(
(widget.switchLabelPosition ||
dialKey.globalPaintBounds == null
? 0
: dialKey.globalPaintBounds!.size.width) +
max(widget.childrenButtonSize.height - 56, 0) / 2,
Offset.fromDirection(
isRTL ? 0 : 3.14159,
(widget.switchLabelPosition ||
isRTL ||
dialKey.globalPaintBounds == null
? 0
: dialKey.globalPaintBounds!.size.width) +
max(widget.childrenButtonSize.height - 56, 0) / 2)
.dx,
dialKey.globalPaintBounds!.size.height)
: widget.direction.isUp
? Offset(
? Offset.fromDirection(
isRTL ? 3.14159 : 0,
(widget.switchLabelPosition ||
isRTL ||
dialKey.globalPaintBounds == null
? 0
: dialKey.globalPaintBounds!.size.width) +
max(widget.childrenButtonSize.width - 56, 0) / 2,
0)
max(widget.childrenButtonSize.width - 56, 0) / 2)
// ? Offset(
// (widget.switchLabelPosition ||
// dialKey.globalPaintBounds == null
// ? 0
// : dialKey.globalPaintBounds!.size.width) +
// max(widget.childrenButtonSize.width - 56, 0) / 2,
// 0)
: widget.direction.isLeft
? Offset(
-10.0,
Expand All @@ -627,7 +642,7 @@ class _ChildrensOverlay extends StatelessWidget {
dialKey.globalPaintBounds != null
? Offset(dialKey.globalPaintBounds!.size.width + 12,
dialKey.globalPaintBounds!.size.height / 2)
: const Offset(-10.0, 0.0),
: const Offset(-10.0, 0),
link: layerLink,
showWhenUnlinked: false,
child: Material(
Expand All @@ -639,7 +654,7 @@ class _ChildrensOverlay extends StatelessWidget {
: 0,
),
margin: widget.spacing != null
? EdgeInsets.fromLTRB(
? EdgeInsetsDirectional.fromSTEB(
widget.direction.isRight ? widget.spacing! : 0,
widget.direction.isDown ? widget.spacing! : 0,
widget.direction.isLeft ? widget.spacing! : 0,
Expand Down