搜索插件、代码仓与 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,用于显示具有可自定义持续时间、背景颜色和 logo 的启动屏幕。该包在其仓库中包含精心挑选的演示示例,帮助开发者快速上手。兼容所有主要平台——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.

所属分类

源码仓库

使用此插件的项目