DPLYR-dev / SplashScreenFlutterPackage

A small splashscreen used as intro for flutter applications easily with a lot of customizations ❤️🥳
MIT License
294 stars 122 forks source link

Cannot center the image on the screen #38

Closed pratik037 closed 3 years ago

pratik037 commented 5 years ago

How to Center the image on the screen if we don't have any text?

import 'package:flutter/material.dart';
import 'package:recipeblends/landingPages.dart';
import 'package:splashscreen/splashscreen.dart';

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

class _SplashState extends State<Splash> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: SplashScreen(
        seconds: 3,
        image: Image.asset(
          'assets/images/logo.png'
        ),
        navigateAfterSeconds: LandingPage(),
        backgroundColor: Colors.white,
        photoSize: 200,
      ),
    );
  }
}
SonQBChau commented 5 years ago

You can use Stack, this works for me:

Stack(
      children: <Widget>[
        SplashScreen(
            seconds: 1,
            navigateAfterSeconds:  ListViewPage(),
            backgroundColor: Colors.white,
            loaderColor: Colors.transparent,

        ),
        Container(
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage("assets/images/logo.png"),
              fit: BoxFit.fitWidth,
            ),
          ),
        ),
      ],

    );
0xjoaovpsantos commented 4 years ago

You can use Stack, this works for me:

Stack(
      children: <Widget>[
        SplashScreen(
            seconds: 1,
            navigateAfterSeconds:  ListViewPage(),
            backgroundColor: Colors.white,
            loaderColor: Colors.transparent,

        ),
        Container(
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage("assets/images/logo.png"),
              fit: BoxFit.fitWidth,
            ),
          ),
        ),
      ],

    );

Thank you @SonQBChau