Home > Enterprise >  how to add an full screen image as splash screen on flutter
how to add an full screen image as splash screen on flutter

Time:10-02

**Hi there everyone I am quite new to flutter and have used it for 1 or 2 months my question is that is there is any possible way that I can add the full-screen image as a splash screen for my application? I am stuck here I tried so many methods they are not working as a I want **

CodePudding user response:

    import 'package:flutter/material.dart';

class Splash extends StatefulWidget {
  @override
  _SplashState createState() => _SplashState();
}

class _SplashState extends State<Splash> {
  @override
  void initState() {
    Future.delayed(Duration(seconds: 3), () {
      Navigator.push(
          context,
          MaterialPageRoute(
              builder: (context) => CalendarWidget(title: 'Calendar')));
    });

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        child: Image.network(
          'https://images.pexels.com/photos/1987301/pexels-photo-1987301.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}
  • Related