flutter_splash_countdown 0.0.0+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 63

flutter_splash_countdown #

pub package Build Status

Automatically generates native code for adding splash screens in Android and iOS. Customize with specific platform, background color and splash image.

This package is heavily inspired by flutter_native_splash created by henriquearthur.

Usage #

First, add flutter_splash_countdown as a dev dependency in your pubspec.yaml file. You should add the package to dev_dependencies because you don't need this plugin in your APK.

dev_dependencies:
  flutter_splash_countdown: ^0.0.0+2

Don't forget to flutter pub get.

1. Setting the splash screen #

Add your settings to your project's pubspec.yaml file or create a file in your root project folder named flutter_splash_countdown.yaml with your settings.

flutter_splash_countdown:
  image: assets/images/splash.png
  color: "42a5f5"
  • image must be a png file.
  • You can use # in color as well. color: "#42a5f5"

You can omit image parameter if you just want a colored splash screen:

flutter_splash_countdown:
  color: "42a5f5"

You can also set android or ios to false if you don't want to create a splash screen for a specific platform.

flutter_splash_countdown:
  image: assets/images/splash.png
  color: "42a5f5"
  android: false

In case your image should use all available screen (width and height) you can use fill property.

flutter_splash_countdown:
  image: assets/images/splash.png
  color: "42a5f5"
  fill: true

Note: fill property is not yet implemented for iOS splash screens.

If you want to disable full screen splash screen on Android you can use android_disable_fullscreen property.

flutter_splash_countdown:
  image: assets/images/splash.png
  color: "42a5f5"
  android_disable_fullscreen: true

2. Run the package #

After adding your settings, run the package with

flutter pub run flutter_splash_countdown:create

When the package finishes running your splash screen is ready.

Notes #

  • If splash screen was not updated properly on iOS or if you experience a white screen before splash screen, run flutter clean and recompile your app. (issue #9)
  • This package modifies launch_background.xml, styles.xml and MainActivity files on Android and LaunchScreen.storyboard, Info.plist and AppDelegate on iOS. If you modified this files manually this plugin may not work properly, please open a issue if you find any bugs.

Recommendations #

  • If you want to use a Material Icon as your splash image, download an icon in (material.io/resources/icons) as PNG for Android. I recommend using the biggest icon in drawable-xxxhdpi folder which was just downloaded for better results.
  • Material Colors are available in material.io/resources/color

How it works #

Android #

  • Your splash image will be resized to mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi drawables.
  • An <item> tag containing a <bitmap> for your splash image drawable will be added in launch_background.xml
  • Background color will be added in colors.xml and referenced in launch_background.xml.
  • Code for full screen mode toggle will be added in styles.xml and MainActivity.

iOS #

  • Your splash image will be resized to @3x and @2x images.
  • Color and image properties will be inserted in LaunchScreen.storyboard.
  • Code for hidden status bar toggle will be adde in Info.plist and AppDelegate.

[0.0.0+2] - (27th April 2020) #

  • release

[0.0.0+1] - (27th April 2020) #

  • Initial commit

example/lib/main.dart

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_splash_countdown: ^0.0.0+2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_splash_countdown/flutter_splash_countdown.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:flutter_splash_countdown/flutter_splash_countdown.dartpackage:flutter_splash_countdown/ios.dartdart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:flutter_splash_countdown/flutter_splash_countdown.dartpackage:flutter_splash_countdown/ios.dartdart:io

Health suggestions

Format lib/flutter_splash_countdown.dart.

Run dartfmt to format lib/flutter_splash_countdown.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
color ^2.1.1 2.1.1
image ^2.1.4 2.1.13
yaml ^2.1.16 2.2.1
Transitive dependencies
archive 2.0.13
args 1.6.0
charcode 1.1.3
collection 1.14.13
convert 2.1.1
crypto 2.1.5
meta 1.1.8
path 1.7.0
petitparser 3.0.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0
xml 3.7.0 4.2.0
Dev dependencies
pedantic ^1.8.0+1