water_drop 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new67

Water Drop 💦💦💦 #

A simple package for adding water drops to your Widgets!

👇👇👇👇👇👇👇👇👇👇
Blog article with detailed explanation:
https://fidev.io/water-drop
👆👆👆👆👆👆👆👆👆👆

Demo

Why? #

Why not?!

How? #

Just wrap your widget in WaterDrop and provide params:

Widget build(BuildContext context) {
  return WaterDrop(
    child: _StaticCard(color: Colors.green),
    params: [
      WaterDropParam(top: 50, height: 70, left: 100, width: 50),
      WaterDropParam(top: 10, height: 100, left: 280, width: 100),
      WaterDropParam(top: 155, height: 35, left: 135, width: 35),
      WaterDropParam(top: 135, height: 40, left: 250, width: 30),
      WaterDropParam(top: 20, height: 40, left: 20, width: 40),
      WaterDropParam(top: 140, height: 50, left: 15, width: 40),
      WaterDropParam(top: 20, height: 30, left: 200, width: 30),
      WaterDropParam(top: 120, height: 20, left: 360, width: 20),
    ],
  );
}

Or if you want a single drop, use WaterDrop.single:

@override
Widget build(BuildContext context) {
  return WaterDrop.single(
    top: 50,
    height: 70,
    left: 100,
    width: 50,
    child: _StaticCard(color: Colors.green),
  );
}

[1.0.0] - 23.03.2020 #

  • Initial release

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Water drop',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: WaterDrop(
          params: [
            WaterDropParam(top: 6, height: 40, left: 6, width: 60),
            WaterDropParam(top: 16, height: 30, left: 100, width: 20),
          ],
          child: Container(
            color: Colors.blue,
            padding: const EdgeInsets.all(16),
            child: Text('Water drop'),
          ),
        ),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            MyCard(color: Colors.green),
            MyCard(color: Colors.yellow),
            MyCard(color: Theme.of(context).cardColor),
            MyCard(color: Colors.orange),
          ],
        ),
      ),
    );
  }
}

class MyCard extends StatefulWidget {
  final Color color;

  const MyCard({Key key, this.color = Colors.green}) : super(key: key);

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

class _MyCardState extends State<MyCard> with SingleTickerProviderStateMixin {
  AnimationController _animationController;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(
      vsync: this,
      duration: Duration(milliseconds: 1000),
    )..repeat(reverse: true);
  }

  @override
  void dispose() {
    _animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return AnimatedBuilder(
      animation: _animationController,
      builder: (context, child) {
        final move = _animationController.value * 40;
        return WaterDrop(
          child: child,
          params: [
            WaterDropParam(top: 50 + move, height: 70, left: 100, width: 50),
            WaterDropParam(top: 10 + move, height: 100, left: 280, width: 100),
            WaterDropParam(top: 155 + move, height: 35, left: 135, width: 35),
            WaterDropParam(top: 135 + move, height: 40, left: 250, width: 30),
            WaterDropParam(top: 20 + move, height: 40, left: 20, width: 40),
            WaterDropParam(top: 140 + move, height: 50, left: 15, width: 40),
            WaterDropParam(top: 20 + move, height: 30, left: 200, width: 30),
            WaterDropParam(top: 120 + move, height: 20, left: 360, width: 20),
          ],
        );
      },
      child: _StaticCard(color: widget.color),
    );
  }
}

class _StaticCard extends StatelessWidget {
  final Color color;

  const _StaticCard({Key key, this.color = Colors.green}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Card(
      color: color,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          children: <Widget>[
            Text(
                'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'),
            RaisedButton(
              color: Colors.blue,
              textColor: Colors.white,
              child: Text('Press me'),
              onPressed: () {},
            )
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  water_drop: ^1.0.0

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:water_drop/water_drop.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
98
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance suggestions

The package description is too short. (-2 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

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