floating_dots 0.2.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 54

floating_dots #

Pub

Creates a group of coloured floating dots (or a single floating dot) that travel at a random speed from one edge of the screen to another.

small dots, floating randomly small dots, floating up

Installation #

In your pubspec.yaml root add:

dependencies:
    floating_dots: ^0.2.2

then,

import 'package:floating_dots/floating_dots.dart';

Usage #

FloatingDotGroup #

FloatingDotGroup(
    number: int,
    direction: Direction,
    trajectory: Trajectory,
    size: DotSize,
    colors: List<Color>,
    opacity: double,
    speed: DotSpeed,
)

FloatingDot #

FloatingDot(
    direction: Direction,
    trajectory: Trajectory,
    radius: double,
    color: Colour,
    opacity: double,
    time: int,
)

Examples #

small dots

Small dots

FloatingDotGroup(
    number: 5,
    direction: Direction.up,
    trajectory: Trajectory.random,
    size: DotSize.small,
    colors: Colors.primaries,
    opacity: 1,
    speed: DotSpeed.fast,
),

medium dots

Medium dots

FloatingDotGroup(
    number: 25,
    direction: Direction.random,
    trajectory: Trajectory.random,
    size: DotSize.medium,
    colors: Colors.accents,
    opacity: .5,
    speed: DotSpeed.medium,
),

large dots

Large dots

Stack(
    children: <Widget>[
        Container(
            width: double.infinity,
            height: double.infinity,
            color: Colors.black,
        ),
        FloatingDotGroup(
            number: 1,
            direction: Direction.up,
            trajectory: Trajectory.straight,
            size: DotSize.large,
            colors: [Colors.deepOrange],
            opacity: 1,
            speed: DotSpeed.medium,
        ),
    ],
),

[0.0.1] - 30-05-2019

  • Create package.
  • Add documentation.

[0.1.0] - 01-06-2019

  • Update README.
  • Stable release code.

[0.2.0] - 01-06-2019

  • Add speed and opacity controls
  • Assign types to all parameters
  • Assign a defautl value to DotSize - DotSize.random

[0.2.1] - 01-06-2019

  • Update example and README

[0.2.2] - 02-06-2019

  • Tweak speed controls
  • Make FloatingDot and FloatingDotGroup update state with new parameters

example/example.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Dots Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        child: FloatingDotGroup(
          number: 500,
          direction: Direction.up,
          trajectory: Trajectory.straight,
          size: DotSize.small,
          colors: [
            Colors.red,
            Colors.green,
            Colors.blue,
            Colors.yellow,
            Colors.purple,
            Colors.orange
          ],
          opacity: 0.5,
          speed: DotSpeed.slow,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  floating_dots: ^0.2.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:floating_dots/floating_dots.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
8
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test