flame_splash_screen 0.0.1 flame_splash_screen: ^0.0.1 copied to clipboard
Style your flame/flutter game with a beautiful splash screen. Simple to use but very customizable.
import 'package:flutter/material.dart';
import 'package:flame_splash_screen/flame_splash_screen.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
SystemChrome.setEnabledSystemUIOverlays([]);
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: OtherScreen(),
theme: ThemeData.dark(),
debugShowCheckedModeBanner: false,
);
}
}
class OtherScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
child: const Text("Click on me"),
onPressed: () {
Navigator.push(
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.pop(context),
),
);
}
}