Skip to content

Instantly share code, notes, and snippets.

@triyono777
Last active April 12, 2022 08:49
Show Gist options
  • Save triyono777/68c9b26ccd0cb339a8aac42721771c48 to your computer and use it in GitHub Desktop.
Save triyono777/68c9b26ccd0cb339a8aac42721771c48 to your computer and use it in GitHub Desktop.
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