Skip to content

Commit

Permalink
fix: settings transition
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiya10 committed Jun 30, 2024
1 parent 776d902 commit 8f7d2f2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 80 deletions.
14 changes: 10 additions & 4 deletions lib/route/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class SettingsRoute extends StatefulWidget {
class _SettingsRouteState extends State<SettingsRoute> {
final GlobalKey<NavigatorState> navKey = GlobalKey<NavigatorState>();
List<String> history = [];
final backTransition = const Interval(0, 0.5, curve: Easing.emphasizedAccelerate);
final forwardTransition = const Interval(0.5, 1, curve: Easing.emphasizedDecelerate);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -77,16 +79,18 @@ class _SettingsRouteState extends State<SettingsRoute> {
default:
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => const SettingsRootView(),
transitionDuration: Durations.long4,
reverseTransitionDuration: Durations.long4,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
var slide = Tween(
begin: Offset.zero,
end: const Offset(-0.2, 0.0),
).chain(CurveTween(curve: Easing.standardAccelerate));
).chain(CurveTween(curve: backTransition));

var fade = Tween(
begin: 1.0,
end: 0.0,
).chain(CurveTween(curve: Easing.standardAccelerate));
).chain(CurveTween(curve: backTransition));

return SlideTransition(
position: secondaryAnimation.drive(slide),
Expand All @@ -98,16 +102,18 @@ class _SettingsRouteState extends State<SettingsRoute> {

return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => child,
transitionDuration: Durations.long4,
reverseTransitionDuration: Durations.long4,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
var slide = Tween(
begin: const Offset(0.2, 0.0),
end: Offset.zero,
).chain(CurveTween(curve: Easing.standardDecelerate));
).chain(CurveTween(curve: forwardTransition));

var fade = Tween(
begin: 0.0,
end: 1.0,
).chain(CurveTween(curve: Easing.standardDecelerate));
).chain(CurveTween(curve: forwardTransition));

return SlideTransition(
position: animation.drive(slide),
Expand Down
112 changes: 36 additions & 76 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.4.1"
archive:
dependency: transitive
description:
name: archive
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
url: "https://pub.dev"
source: hosted
version: "3.6.1"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -193,14 +201,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.0"
dart_earcut:
dependency: transitive
description:
name: dart_earcut
sha256: "41b493147e30a051efb2da1e3acb7f38fe0db60afba24ac1ea5684cee272721e"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
dart_style:
dependency: transitive
description:
Expand Down Expand Up @@ -403,14 +403,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_map:
dependency: "direct main"
description:
name: flutter_map
sha256: cc102fe5eeab1a740c321e1982706061e46259cd75115b3b3779195f21d57cc3
url: "https://pub.dev"
source: hosted
version: "7.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -549,6 +541,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
image:
dependency: transitive
description:
name: image
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
url: "https://pub.dev"
source: hosted
version: "4.2.0"
intl:
dependency: "direct main"
description:
Expand Down Expand Up @@ -589,14 +589,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.8.0"
latlong2:
dependency: transitive
description:
name: latlong2
sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe"
url: "https://pub.dev"
source: hosted
version: "0.9.1"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -629,30 +621,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0"
lists:
logging:
dependency: transitive
description:
name: lists
sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27"
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
logger:
version: "1.2.0"
maplibre_gl:
dependency: "direct main"
description:
name: maplibre_gl
sha256: ea2fa443e7d5dc18db7f37a0f6f5af40642888c56b81a14441aeddea077adaea
url: "https://pub.dev"
source: hosted
version: "0.20.0"
maplibre_gl_platform_interface:
dependency: transitive
description:
name: logger
sha256: af05cc8714f356fd1f3888fb6741cbe9fbe25cdb6eedbab80e1a6db21047d4a4
name: maplibre_gl_platform_interface
sha256: "718c3503f36936fbf35c34d6ddf8bf770474c5ba1e6cb1d8caece44efae424af"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
logging:
version: "0.20.0"
maplibre_gl_web:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
name: maplibre_gl_web
sha256: e7d71b08f24dca70e9c9cf841b096704a677e6239447d87220ec071355768149
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "0.20.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -685,14 +685,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.12.0"
mgrs_dart:
dependency: transitive
description:
name: mgrs_dart
sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7
url: "https://pub.dev"
source: hosted
version: "2.0.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -861,14 +853,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
polylabel:
dependency: transitive
description:
name: polylabel
sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
pool:
dependency: transitive
description:
Expand All @@ -877,14 +861,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.1"
proj4dart:
dependency: transitive
description:
name: proj4dart
sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e
url: "https://pub.dev"
source: hosted
version: "2.1.0"
pub_semver:
dependency: transitive
description:
Expand Down Expand Up @@ -1090,14 +1066,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
unicode:
dependency: transitive
description:
name: unicode
sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
url_launcher:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1218,14 +1186,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.5.0"
wkt_parser:
dependency: transitive
description:
name: wkt_parser
sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
xdg_directories:
dependency: transitive
description:
Expand Down

0 comments on commit 8f7d2f2

Please sign in to comment.