weather_widget 1.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

weather_widget #

Simple weather related widget, which can be freely combined to form a variety of weather backgrounds

chinese 中文README

Getting Started #

depend

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

dependencies:
  weather_widget: ^1.0.5

Weatherwidget is easy to use, just add weatherwidget to start using

WeatherWidget(
             size:Size.infinite,
             weather:'Sunny',
             sunConfig:SunConfig()
         ),   

This will add a sunny day using the default settings
sunny
or other weather type
(Note: Raindrops and snowflakes need to specify the default number, and they will move randomly within the range)

WeatherWidget(
             size:Size.infinite,
             weather:'Cloudy',
             cloudConfig:CloudConfig()
         ),

WeatherWidget(
             size:Size.infinite,
             weather:'Rainy',
             rainConfig:RainConfig(
              rainNum:'the num of raindrops you want' 
             )
         ),


WeatherWidget(
             size:Size.infinite,
             weather:'Snowy',
             snowConfig:SnowConfig(
              snowNum:'the num of snowflakes you want' 
             )
         ),


WeatherWidget(
             size:Size.infinite,
             weather:'Thunder',
             thunderConfig:ThunderConfig()
         ),

rainy snowy thunder

Of course, each config contains other settings, such as the range, size, length, falling speed and color of random raindrops. You can use them to create hailstones and other weather features
If the default weather is not enough, you can use individual widgets and stack() widget to piece together the desired weather
Like this sunset breeze, etc
sunset breeze snow with rain thunder with rain
These are include in this widget
background

    BackgroundWidget(List<Color>,size)

cloud

    CloudWidget (Color)

A single random raindrop

RainWidget (
                         @required rainRangeXStart, #X-axis starting point of raindrop random occurrence
                         @required rainRangeXEnd,  
                         @required rainRangeYStart,
                         @required rainRangeYEnd,
                         @required durationRangeStartMill,  #Minimum time to fall
                         @required durationRangeEndMill,    
                         rainLength,
                         rainWidth,
                         rainColor,
                         rainCurve  #Curve of falling animation
                         )

A single random snowflake

SnowWidget (
                         this.snowAreaXStart,  #X-axis starting point of snowflake random occurrence
                         this.snowAreaXEnd,    
                         this.snowWaveRangeMin,    #The minimum floating distance of snowflakes
                         this.snowWaveRangeMax,    
                         this.snowFallSecMin,  #Minimum time of snowflake falling
                         this.snowFallSecMax,  
                         this.snowWaveSecMin,  #Minimum time for snowflake to float
                         this.snowWaveSecMax,
                         this.snowSize,
                         this.snowColor,
                         this.snowAreaYStart,   #Y-axis point of snowflake occurrence
                         this.snowAreaYEnd,    
                         this.waveCurve,        #Floating animation curve
                         this.fadeCurve         #Vanish animation curve
)

A single flash

ThunderWidget (
                         this.flashMillStart,   #Minimum flashing time
                         this.flashMillEnd,     
                         this.pauseMillStart,   #Minimum interval time
                         this.pauseMillEnd,     
                         this.blurStyle,        #blur model
                         this.blurSigma,        
                         this.points,
                         this.color,
                         this.width
)

a single wind

WindWidget (
                        this.pauseMillStart,    #Minimum interval time
                        this.pauseMillEnd,     
                        this.windPositionY,     #Y-axis point of wind occurrence
                        this.windSlideMill,     #Passing time
                        this.windColor,
                        this.windWidth,
                        this.windSlideXEnd,     
                        this.windSlideXStart,   
                        this.windGap,           #line spacing in a wind
                        this.blurStyle,
                        this.blurSigma
)

Using sunny weather by set the WeatherWidget background config in a sunConfig()

1.0.0 #

  • Initial version, created by Conor

1.0.1 #

  • fix some pub said issues

1.0.3 #

  • fix a bug in thunderConfig width

1.0.4 #

  • fix example

1.0.5 #

-fix some controller dispose

example/main.dart

import 'package:flutter/material.dart';
import 'package:weather_widget/WeatherWidget.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: WeatherWidget(
          size: Size.infinite,
          weather: 'Thunder',
          thunderConfig:ThunderConfig(
            thunderWidth:12
          )
    )
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  weather_widget: ^1.0.5

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:weather_widget/WeatherWidget.dart';
import 'package:weather_widget/example/main.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
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]
50
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

Health suggestions

Format lib/example/main.dart.

Run flutter format to format lib/example/main.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cupertino_icons ^0.1.2 0.1.3
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