搜索插件、代码仓与 APP 分类

插件详情v0.2.2

your_splash

一个 Flutter 的启动画面实现。支持 Android 和 iOS。

近 30 天下载
28
喜欢数
7
Pub 分数
40

安装插件

flutter pub add your_splash

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

YourSplash 是一个 Flutter 包,为 Android 和 iOS 平台提供简单有效的启动屏实现。它允许开发者在应用初始化期间显示可自定义的启动屏,从而改善启动时的用户体验。该包可无缝集成到 Flutter 项目中,并支持平台特定配置。通过最少的设置,确保从启动屏到主应用界面的流畅过渡。

适合场景

  • 应用入门屏幕
  • 初始加载状态显示
  • 应用发布期间的品牌推广
  • 在导航前预加载资源
  • 流畅的应用启动体验

主要特点

  • 跨平台支持(Android 和 iOS)
  • 与 Flutter 的轻松集成
  • 可自定义的启动画面外观
  • 自动切换到主屏幕
  • 最小配置要求

适合对象

  • 新 Flutter 项目
  • 需要品牌启动画面的应用程序
  • 寻求轻量级启动画面解决方案的开发者
  • 需要资源预加载的项目
  • 简单的启动屏幕实现

使用建议

  • 不支持网页平台
  • 超出基本样式的定制功能有限
  • 无内置动画控制
  • 依赖手动计时进行转换
  • 需要妥善的资产管理才能获得最佳效果

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

your_splash

pub package license build codecov Say Thanks!

A Flutter implementation of splash screen. Supports Android and IOS.

Features

  • Supports splash screen with the Future callback
  • Supports splash screen with timer

Getting Started

To use this library, add your_splash as a dependency in your pubspec.yaml file:

dependencies:
  ...
  your_splash:

In your library add the following import:

import 'package:your_splash/your_splash.dart';
Constructors

This package comes with 2 kinds of splash screen actions:

  • FuturedSplashScreen
  • TimedSplashScreen

You can create a splash screen in two different ways:

  • by calling FuturedSplashScreen or TimedSplashScreen constructor and passing required arguments.
  • by calling SplashScreen.futured or SplashScreen.timed constructor respectively.

A FuturedSplashScreen requires next arguments:

Parameter Description
future This is your Future callback for delay
route This is a dynamic argument. Can be String name of route or PageRoute instance
body This is a body of your splash screen

A TimedSplashScreen requires next arguments:

Parameter Description
seconds This is a duration in seconds for how long your splash screen will be displayed
route This is a dynamic argument. Can be String name of route or PageRoute instance
body This is a body of your splash screen
Examples

Quick start example:

import 'package:flutter/material.dart';
import 'package:your_splash/your_splash.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: SplashScreen.timed(
        seconds: 3,
        route: MaterialPageRoute(builder: (_) => Home()),
        body: Scaffold(
          body: InkWell(
            child: Container(
              decoration: const BoxDecoration(
                image: DecorationImage(
                  fit: BoxFit.cover,
                  image: NetworkImage('https://bit.ly/3hD5Tj8'),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Home screen!"),
      ),
      body: Center(
        child: Text(
          "Welcome!",
          style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40.0),
        ),
      ),
    );
  }
}

How can I animate transition between the splash screen and navigation page?

Overview

route: PageRouteBuilder(
  pageBuilder: (context, animation, secondaryAnimation) => Home(),
  transitionDuration: Duration(seconds: 1),
  transitionsBuilder: (_, animation, secAnim, child) {
    var tween = Tween(begin: 0.0, end: 1.0).chain(
      CurveTween(curve: Curves.easeInOutCirc),
    );
    return FadeTransition(
        opacity: animation.drive(tween), child: child);
  },

You can see all examples here

所属分类

源码仓库

使用此插件的项目

暂无相关数据。