Last active
April 12, 2022 08:49
-
-
Save triyono777/68c9b26ccd0cb339a8aac42721771c48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:projek_kel_1/home_screen.dart'; | |
class SplashScreen extends StatefulWidget { | |
const SplashScreen({Key? key}) : super(key: key); | |
@override | |
State<SplashScreen> createState() => _SplashScreenState(); | |
} | |
class _SplashScreenState extends State<SplashScreen> { | |
startTimer() async { | |
var duration = Duration(seconds: 5); | |
return Timer(duration, () async { | |
Navigator.of(context).pushReplacement( | |
MaterialPageRoute(builder: (_) => HomeScreen()), | |
); | |
}); | |
} | |
@override | |
void initState() { | |
startTimer(); | |
super.initState(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Image.asset('assets/images/udb.png'), | |
CircularProgressIndicator(), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment