Skip to content

Commit

Permalink
Fixed Issue #210 (#221)
Browse files Browse the repository at this point in the history
Changed the properties "childrenButtonSize" and "buttonSize" from double to Size
  • Loading branch information
luca-colazzo authored Dec 7, 2021
1 parent 6ffc7a9 commit a13749b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class _MyHomePageState extends State<MyHomePage> {
var useRAnimation = true;
var isDialOpen = ValueNotifier<bool>(false);
var speedDialDirection = SpeedDialDirection.up;
var buttonSize = 56.0;
var childrenButtonSize = 56.0;
var buttonSize = const Size(56.0, 56.0);
var childrenButtonSize = const Size(56.0, 56.0);
var selectedfABLocation = FloatingActionButtonLocation.endDocked;
var items = [
FloatingActionButtonLocation.startFloat,
Expand Down Expand Up @@ -301,24 +301,24 @@ class _MyHomePageState extends State<MyHomePage> {
}),
const Text("Button Size"),
Slider(
value: buttonSize,
value: buttonSize.width,
min: 50,
max: 500,
label: "Button Size",
onChanged: (val) {
setState(() {
buttonSize = val;
buttonSize = Size(val, val);
});
},
),
const Text("Children Button Size"),
Slider(
value: childrenButtonSize,
value: childrenButtonSize.height,
min: 50,
max: 500,
onChanged: (val) {
setState(() {
childrenButtonSize = val;
childrenButtonSize = Size(val, val);
});
},
)
Expand Down
8 changes: 4 additions & 4 deletions lib/src/animated_child.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class AnimatedChild extends AnimatedWidget {
final Color? backgroundColor;
final Color? foregroundColor;
final double? elevation;
final double buttonSize;
final Size buttonSize;
final Widget? child;
final List<BoxShadow>? labelShadow;
final Key? btnKey;
Expand Down Expand Up @@ -36,7 +36,7 @@ class AnimatedChild extends AnimatedWidget {
this.backgroundColor,
this.foregroundColor,
this.elevation = 6.0,
this.buttonSize = 56.0,
this.buttonSize = const Size(56.0, 56.0),
this.child,
this.label,
this.labelStyle,
Expand Down Expand Up @@ -137,8 +137,8 @@ class AnimatedChild extends AnimatedWidget {
if (child != null)
Container(
padding: childPadding,
height: buttonSize,
width: buttonSize,
height: buttonSize.height,
width: buttonSize.width,
child: (onLongPress == null)
? button
: FittedBox(
Expand Down
6 changes: 3 additions & 3 deletions lib/src/animated_floating_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AnimatedFloatingButton extends StatefulWidget {
final String? tooltip;
final String? heroTag;
final double elevation;
final double size;
final Size size;
final ShapeBorder shape;
final Curve curve;
final Widget? dialRoot;
Expand All @@ -30,7 +30,7 @@ class AnimatedFloatingButton extends StatefulWidget {
this.tooltip,
this.heroTag,
this.elevation = 6.0,
this.size = 56.0,
this.size = const Size(56.0, 56.0),
this.shape = const CircleBorder(),
this.curve = Curves.fastOutSlowIn,
this.onLongPress,
Expand All @@ -48,7 +48,7 @@ class _AnimatedFloatingButtonState extends State<AnimatedFloatingButton>
? AnimatedContainer(
curve: widget.curve,
duration: const Duration(milliseconds: 150),
height: widget.visible ? widget.size : 0,
height: widget.visible ? widget.size.height : 0,
child: FittedBox(
child: GestureDetector(
onLongPress: widget.onLongPress,
Expand Down
14 changes: 7 additions & 7 deletions lib/src/speed_dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class SpeedDial extends StatefulWidget {
final Color? activeBackgroundColor;
final Color? activeForegroundColor;
final double elevation;
final double buttonSize;
final double childrenButtonSize;
final Size buttonSize;
final Size childrenButtonSize;
final ShapeBorder shape;
final Gradient? gradient;
final BoxShape gradientBoxShape;
Expand Down Expand Up @@ -140,8 +140,8 @@ class SpeedDial extends StatefulWidget {
this.gradient,
this.gradientBoxShape = BoxShape.rectangle,
this.elevation = 6.0,
this.buttonSize = 56.0,
this.childrenButtonSize = 56.0,
this.buttonSize = const Size(56.0, 56.0),
this.childrenButtonSize = const Size(56.0, 56.0),
this.dialRoot,
this.overlayOpacity = 0.8,
this.overlayColor,
Expand Down Expand Up @@ -345,7 +345,7 @@ class _SpeedDialState extends State<SpeedDial>
dialKey.globalPaintBounds == null
? 0
: dialKey.globalPaintBounds!.size.width) +
max(widget.childrenButtonSize - 56, 0) / 2,
max(widget.childrenButtonSize.height - 56, 0) / 2,
dialKey.globalPaintBounds!.size.height)
: widget.direction.isUp
? Offset(
Expand All @@ -354,7 +354,7 @@ class _SpeedDialState extends State<SpeedDial>
? 0
: dialKey
.globalPaintBounds!.size.width) +
max(widget.childrenButtonSize - 56, 0) / 2,
max(widget.childrenButtonSize.width - 56, 0) / 2,
0)
: widget.direction.isLeft
? Offset(-10.0,
Expand All @@ -375,7 +375,7 @@ class _SpeedDialState extends State<SpeedDial>
padding: EdgeInsets.symmetric(
horizontal:
widget.direction.isUp || widget.direction.isDown
? max(widget.buttonSize - 56, 0) / 2
? max(widget.buttonSize.width - 56, 0) / 2
: 0,
),
margin: widget.spacing != null
Expand Down

0 comments on commit a13749b

Please sign in to comment.