#1102 accessibility: enable/disable more animations
This commit is contained in:
parent
20ca48a5ed
commit
fcde32d555
7 changed files with 20 additions and 16 deletions
|
@ -29,8 +29,6 @@ class ADurations {
|
|||
// collection animations
|
||||
static const filterBarRemovalAnimation = Duration(milliseconds: 400);
|
||||
static const collectionOpOverlayAnimation = Duration(milliseconds: 300);
|
||||
static const sectionHeaderAnimation = Duration(milliseconds: 200);
|
||||
static const thumbnailOverlayAnimation = Duration(milliseconds: 200);
|
||||
|
||||
// search animations
|
||||
static const filterRowExpandAnimation = Duration(milliseconds: 300);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_app_bar.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_filter_chip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class FilterBar extends StatefulWidget {
|
||||
static const EdgeInsets chipPadding = EdgeInsets.symmetric(horizontal: 4);
|
||||
|
@ -45,7 +47,7 @@ class _FilterBarState extends State<FilterBar> {
|
|||
existing.removeAt(index);
|
||||
// only animate item removal when triggered by a user interaction with the chip,
|
||||
// not from automatic chip replacement following chip selection
|
||||
final animate = _userTappedFilter == filter;
|
||||
final animate = context.read<Settings>().animate && _userTappedFilter == filter;
|
||||
listState!.removeItem(
|
||||
index,
|
||||
animate
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:aves/model/entry/entry.dart';
|
||||
import 'package:aves/model/entry/extensions/favourites.dart';
|
||||
import 'package:aves/model/favourites.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/theme/colors.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/widgets/common/basic/popup/menu_row.dart';
|
||||
|
@ -73,6 +74,7 @@ class _FavouriteTogglerState extends State<FavouriteToggler> {
|
|||
icon: const Icon(isNotFavouriteIcon),
|
||||
);
|
||||
}
|
||||
final animate = context.select<Settings, bool>((v) => v.animate);
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
|
@ -82,14 +84,15 @@ class _FavouriteTogglerState extends State<FavouriteToggler> {
|
|||
focusNode: widget.focusNode,
|
||||
tooltip: isFavourite ? context.l10n.entryActionRemoveFavourite : context.l10n.entryActionAddFavourite,
|
||||
),
|
||||
Sweeper(
|
||||
key: ValueKey(entries.length == 1 ? entries.first : entries.length),
|
||||
builder: (context) => Icon(
|
||||
favouriteSweeperIcon,
|
||||
color: context.select<AvesColorsData, Color>((v) => v.favourite),
|
||||
if (animate)
|
||||
Sweeper(
|
||||
key: ValueKey(entries.length == 1 ? entries.first : entries.length),
|
||||
builder: (context) => Icon(
|
||||
favouriteSweeperIcon,
|
||||
color: context.select<AvesColorsData, Color>((v) => v.favourite),
|
||||
),
|
||||
toggledNotifier: _isFavouriteNotifier,
|
||||
),
|
||||
toggledNotifier: _isFavouriteNotifier,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
|
|
@ -189,6 +189,7 @@ class _SectionSelectableLeading<T> extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
if (!selectable) return _buildBrowsing(context);
|
||||
|
||||
final duration = context.select<DurationsData, Duration>((v) => v.formTransition);
|
||||
final isSelecting = context.select<Selection<T>, bool>((selection) => selection.isSelecting);
|
||||
final Widget child = isSelecting
|
||||
? _SectionSelectingLeading<T>(
|
||||
|
@ -201,7 +202,7 @@ class _SectionSelectableLeading<T> extends StatelessWidget {
|
|||
descendantsAreFocusable: false,
|
||||
descendantsAreTraversable: false,
|
||||
child: AnimatedSwitcher(
|
||||
duration: ADurations.sectionHeaderAnimation,
|
||||
duration: duration,
|
||||
switchInCurve: Curves.easeInOut,
|
||||
switchOutCurve: Curves.easeInOut,
|
||||
transitionBuilder: (child, animation) {
|
||||
|
@ -240,11 +241,12 @@ class _SectionSelectingLeading<T> extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duration = context.select<DurationsData, Duration>((v) => v.formTransition);
|
||||
final sectionEntries = context.watch<SectionedListLayout<T>>().sections[sectionKey] ?? [];
|
||||
final selection = context.watch<Selection<T>>();
|
||||
final isSelected = selection.isSelected(sectionEntries);
|
||||
return AnimatedSwitcher(
|
||||
duration: ADurations.sectionHeaderAnimation,
|
||||
duration: duration,
|
||||
switchInCurve: Curves.easeOutBack,
|
||||
switchOutCurve: Curves.easeOutBack,
|
||||
transitionBuilder: (child, animation) => ScaleTransition(
|
||||
|
|
|
@ -10,8 +10,6 @@ class GridItemSelectionOverlay<T> extends StatelessWidget {
|
|||
final BorderRadius? borderRadius;
|
||||
final EdgeInsets? padding;
|
||||
|
||||
static const duration = ADurations.thumbnailOverlayAnimation;
|
||||
|
||||
const GridItemSelectionOverlay({
|
||||
super.key,
|
||||
required this.item,
|
||||
|
@ -21,6 +19,7 @@ class GridItemSelectionOverlay<T> extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duration = context.select<DurationsData, Duration>((v) => v.formTransition);
|
||||
final isSelecting = context.select<Selection<T>, bool>((selection) => selection.isSelecting);
|
||||
return AnimatedSwitcher(
|
||||
duration: duration,
|
||||
|
|
|
@ -89,10 +89,10 @@ class ThumbnailZoomOverlay extends StatelessWidget {
|
|||
});
|
||||
|
||||
static const alignment = AlignmentDirectional.bottomEnd;
|
||||
static const duration = ADurations.thumbnailOverlayAnimation;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duration = context.select<DurationsData, Duration>((v) => v.formTransition);
|
||||
final isSelecting = context.select<Selection<AvesEntry>, bool>((selection) => selection.isSelecting);
|
||||
final interactiveDimension = context.select<GridThemeData, double>((t) => t.interactiveDimension);
|
||||
return AnimatedSwitcher(
|
||||
|
|
|
@ -15,7 +15,6 @@ class SelectionButton extends StatelessWidget {
|
|||
final Animation<double> scale;
|
||||
|
||||
static const double padding = 8;
|
||||
static const duration = ADurations.thumbnailOverlayAnimation;
|
||||
|
||||
const SelectionButton({
|
||||
super.key,
|
||||
|
@ -27,6 +26,7 @@ class SelectionButton extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final selection = context.read<Selection<AvesEntry>>();
|
||||
final duration = context.select<DurationsData, Duration>((v) => v.formTransition);
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
|
|
Loading…
Reference in a new issue