pubspec.yaml
dependencies:
flutter_native_splash: ^1.1.8+4
projet_name\flutter_native_splash.yaml 생성
flutter_native_splash:
image: assets/images/logo.png
fullscreen: true
패키지 실행 (cmd 창)
flutter pub run flutter_native_splash:create
splash.dart
class Splash extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Image.asset(
"assets/images/logo.png"
),
),
);
}
}
main.dart
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.delayed(Duration(seconds: 3)),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return MaterialApp(debugShowCheckedModeBanner: false, home: Splash());
} else {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Container(),
);
}
},
);
}
}
320x100
'프로그래밍 > Flutter-Dart' 카테고리의 다른 글
[Flutter] endDraw + AppBar actions 함께 쓰기 (0) | 2022.03.10 |
---|---|
[Flutter] AppBar Module (0) | 2022.03.10 |
[Flutter] 네이버 Maps API 사용하기 (0) | 2022.03.08 |
[Flutter] Google Map API 사용하기 (0) | 2022.02.28 |
[Flutter] Text, Icon, Image (0) | 2022.02.16 |
댓글