9551eceaed
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
92 lines
3.0 KiB
Dart
92 lines
3.0 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
// Framework transition for Material routes: keeps Apple's interactive Back.
|
|
import 'package:flutter/cupertino.dart' show CupertinoPageTransitionsBuilder;
|
|
import 'package:flutter/material.dart';
|
|
|
|
const _seed = Color(0xFF6750A4);
|
|
|
|
/// [fontFamily] replaces the platform family throughout the Material text
|
|
/// themes, keeping every size, weight and text scaling. Null keeps the system
|
|
/// typography.
|
|
ThemeData appLightTheme({String? fontFamily}) {
|
|
final scheme = ColorScheme.fromSeed(seedColor: _seed);
|
|
return ThemeData(
|
|
platform: kIsWeb ? TargetPlatform.android : null,
|
|
colorScheme: scheme,
|
|
pageTransitionsTheme: appPageTransitions,
|
|
fontFamily: fontFamily,
|
|
);
|
|
}
|
|
|
|
/// Android and iOS keep their native transitions and interactive back gestures.
|
|
/// Desktop hosts use the short horizontal slide.
|
|
const appPageTransitions = PageTransitionsTheme(
|
|
builders: {
|
|
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
|
|
TargetPlatform.fuchsia: FastSlidePageTransitionsBuilder(),
|
|
TargetPlatform.linux: FastSlidePageTransitionsBuilder(),
|
|
TargetPlatform.windows: FastSlidePageTransitionsBuilder(),
|
|
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
|
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
|
|
},
|
|
);
|
|
|
|
/// A 200 ms horizontal slide with no fade: only the page moves, so nothing
|
|
/// has to be redrawn into an offscreen layer.
|
|
class FastSlidePageTransitionsBuilder extends PageTransitionsBuilder {
|
|
const FastSlidePageTransitionsBuilder();
|
|
|
|
@override
|
|
Duration get transitionDuration => const Duration(milliseconds: 200);
|
|
|
|
@override
|
|
Duration get reverseTransitionDuration => const Duration(milliseconds: 180);
|
|
|
|
@override
|
|
Widget buildTransitions<T>(
|
|
PageRoute<T> route,
|
|
BuildContext context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
Widget child,
|
|
) {
|
|
final curved = CurvedAnimation(
|
|
parent: animation,
|
|
curve: Curves.easeOutCubic,
|
|
reverseCurve: Curves.easeInCubic,
|
|
);
|
|
return SlideTransition(
|
|
position: Tween<Offset>(
|
|
begin: const Offset(1, 0),
|
|
end: Offset.zero,
|
|
).animate(curved),
|
|
child: child,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Material's dark scheme with gray surfaces stepping up from the page.
|
|
ThemeData appDarkTheme({String? fontFamily}) {
|
|
final scheme =
|
|
ColorScheme.fromSeed(
|
|
seedColor: _seed,
|
|
brightness: Brightness.dark,
|
|
).copyWith(
|
|
surface: const Color(0xFF141416),
|
|
surfaceDim: const Color(0xFF141416),
|
|
surfaceBright: const Color(0xFF3A3B40),
|
|
surfaceContainerLowest: const Color(0xFF0F0F11),
|
|
surfaceContainerLow: const Color(0xFF1B1C1F),
|
|
surfaceContainer: const Color(0xFF202125),
|
|
surfaceContainerHigh: const Color(0xFF27282C),
|
|
surfaceContainerHighest: const Color(0xFF303136),
|
|
);
|
|
return ThemeData(
|
|
platform: kIsWeb ? TargetPlatform.android : null,
|
|
colorScheme: scheme,
|
|
scaffoldBackgroundColor: scheme.surface,
|
|
pageTransitionsTheme: appPageTransitions,
|
|
fontFamily: fontFamily,
|
|
);
|
|
}
|