Skip to content

Commit

Permalink
🐛 fix floating buttons cutting off when revealed.
Browse files Browse the repository at this point in the history
  • Loading branch information
BirjuVachhani committed Jan 30, 2024
1 parent f1565f1 commit 1a776e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/src/debug_floating_theme_buttons.dart
Expand Up @@ -70,6 +70,8 @@ class _DebugFloatingThemeButtonState extends State<DebugFloatingThemeButton> {
bool animate = false;
bool hidden = true;

late final GlobalKey _buttonBarKey = GlobalKey();

@override
void didChangeDependencies() {
super.didChangeDependencies();
Expand Down Expand Up @@ -105,6 +107,7 @@ class _DebugFloatingThemeButtonState extends State<DebugFloatingThemeButton> {
animate = false;
},
child: Material(
key: _buttonBarKey,
type: MaterialType.transparency,
child: Builder(
builder: (context) {
Expand Down Expand Up @@ -198,8 +201,11 @@ class _DebugFloatingThemeButtonState extends State<DebugFloatingThemeButton> {

void _handleTap() {
animate = true;
final buttonBarWidth =
_buttonBarKey.currentContext?.findRenderObject()?.paintBounds.width ??
210;
final width = MediaQuery.of(context).size.width;
final left = !hidden ? width - kHandleWidth : width - 180;
final left = !hidden ? width - kHandleWidth : width - (buttonBarWidth + 8);
hidden = !hidden;
setState(() => position = Offset(left, position.dy));
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: adaptive_theme
description: Allows to change between light and dark theme dynamically and add system adaptive theme support.
version: 3.6.0
version: 3.5.0
homepage: https://github.com/birjuvachhani/adaptive_theme

screenshots:
Expand Down

0 comments on commit 1a776e4

Please sign in to comment.