Skip to content

Commit

Permalink
Fix closeManually, add tooltip and cursor when overlay is rendered, B…
Browse files Browse the repository at this point in the history
…ump version to 4.2.0
  • Loading branch information
prateekmedia committed Jul 28, 2021
1 parent 385f171 commit 1bc7c2c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 26 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [4.2.0] - 28 July 2021

- Fix closeManually
- Add click cursor on desktop and web when speed dial is opened
- Add tooltip to speed dial when overlay is on
- Fix overlay stale context brightness #184

## [4.1.0] - 10 July 2021

- Add isOpenOnStart property
Expand Down
30 changes: 20 additions & 10 deletions lib/src/background_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class BackgroundOverlay extends AnimatedWidget {
final LayerLink layerLink;
final ShapeBorder shape;
final VoidCallback? onTap;
final bool closeManually;
final String? tooltip;

BackgroundOverlay({
Key? key,
Expand All @@ -18,6 +20,8 @@ class BackgroundOverlay extends AnimatedWidget {
required Animation<double> animation,
required this.dialKey,
required this.layerLink,
required this.closeManually,
required this.tooltip,
this.color = Colors.white,
this.opacity = 0.7,
}) : super(key: key, listenable: animation);
Expand All @@ -31,7 +35,7 @@ class BackgroundOverlay extends AnimatedWidget {
fit: StackFit.expand,
children: [
GestureDetector(
onTap: onTap,
onTap: closeManually ? null : onTap,
child: Container(
decoration: BoxDecoration(
color: color, backgroundBlendMode: BlendMode.dstOut),
Expand All @@ -42,15 +46,21 @@ class BackgroundOverlay extends AnimatedWidget {
child: CompositedTransformFollower(
link: layerLink,
showWhenUnlinked: false,
child: IgnorePointer(
ignoring: true,
child: Container(
width: dialKey.globalPaintBounds!.size.width,
height: dialKey.globalPaintBounds!.size.height,
decoration: ShapeDecoration(
shape:
(shape == CircleBorder()) ? StadiumBorder() : shape,
color: Colors.white,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: Tooltip(
message: tooltip ?? '',
child: GestureDetector(
onTap: onTap,
child: Container(
width: dialKey.globalPaintBounds!.size.width,
height: dialKey.globalPaintBounds!.size.height,
decoration: ShapeDecoration(
shape:
shape == CircleBorder() ? StadiumBorder() : shape,
color: Colors.white,
),
),
),
),
),
Expand Down
30 changes: 16 additions & 14 deletions lib/src/speed_dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,22 @@ class _SpeedDialState extends State<SpeedDial>
));
if (widget.renderOverlay) {
backgroundOverlay = OverlayEntry(
builder: (ctx) {
bool _dark = Theme.of(ctx).brightness == Brightness.dark;
return BackgroundOverlay(
dialKey: dialKey,
layerLink: _layerLink,
shape: widget.shape,
onTap: _toggleChildren,
// (_open && !widget.closeManually) ? _toggleChildren : null,
animation: _controller,
color: widget.overlayColor ??
(_dark ? Colors.grey[900] : Colors.white)!,
opacity: widget.overlayOpacity,
);
}
builder: (ctx) {
bool _dark = Theme.of(ctx).brightness == Brightness.dark;
return BackgroundOverlay(
dialKey: dialKey,
layerLink: _layerLink,
closeManually: widget.closeManually,
tooltip: widget.tooltip,
shape: widget.shape,
onTap: _toggleChildren,
// (_open && !widget.closeManually) ? _toggleChildren : null,
animation: _controller,
color: widget.overlayColor ??
(_dark ? Colors.grey[900] : Colors.white)!,
opacity: widget.overlayOpacity,
);
},
);
}

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_speed_dial
description: Flutter plugin to implement a beautiful and dynamic Material Design Speed Dial with labels, animated icons, multi-directional children and much more.
version: 4.1.0
version: 4.2.0
homepage: https://github.com/darioielardi/flutter_speed_dial/

dependencies:
Expand All @@ -12,6 +12,6 @@ dev_dependencies:
sdk: flutter

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"

flutter:

0 comments on commit 1bc7c2c

Please sign in to comment.