flame_splash_screen 0.1.0 flame_splash_screen: ^0.1.0 copied to clipboard
Style your flame game with a beautiful splash screen with logo reveal. Simple to use but very customizable.
import 'package:flame_splash_screen/flame_splash_screen.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SplashScreenGame(),
theme: ThemeData.dark(),
debugShowCheckedModeBanner: false,
);
}
}
class OtherScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
child: const Text('Come again'),
onPressed: () {
Navigator.push<void>(
context,
MaterialPageRoute(builder: (context) => SplashScreenGame()),
);
},
),
),
);
}
}
class SplashScreenGame extends StatefulWidget {
@override
_SplashScreenGameState createState() => _SplashScreenGameState();
}
class _SplashScreenGameState extends State<SplashScreenGame> {
FlameSplashController controller;
@override
Widget build(BuildContext context) {
return Scaffold(
body: FlameSplashScreen(
showBefore: (BuildContext context) {
return const Text('Before logo');
},
showAfter: (BuildContext context) {
return const Text('After logo');
},
theme: FlameSplashTheme.dark,
onFinish: (context) => Navigator.pushReplacement<void, void>(
context,
MaterialPageRoute(builder: (context) => OtherScreen()),
),
),
);
}
}