[text] 1

Viewer

  1. import 'dart:async';
  2. import 'package:flutter/material.dart';
  3. import 'package:rangga/home_screen.dart';
  4.  
  5.  
  6. class SplashScreen extends StatefulWidget {
  7.   const SplashScreen ({Key? key}) :super(key: key);
  8.  
  9.   @override
  10.   _SplashScreenState createState() => _SplashScreenState();
  11. }
  12.  
  13. class _SplashScreenState extends State<SplashScreen>{
  14.   @override
  15.   void initState(){
  16.     super.initState();
  17.  
  18.     Timer (
  19.       Duration(seconds: 2),
  20.     ()=> Navigator.pushReplacement(
  21.       context, 
  22.       MaterialPageRoute(builder: (context) => HomeScreen()),
  23.     ),
  24.     );
  25.   }
  26.  
  27.   @override
  28.   Widget build(BuildContext context){
  29.     return Scaffold(
  30.       backgroundColor: Color.fromARGB(255, 255, 255, 255),
  31.       body: Center(
  32.         child: Column(
  33.           mainAxisAlignment: MainAxisAlignment.center,
  34.           children: [
  35.            Image(
  36.             image: AssetImage('assets/images/database.png'),
  37.             height: 250,
  38.             width: 250,
  39.            ),
  40.             SizedBox(height: 16),
  41.           ],
  42.         ),
  43.       )
  44.     );
  45.   }
  46.  
  47.  
  48. }
  49.  

Editor

You can edit this paste and save as new:


File Description
  • 1
  • Paste Code
  • 11 Dec-2023
  • 1.05 Kb
You can Share it: