mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-01 13:20:16 +02:00
Make page transition animation optional (#683)
This commit is contained in:
@@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
|
||||
// ignore: implementation_imports
|
||||
import 'package:easy_localization/src/localization.dart';
|
||||
|
||||
const String currentVersion = '0.13.17';
|
||||
const String currentVersion = '0.13.18';
|
||||
const String currentReleaseTag =
|
||||
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||
|
||||
|
@@ -7,6 +7,7 @@ import 'package:obtainium/pages/apps.dart';
|
||||
import 'package:obtainium/pages/import_export.dart';
|
||||
import 'package:obtainium/pages/settings.dart';
|
||||
import 'package:obtainium/providers/apps_provider.dart';
|
||||
import 'package:obtainium/providers/settings_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
@@ -42,6 +43,7 @@ class _HomePageState extends State<HomePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppsProvider appsProvider = context.watch<AppsProvider>();
|
||||
SettingsProvider settingsProvider = context.watch<SettingsProvider>();
|
||||
|
||||
setIsReversing(int targetIndex) {
|
||||
bool reversing = selectedIndexHistory.isNotEmpty &&
|
||||
@@ -89,6 +91,9 @@ class _HomePageState extends State<HomePage> {
|
||||
child: Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: PageTransitionSwitcher(
|
||||
duration: Duration(
|
||||
milliseconds:
|
||||
settingsProvider.disablePageTransitions ? 0 : 300),
|
||||
reverse: isReversing,
|
||||
transitionBuilder: (
|
||||
Widget child,
|
||||
|
@@ -396,6 +396,21 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
})
|
||||
],
|
||||
),
|
||||
height16,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(tr('disablePageTransitions'))),
|
||||
Switch(
|
||||
value:
|
||||
settingsProvider.disablePageTransitions,
|
||||
onChanged: (value) {
|
||||
settingsProvider.disablePageTransitions =
|
||||
value;
|
||||
})
|
||||
],
|
||||
),
|
||||
height32,
|
||||
Text(
|
||||
tr('categories'),
|
||||
|
@@ -291,4 +291,13 @@ class SettingsProvider with ChangeNotifier {
|
||||
prefs?.setBool('checkUpdateOnDetailPage', show);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool get disablePageTransitions {
|
||||
return prefs?.getBool('disablePageTransitions') ?? false;
|
||||
}
|
||||
|
||||
set disablePageTransitions(bool show) {
|
||||
prefs?.setBool('disablePageTransitions', show);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user