搜尋套件、儲存庫與 APP 分類

套件詳情v1.2.1

another_flutter_splash_screen

一個 Flutter 套件,可輕鬆在您的應用中實作啟動畫面。同時也在倉庫中提供精心挑選的範例。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3070
喜歡數
310
Pub 分數
150

安裝套件

flutter pub add another_flutter_splash_screen

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

另一個 Flutter 啟動畫面是一個輕量級套件,可簡化在 Flutter 應用程式中實作啟動畫面的過程。它提供一個易於使用的 API,可用於顯示具有可自訂持續時間、背景顏色和圖示的啟動畫面。該套件在其儲存庫中包含精心挑選的範例,幫助開發者快速上手。相容所有主要平台——Android、iOS、Web、macOS、Windows 和 Linux,確保無論目標裝置為何,都能提供一致的啟動體驗。

適用情境

  • 快速應用啟動螢幕設定
  • 跨平台啟動畫面實現
  • 可自定義的啟動動畫
  • 入職或品牌展示
  • 應用初始化延遲處理

主要特色

  • 用於啟動畫面整合的簡單 API
  • 支援多個平台
  • 內建示範範例
  • 可設定的持續時間和外觀
  • 輕量且無依賴
  • 顏色和資源的輕鬆自定義

適合對象

  • 初學者Flutter開發者
  • 需要一致的引導視覺效果的應用程式
  • 需要快速部署啟動畫面的項目
  • 跨平台移動和桌面應用
  • 開發人員尋求最少的設定時間

使用建議

  • 有限的高級動畫選項
  • 不支援動態內容載入的內建功能
  • 需要手動處理濺水後的導航
  • 不適合複雜的splash邏輯
  • 最適合靜態或簡單的啟動畫面顯示

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

pub package

:star: Splash screens made simple :star:


Supports deciding next screen dynamically. Example here
Supports Immersive Mode (Hide Status Bar in Splash Screen). Example here

Buy Me A Coffee

Getting started

Add another_flutter_splash_screen to your pubspec.yaml file and start implementing splash screen easily.

Installation

Just add another_flutter_splash_screen as a dependency in your pubspec.yaml file.

dependencies:
  another_flutter_splash_screen: <Latest Version>

Usage

 import 'package:another_flutter_splash_screen/another_flutter_splash_screen.dart';

A splash screen with a gif splash.

FlutterSplashScreen.gif(
          gifPath: 'assets/example.gif',
          gifWidth: 269,
          gifHeight: 474,
          nextScreen: const MyHomePage(),
          duration: const Duration(milliseconds: 3515),
          onInit: () async {
            debugPrint("onInit");
          },
          onEnd: () async {
            debugPrint("onEnd 1");
          },
        );

A splash screen with fade in splash.

FlutterSplashScreen.fadeIn(
          backgroundColor: Colors.white,
          onInit: () {
            debugPrint("On Init");
          },
          onEnd: () {
            debugPrint("On End");
          },
          childWidget: SizedBox(
            height: 200,
            width: 200,
            child: Image.asset("assets/dart_bird.png"),
          ),
          onAnimationEnd: () => debugPrint("On Fade In End"),
          nextScreen: const MyHomePage(),
        );

A splash screen with scale splash.

FlutterSplashScreen.scale(
          gradient: const LinearGradient(
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
            colors: [
              Colors.lightBlue,
              Colors.blue,
            ],
          ),
          childWidget: SizedBox(
            height: 50,
            child: Image.asset("assets/twitter_logo_white.png"),
          ),
          duration: const Duration(milliseconds: 1500),
          animationDuration: const Duration(milliseconds: 1000),
          onAnimationEnd: () => debugPrint("On Scale End"),
          nextScreen: const MyHomePage(),
        );

Dynamic routing

  • Following is the example of Navigate using different mechanisms
FlutterSplashScreen.gif(
     ...
     // go_router example
     asyncNavigationCallback: () async {
       var response = await userRepository.getUserData();
      if(response.status == 200 && response.data.isAuthenticated){
       GoRouter.of(context).goNamed("home");     
      }
      else{
          // GoRouter.of(context).goNamed("/");
      }
     },
                  OR
     // Named routing example
     asyncNavigationCallback: () async {
       await Future.delayed(const Duration(seconds: 3));
       if (context.mounted) {
         Navigator.pushReplacementNamed(context, "home");
       }
     },
    ...
   );

A splash screen using immersive mode (Hide status bar in splash screen).

Just use "useImmersiveMode : true" to hide status bar in splash screen.

Demo 1
FlutterSplashScreen.gif(
          useImmersiveMode: true,
          gifPath: 'assets/example.gif',
          gifWidth: 269,
          gifHeight: 474,
          nextScreen: const MyHomePage(),
          duration: const Duration(milliseconds: 3515),
        );

A splash screen using lottie animation.

FlutterSplashScreen(
          useImmersiveMode: true,
          duration: const Duration(milliseconds: 2000),
          nextScreen: const MyHomePage(),
          backgroundColor: Colors.white,
          splashScreenBody: Center(
            child: Lottie.asset(
              "assets/lottie_loading_2.json",
              repeat: false,
            ),
          ),
        );

A splash screen with custom splash.

FlutterSplashScreen(
          duration: const Duration(milliseconds: 2000),
          nextScreen: const MyHomePage(),
          backgroundColor: Colors.white,
          splashScreenBody: Center(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                const SizedBox(
                  height: 100,
                ),
                const Text(
                  "Custom Splash",
                  style: TextStyle(color: Colors.black, fontSize: 24),
                ),
                const Spacer(),
                SizedBox(
                  width: 200,
                  child: Image.asset('assets/flutter.png'),
                ),
                const Spacer(),
                const Text(
                  "Flutter is Love",
                  style: TextStyle(color: Colors.pink, fontSize: 20),
                ),
                const SizedBox(
                  height: 100,
                ),
              ],
            ),
          ),
        );

Additional information

We will be more than happy for your contributions.
Please contribute to another_flutter_splash_screen this github repo.

所屬分類

原始碼儲存庫

使用此套件的專案