ep_signalbar 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 58

ep_signalbar #

Flutter widget to create signal bar, you can render signal-bar ui for your flutter project with this widget.

Usage #

To use this plugin, add ep_signalbar as a dependency in your pubspec.yaml file.

Preview #

Image of Signalbar

Example #

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

void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Eduprog Signalbar Demo',
      home: MyHomePage(),
    );
  }
}
class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

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

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

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

class _MyHomePageState extends State<MyHomePage> {
  EPSignalBar _sb1 = EPSignalBar(initBarValue: 5,);
  EPSignalBar _sb2 = EPSignalBar(
    barHeight: 100,
    barWidth: 200,
    barCount: 10,
    initBarValue: 8,
    animationCurve: Curves.easeOut,
    animationDuration: Duration(milliseconds: 200),
    barOnlineColor: Colors.blue,
    barOfflineColor: Colors.grey,
    barBorderColor: Colors.blue,
    barBackgroundColor: Colors.white.withOpacity(0.6),
  );
  EPSignalBar _sb3 = EPSignalBar(
    barHeight: 50,
    barWidth: 100,
    barCount: 4,
    initBarValue: 2,
    barOnlineColor: Colors.orangeAccent,
  );
  EPSignalBar _sb4 = EPSignalBar(
    barHeight: 50,
    barWidth: 100,
    barCount: 4,
  );
  EPSignalBar _sb5 = EPSignalBar(
    barHeight: 100,
    barWidth: 300,
    barCount: 15,
    initBarValue: 3,
    animationCurve: Curves.easeOut,
    animationDuration: Duration(milliseconds: 200),
    barOnlineColor: Colors.redAccent,
    barBackgroundColor: Colors.white.withOpacity(0.6),
  );

  EPSignalBar _sb6 = EPSignalBar(
    barHeight: 100,
    barWidth: 300,
    barCount: 10,
    initBarValue: 7,
    animationDuration: Duration(milliseconds: 200),
    barOnlineColor: Colors.green,
    barBackgroundColor: Colors.grey.withOpacity(0.4),
    barBorderColor: Colors.green,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            FlatButton(
              child: Text("Set Bar Change"),
              color: Colors.red,
              onPressed: (){
                if (_sb1.state.getBarNumber() > 0){
                  _sb1.state.setBarNumber(_sb1.state.getBarNumber() - 1);
                }else{
                  _sb1.state.setBarNumber(5);
                }

              },
            ),
            _sb1,
            _sb2,
            _sb3,
            _sb4,
            _sb5,
            _sb6
          ],
        ),
      ), 
    );
  }
}

Cheers #

A.M Hirin

(eduprog.net)

[0.0.1] - 2020-01-24. #

First release of component

[0.0.2] - 2020-01-24. #

Update readme

[0.0.3] - 2020-01-29. #

Update example

example/lib/main.dart

import 'dart:async';
import 'dart:ui';

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


void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Eduprog Signalbar Demo',
      home: MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}
class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

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

class _MyHomePageState extends State<MyHomePage> {
  EPSignalBar _sb1 = EPSignalBar(initBarValue: 5,);
  EPSignalBar _sb2 = EPSignalBar(
    barHeight: 100,
    barWidth: 200,
    barCount: 10,
    initBarValue: 8,
    animationCurve: Curves.easeOut,
    animationDuration: Duration(milliseconds: 200),
    barOnlineColor: Colors.blue,
    barOfflineColor: Colors.grey,
    barBorderColor: Colors.blue,
    barBackgroundColor: Colors.white.withOpacity(0.3),
  );
  EPSignalBar _sb3 = EPSignalBar(
    barHeight: 50,
    barWidth: 100,
    barCount: 4,
    initBarValue: 2,
    barOnlineColor: Colors.orangeAccent,
  );
  EPSignalBar _sb4 = EPSignalBar(
    barHeight: 50,
    barWidth: 100,
    barCount: 4,
    barOnlineColor: Colors.purple,
    barOfflineColor: Colors.black,
  );
  EPSignalBar _sb5 = EPSignalBar(
    barHeight: 100,
    barWidth: 300,
    barCount: 15,
    initBarValue: 3,
    animationCurve: Curves.easeOut,
    animationDuration: Duration(milliseconds: 200),
    barOnlineColor: Colors.redAccent,
    barBackgroundColor: Colors.white.withOpacity(0.6),
  );

  EPSignalBar _sb6 = EPSignalBar(
    barHeight: 100,
    barWidth: 300,
    barCount: 10,
    initBarValue: 7,
    animationDuration: Duration(milliseconds: 200),
    barOnlineColor: Colors.green,
    barBackgroundColor: Colors.grey.withOpacity(0.4),
    barBorderColor: Colors.green,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: SingleChildScrollView(
          child: Column(
            children: <Widget>[
              Center(
                child: Column(

                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  mainAxisSize: MainAxisSize.max,

                  children: <Widget>[
                    Container(
                      padding: EdgeInsets.only(top: 20),
                      child: Text("Eduprog Widget Signalbar", style: TextStyle(color: Colors.red, fontSize: 20, fontWeight: FontWeight.bold),),
                    ),
                    _sb1,
                    _sb2,
                    _sb3,
                    _sb4,
                    _sb6
                  ],
                ),
              ),
              Container(
                height: 300,
                child: _sb5,

              )
            ],
          ),
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }

  @override
  void initState() {
    Timer.periodic(Duration(milliseconds: 200), (timer) {
      if (_sb2.state.getBarNumber() > 1){
        _sb2.state.setBarNumber(_sb2.state.getBarNumber() - 1);
      }else{
        _sb2.state.setBarNumber(_sb2.barCount);
      }

      if (_sb5.state.getBarNumber() > 1){
        _sb5.state.setBarNumber(_sb5.state.getBarNumber() - 1);
      }else{
        _sb5.state.setBarNumber(_sb5.barCount);
      }

    });
    Timer.periodic(Duration(milliseconds: 1000), (timer) {
      if (_sb3.state.getBarNumber() == 3){
        _sb3.state.setBarNumber(2);
      }else{
        _sb3.state.setBarNumber(3);
      }

      if (_sb4.state.getBarNumber() > 1){
        _sb4.state.setBarNumber(_sb4.state.getBarNumber() - 1);
      }else{
        _sb4.state.setBarNumber(_sb4.barCount);
      }

      if (_sb6.state.getBarNumber() == 2){
        _sb6.state.setBarNumber(4);
      }else if (_sb6.state.getBarNumber() == 4){
        _sb6.state.setBarNumber(10);
      }else if (_sb6.state.getBarNumber() == 10){
        _sb6.state.setBarNumber(5);
      }else if (_sb6.state.getBarNumber() == 5){
        _sb6.state.setBarNumber(0);
      }else{
        _sb6.state.setBarNumber(2);
      }

      if (_sb5.barHeight > 200){
        _sb5.state.setWidgetHeight(200);
      }else{
        _sb5.state.setWidgetHeight(250);
      }
    });

    super.initState();
  }

  @override
  void setState(fn) {
    if(mounted){
      super.setState(fn);
    }
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  ep_signalbar: ^0.0.3

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

We analyzed this package on Apr 6, 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

Fix lib/ep_signalbar.dart. (-0.50 points)

Analysis of lib/ep_signalbar.dart reported 1 hint:

line 6 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: EPSignalBar.barOnlineColor, EPSignalBar.barOfflineColor, EPSignalBar.barBackgroundColor, EPSignalBar.barBorderColor, EPSignalBar.barCount, EPSignalBar.initBarValue, EPSignalBar.barHeight, EPSignalBar.barWidth, EPSignalBar.animationDuration, EPSignalBar.animationCurve, EPSignalBar.state

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.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

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.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test