feat: logo-assembly splash screen and native launch colors
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="?android:colorBackground" />
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
<!-- You can insert your own image assets here -->
|
<solid android:color="#FF0E1430"/>
|
||||||
<!-- <item>
|
</shape>
|
||||||
<bitmap
|
</item>
|
||||||
android:gravity="center"
|
|
||||||
android:src="@mipmap/launch_image" />
|
|
||||||
</item> -->
|
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@android:color/white" />
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
<!-- You can insert your own image assets here -->
|
<solid android:color="#FF0E1430"/>
|
||||||
<!-- <item>
|
</shape>
|
||||||
<bitmap
|
</item>
|
||||||
android:gravity="center"
|
|
||||||
android:src="@mipmap/launch_image" />
|
|
||||||
</item> -->
|
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||||
</imageView>
|
</imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="0.054901960784" green="0.078431372549" blue="0.188235294118" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
|
||||||
import 'l10n/gen/app_localizations.dart';
|
import 'l10n/gen/app_localizations.dart';
|
||||||
import 'ui/screens/home_screen.dart';
|
import 'ui/screens/splash_screen.dart';
|
||||||
|
|
||||||
class BlockSeasonsApp extends StatelessWidget {
|
class BlockSeasonsApp extends StatelessWidget {
|
||||||
const BlockSeasonsApp({super.key});
|
const BlockSeasonsApp({super.key});
|
||||||
@@ -26,7 +26,7 @@ class BlockSeasonsApp extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
),
|
),
|
||||||
home: const HomeScreen(),
|
home: const SplashScreen(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'home_screen.dart';
|
||||||
|
|
||||||
|
/// Logo-assembly splash: four glossy blocks fly in to form a 2x2 mark, the
|
||||||
|
/// wordmark fades in, then we hand off. SaveRepository is already opened in
|
||||||
|
/// main() so this doubles as perceived-zero loading time.
|
||||||
|
class SplashScreen extends StatefulWidget {
|
||||||
|
const SplashScreen({super.key});
|
||||||
|
|
||||||
|
/// Where the splash goes when finished; the season title card task
|
||||||
|
/// repoints this.
|
||||||
|
static Widget Function() nextScreen = () => const HomeScreen();
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SplashScreen> createState() => _SplashScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SplashScreenState extends State<SplashScreen>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late final AnimationController _c = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: const Duration(milliseconds: 1900),
|
||||||
|
)..addStatusListener((status) {
|
||||||
|
if (status == AnimationStatus.completed && mounted) {
|
||||||
|
Navigator.of(context).pushReplacement(
|
||||||
|
MaterialPageRoute(builder: (_) => SplashScreen.nextScreen()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/// (color, fly-in direction unit, 2x2 slot unit) per block.
|
||||||
|
static const _blocks = [
|
||||||
|
(Color(0xFFFF7EB3), Offset(-1.2, -0.4), Offset(-0.5, -0.5)),
|
||||||
|
(Color(0xFFFFD166), Offset(1.2, -0.4), Offset(0.5, -0.5)),
|
||||||
|
(Color(0xFF6FCDF5), Offset(-1.2, 0.6), Offset(-0.5, 0.5)),
|
||||||
|
(Color(0xFF7EDB9C), Offset(1.2, 0.6), Offset(0.5, 0.5)),
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_c.forward();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_c.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
const blockSize = 46.0;
|
||||||
|
const gap = 3.0;
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: const Color(0xFF0E1430),
|
||||||
|
body: AnimatedBuilder(
|
||||||
|
animation: _c,
|
||||||
|
builder: (context, _) {
|
||||||
|
final titleT = const Interval(0.60, 0.88, curve: Curves.easeOut)
|
||||||
|
.transform(_c.value);
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
for (var i = 0; i < _blocks.length; i++)
|
||||||
|
_block(i, blockSize, gap),
|
||||||
|
Transform.translate(
|
||||||
|
offset: Offset(0, 78 + 12 * (1 - titleT)),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: titleT,
|
||||||
|
child: const Text(
|
||||||
|
'BLOCK SEASONS',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26,
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
letterSpacing: 4,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _block(int i, double size, double gap) {
|
||||||
|
final (color, from, to) = _blocks[i];
|
||||||
|
final t = Interval(0.06 * i, 0.45 + 0.06 * i, curve: Curves.easeOutBack)
|
||||||
|
.transform(_c.value);
|
||||||
|
final begin = Offset(from.dx * 160, from.dy * 280);
|
||||||
|
final end = Offset(to.dx * (size + gap), to.dy * (size + gap));
|
||||||
|
final pos = Offset.lerp(begin, end, t)!;
|
||||||
|
return Transform.translate(
|
||||||
|
offset: pos,
|
||||||
|
child: Container(
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(11),
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
colors: [
|
||||||
|
Color.lerp(color, Colors.white, 0.28)!,
|
||||||
|
color,
|
||||||
|
Color.lerp(color, Colors.black, 0.22)!,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: color.withValues(alpha: 0.55),
|
||||||
|
blurRadius: 18,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,10 @@ void main() {
|
|||||||
child: const BlockSeasonsApp(),
|
child: const BlockSeasonsApp(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
// Splash (~1.9s) → (later: season title card) → home.
|
||||||
|
await tester.pump(const Duration(milliseconds: 2100));
|
||||||
|
await tester.pump(const Duration(milliseconds: 2000));
|
||||||
|
await tester.pump(const Duration(milliseconds: 2000));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('Block Seasons'), findsOneWidget);
|
expect(find.text('Block Seasons'), findsOneWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user