FLUTTER ECOSYSTEM

tranhuycong/custom_splash

로고 아이콘 변경, 로고 애니메이션, 스플래시 화면 배경 색상과 같은 스플래시 화면을 사용자 정의할 수 있는 플러터 패키지입니다.

사용자 정의 스플래시 프로젝트 이미지
Stars
79
Forks
10
최근 푸시(UTC)
2022. 5. 26.
프로젝트 상태
활성
tranhuycong GitHub avatar
GITHUB User

tranhuycong ↗

언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 2 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

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,
    ),
));