49 lines
1.6 KiB
Dart
49 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'tp_launch_page.dart';
|
|
|
|
/// Displays the brand during real initialization, without a minimum wait.
|
|
class TpStartup extends StatelessWidget {
|
|
const TpStartup({super.key, required this.ready, required this.child});
|
|
final Future<void> ready;
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => FutureBuilder<void>(
|
|
future: ready,
|
|
builder: (context, snapshot) {
|
|
final complete = snapshot.connectionState == ConnectionState.done;
|
|
final reduceMotion =
|
|
MediaQuery.maybeOf(context)?.disableAnimations ??
|
|
WidgetsBinding
|
|
.instance
|
|
.platformDispatcher
|
|
.accessibilityFeatures
|
|
.disableAnimations;
|
|
return AnimatedSwitcher(
|
|
duration: reduceMotion
|
|
? Duration.zero
|
|
: const Duration(milliseconds: 220),
|
|
switchInCurve: Curves.easeOut,
|
|
switchOutCurve: Curves.easeIn,
|
|
child: complete
|
|
? AnnotatedRegion<SystemUiOverlayStyle>(
|
|
key: const ValueKey('tp-ready'),
|
|
value: SystemUiOverlayStyle.dark.copyWith(
|
|
statusBarColor: Colors.transparent,
|
|
systemNavigationBarColor: const Color(0xFFF3F7FF),
|
|
systemNavigationBarIconBrightness: Brightness.dark,
|
|
),
|
|
child: child,
|
|
)
|
|
: const MaterialApp(
|
|
key: ValueKey('tp-launch'),
|
|
debugShowCheckedModeBanner: false,
|
|
home: TpLaunchPage(),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|