respect disableAnimations flag
This commit is contained in:
@@ -76,8 +76,10 @@ class _AnimatedToolbar extends HookWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final disableAnimations = MediaQuery.disableAnimationsOf(context);
|
||||
|
||||
final controller = useAnimationController(
|
||||
duration: _kAnimationDuration,
|
||||
duration: disableAnimations ? Duration.zero : _kAnimationDuration,
|
||||
initialValue: visible ? 1.0 : 0.0,
|
||||
);
|
||||
|
||||
|
||||
+6
-7
@@ -618,10 +618,7 @@ class _PinTopSiteTile extends HookConsumerWidget {
|
||||
} else {
|
||||
await ref
|
||||
.read(topSiteRepositoryProvider.notifier)
|
||||
.addPinnedSite(
|
||||
title: tabState.titleOrAuthority,
|
||||
url: url,
|
||||
);
|
||||
.addPinnedSite(title: tabState.titleOrAuthority, url: url);
|
||||
if (context.mounted) {
|
||||
ui_helper.showInfoMessage(context, 'Pinned to Top Sites');
|
||||
}
|
||||
@@ -1932,19 +1929,21 @@ class _SyncTile extends HookConsumerWidget {
|
||||
);
|
||||
final isSyncing = syncStarted || syncInfo?.syncing == true;
|
||||
|
||||
final disableAnimations = MediaQuery.disableAnimationsOf(context);
|
||||
|
||||
final controller = useAnimationController(
|
||||
duration: const Duration(seconds: 2),
|
||||
duration: disableAnimations ? Duration.zero : const Duration(seconds: 2),
|
||||
);
|
||||
|
||||
useEffect(() {
|
||||
if (isSyncing) {
|
||||
if (isSyncing && !disableAnimations) {
|
||||
unawaited(controller.repeat());
|
||||
} else {
|
||||
controller.stop();
|
||||
controller.reset();
|
||||
}
|
||||
return null;
|
||||
}, [isSyncing]);
|
||||
}, [isSyncing, disableAnimations]);
|
||||
|
||||
return ListTile(
|
||||
leading: RotationTransition(
|
||||
|
||||
+5
@@ -74,6 +74,11 @@ class _DraggableScrollableHeaderState extends State<DraggableScrollableHeader>
|
||||
double targetSize, {
|
||||
Duration? customDuration,
|
||||
}) async {
|
||||
if (MediaQuery.disableAnimationsOf(context)) {
|
||||
widget.controller.jumpTo(targetSize);
|
||||
return;
|
||||
}
|
||||
|
||||
if (customDuration != null) {
|
||||
_animationController.duration = customDuration;
|
||||
} else {
|
||||
|
||||
@@ -53,19 +53,21 @@ class SyncSettingsScreen extends HookConsumerWidget {
|
||||
return 'Last synced: $formattedDate';
|
||||
}, [syncInfo, isSyncing]);
|
||||
|
||||
final disableAnimations = MediaQuery.disableAnimationsOf(context);
|
||||
|
||||
final syncController = useAnimationController(
|
||||
duration: const Duration(seconds: 2),
|
||||
duration: disableAnimations ? Duration.zero : const Duration(seconds: 2),
|
||||
);
|
||||
|
||||
useEffect(() {
|
||||
if (isSyncing) {
|
||||
if (isSyncing && !disableAnimations) {
|
||||
unawaited(syncController.repeat());
|
||||
} else {
|
||||
syncController.stop();
|
||||
syncController.reset();
|
||||
}
|
||||
return null;
|
||||
}, [isSyncing]);
|
||||
}, [isSyncing, disableAnimations]);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Firefox Sync')),
|
||||
|
||||
Reference in New Issue
Block a user