Giter Site home page Giter Site logo

hefei93 / custom_splash Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tranhuycong/custom_splash

0.0 1.0 0.0 12.91 MB

A Flutter package to custom splash screen like change logo icon, logo animation, and splash screen background color.

License: Other

Dart 100.00%

custom_splash's Introduction

Custom Splash Screen

A Flutter package to custom splash screen: change logo icon, logo animation, and splash screen background color. (Custom from animated splash screen)

ProgressDialog Demo

Using the package

Get the library

Things to do

  1. Get a logo for your app
  2. Prepare what to execute while the splash screen is shown (initializing your db, shared preferences, firebase...etc)
  3. Screen to be shown after splash screen and background process
  4. Duration of Splash Screen

Import the package

import 'package:custom_splash/custom_splash.dart';

Show splash screen for some duration

  type: CustomSplashType.StaticDuration

Inside your main function, use home as SplashScreen(_), the parameters are as follows:

imagePath: Path to your app-logo/image

backGroundColor(not require - default: white): background's color (Colors.deepOrange or Color(0xfffc6042))

animationEffect(not require - default: 'fade-in'): change animation of logo. There are: 'fade-in', 'zoom-in', 'zoom-out', 'top-down'.

ProgressDialog Demo

logoSize(not require - default: 250): custom size of logo

home: Screen to be shown after splash

duration: duration of splash screen in milliseconds

type

runApp(MaterialApp(
    home: CustomSplash(
        imagePath: 'assets/flutter_icon.png',
        backGroundColor: Colors.deepOrange,
        animationEffect: 'zoom-in',
        logoSize: 200,
        home: MyApp(),
        customFunction: duringSplash,
        duration: 2500,
        type: CustomSplashType.StaticDuration,
        outputAndHome: op,
    ),
));

Execute a function in background and based on the value from that function navigate to different screen

  type: CustomSplashType.BackgroundProcess

Create an object of Function that gets executed while splash screen is shown

Function duringSplash = () {
  //Write your code here
  ...
  return value;
};

Create routes according to your function return value

  //setup the return value correctly for proper navigation
  Map<dynamic, Widget> returnValueAndHomeScreen = {1: Home(), 2: HomeSt()};

Inside your main function, use home as SplashScreen(_), the parameters are as follows:

imagePath: Path to your app-logo/image home: Screen to be shown after splash customFunction: the function you have written above duration: duration of splash screen in milliseconds type output value of customFunction and home screen to navigate(Map function)

runApp(MaterialApp(
    home: CustomSplash(
        imagePath: 'assets/flutter_icon.png',
        backGroundColor: Colors.deepOrange,
        animationEffect: 'zoom-in',
        logoSize: 200,
        home: MyApp(),
        customFunction: duringSplash,
        duration: 2500,
        type: CustomSplashType.BackgroundProcess,
        outputAndHome: op,
    ),
));

custom_splash's People

Contributors

congth avatar shrimantnikate avatar tranhuycong avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.