Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions lib/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,24 @@
// [Palette] (not the live getters) so the light + dark ThemeData objects are
// each internally consistent regardless of which mode is currently active.

// CupertinoPageTransitionsBuilder (used below for iOS/macOS) comes from
// material.dart on the pinned toolchain (Flutter 3.41.6 — see
// .github/workflows/test.yml). It moved between cupertino.dart and
// material.dart across Flutter versions, so if you bump the pin and this
// suddenly fails to resolve, re-add:
// import 'package:flutter/cupertino.dart' show CupertinoPageTransitionsBuilder;
// iOS/macOS page transitions are NOT named here on purpose.
//
// CupertinoPageTransitionsBuilder has MOVED between SDK versions: on 3.41.6
// (the pinned toolchain, see .github/workflows/test.yml) material.dart exports
// it and cupertino.dart does not; on 3.44.x it is the other way round. So there
// is no single import that compiles on both — importing from cupertino breaks
// the pin with "doesn't export a member with the shown name", and importing
// from material breaks newer SDKs with "isn't defined", which also takes the
// surrounding const map down with it.
//
// Spreading PageTransitionsTheme's own defaults sidesteps the question: the SDK
// already maps iOS/macOS to whatever Cupertino builder that version ships, so
// we override only the platforms we actually want changed and never name the
// moving class. Version-proof in both directions.
//
// Do not "simplify" this back to an explicit iOS entry. The Cupertino builder
// is what supplies the interactive edge-swipe-back gesture — see
// page_transitions.dart's navigation contract.
import 'package:flutter/material.dart';
import 'page_transitions.dart';
import 'tokens.dart';
Expand Down Expand Up @@ -205,14 +217,14 @@ ThemeData buildOpenStrapTheme(Palette p) {
// routes stay MaterialPageRoutes: iOS keeps the native slide transition
// AND the interactive edge-swipe-back gesture; Android-likes get the
// app's shared-axis fade-through. See page_transitions.dart.
pageTransitionsTheme: const PageTransitionsTheme(
pageTransitionsTheme: PageTransitionsTheme(
builders: {
TargetPlatform.android: SharedAxisPageTransitionsBuilder(),
TargetPlatform.fuchsia: SharedAxisPageTransitionsBuilder(),
TargetPlatform.linux: SharedAxisPageTransitionsBuilder(),
TargetPlatform.windows: SharedAxisPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
// iOS/macOS come from the SDK defaults — see the note at the top.
...const PageTransitionsTheme().builders,
TargetPlatform.android: const SharedAxisPageTransitionsBuilder(),
TargetPlatform.fuchsia: const SharedAxisPageTransitionsBuilder(),
TargetPlatform.linux: const SharedAxisPageTransitionsBuilder(),
TargetPlatform.windows: const SharedAxisPageTransitionsBuilder(),
},
),
);
Expand Down
Loading