feat: add accessibility setting and conditionally disable animations

This commit is contained in:
Anton Stubenbord
2023-11-16 23:44:02 +01:00
parent a17f658df5
commit 12be81d93b
21 changed files with 304 additions and 77 deletions

View File

@@ -35,6 +35,9 @@ class GlobalSettings with HiveObjectMixin {
@HiveField(8, defaultValue: false)
bool skipDocumentPreprarationOnUpload;
@HiveField(9, defaultValue: false)
bool disableAnimations;
GlobalSettings({
required this.preferredLocaleSubtag,
this.preferredThemeMode = ThemeMode.system,
@@ -45,5 +48,6 @@ class GlobalSettings with HiveObjectMixin {
this.defaultShareType = FileDownloadType.alwaysAsk,
this.enforceSinglePagePdfUpload = false,
this.skipDocumentPreprarationOnUpload = false,
this.disableAnimations = false,
});
}

View File

@@ -0,0 +1,20 @@
import 'dart:async';
import 'package:flutter/widgets.dart';
class GoRouterRefreshStream extends ChangeNotifier {
GoRouterRefreshStream(Stream<dynamic> stream) {
notifyListeners();
_subscription = stream.asBroadcastStream().listen(
(dynamic _) => notifyListeners(),
);
}
late final StreamSubscription<dynamic> _subscription;
@override
void dispose() {
_subscription.cancel();
super.dispose();
}
}

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:paperless_mobile/accessibility/accessibility_utils.dart';
import 'package:paperless_mobile/core/extensions/flutter_extensions.dart';
import 'package:paperless_mobile/generated/l10n/app_localizations.dart';
@@ -24,7 +26,7 @@ class HintCard extends StatelessWidget {
crossFadeState:
show ? CrossFadeState.showFirst : CrossFadeState.showSecond,
secondChild: const SizedBox.shrink(),
duration: const Duration(milliseconds: 500),
duration: 500.milliseconds.accessible(),
firstChild: Card(
elevation: elevation,
child: Column(