fix browser fab animation issues
This commit is contained in:
@@ -342,7 +342,7 @@ class BrowserScreen extends HookConsumerWidget {
|
|||||||
displayedSheet: null,
|
displayedSheet: null,
|
||||||
).preferredSize,
|
).preferredSize,
|
||||||
),
|
),
|
||||||
floatingActionButton: BrowserFab(),
|
floatingActionButton: const BrowserFab(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
+30
-12
@@ -26,6 +26,8 @@ import 'package:weblibre/features/geckoview/features/browser/presentation/contro
|
|||||||
import 'package:weblibre/features/geckoview/features/readerview/domain/providers/readerable.dart';
|
import 'package:weblibre/features/geckoview/features/readerview/domain/providers/readerable.dart';
|
||||||
|
|
||||||
class BrowserFab extends HookConsumerWidget {
|
class BrowserFab extends HookConsumerWidget {
|
||||||
|
const BrowserFab({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final tabBarDismissed = ref.watch(tabBarDismissableControllerProvider);
|
final tabBarDismissed = ref.watch(tabBarDismissableControllerProvider);
|
||||||
@@ -42,22 +44,38 @@ class BrowserFab extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Visibility(
|
final Widget child;
|
||||||
visible: readerabilityState.active && appearanceButtonVisible,
|
if (readerabilityState.active && appearanceButtonVisible) {
|
||||||
replacement: tabBarDismissed
|
child = FloatingActionButton(
|
||||||
? FloatingActionButton(
|
key: const ValueKey('appearance_fab'),
|
||||||
child: const Icon(MdiIcons.dockBottom),
|
heroTag: 'appearance_fab',
|
||||||
onPressed: () {
|
|
||||||
ref.read(tabBarDismissableControllerProvider.notifier).show();
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
|
||||||
child: FloatingActionButton(
|
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await ref.read(readerableServiceProvider).onAppearanceButtonTap();
|
await ref.read(readerableServiceProvider).onAppearanceButtonTap();
|
||||||
},
|
},
|
||||||
child: const Icon(MdiIcons.formatFont),
|
child: const Icon(MdiIcons.formatFont),
|
||||||
),
|
);
|
||||||
|
} else if (tabBarDismissed) {
|
||||||
|
child = FloatingActionButton(
|
||||||
|
key: const ValueKey('dock_fab'),
|
||||||
|
heroTag: 'dock_fab',
|
||||||
|
onPressed: () {
|
||||||
|
ref.read(tabBarDismissableControllerProvider.notifier).show();
|
||||||
|
},
|
||||||
|
child: const Icon(MdiIcons.dockBottom),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
child = const SizedBox.shrink(key: ValueKey('no_fab'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
transitionBuilder: (child, animation) {
|
||||||
|
return ScaleTransition(
|
||||||
|
scale: animation,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user