gaugeanimated 0.7.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

gaugeanimated #

A flutter plugin to facilitate the creation of graphic gauge.

Example use

Getting Started #

You should ensure that you add the following dependency in your Flutter project.

dependencies:
 gaugeanimated: ^0.6.2

You should then run flutter packages upgrade or update your packages in IntelliJ.

In your Dart code, to use it:

import 'package:gaugeanimated/gaugeanimated.dart';

Example #

An example can be found in the example folder. Check it out.

import 'package:flutter/material.dart';
import 'package:gaugeanimated/gaugeanimated.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: 'Example gaugeanimated',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Example gaugeanimated'),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  Driver driver = new Driver();

  void _incrementCounter() {
    setState(() {
      driver.add(10);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              child: GaugeAnimated.build(
                driver: driver,
                centerWidget: Text(driver.getValue.toString() + "%"),
                fullColor: Colors.black,
                percentColor: Colors.indigo[400].withOpacity(0.8),
                fullWidth: 4,
                percentWidth: 10),
            ),
            Container(
              child: GaugeAnimated.build(
                driver: driver,
                centerWidget: exampleWidget(),
                fullColor: Colors.black,
                percentColor: Colors.red,
                fullWidth: 15,
                percentWidth: 4),
            )
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }

  Widget exampleWidget(){
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text("Example Test"),
        Text("Current Percentage: " + driver.getValue.toString() + "%"),
        Text("Change your text"),
      ],
    );
  }
}

0.7.1 #

  • Added the option to resize the indicator using the "diameter" property.
  • Added the option to use gradient colors using "percentColorGradient" and "fullColorGradient".

0.6.1 #

  • Documentation update.
  • Added usage example.

0.5.1 #

  • Adjustment on unused statements.

0.0.1 #

  • Initial package launch.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:example/gaugeanimated.dart';
import 'dart:math';

import 'package:gaugeanimated/gaugeanimated.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: 'Example gaugeanimated',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Example gaugeanimated'),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  Driver driver = new Driver();

  void _incrementCounter() {
    setState(() {
      driver.add(10);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Container(
              child: GaugeAnimated.build(
                driver: driver,
                centerWidget: Text(driver.getValue.toString() + "%"),
                fullColor: Colors.black,
                percentColor: Colors.indigo[400].withOpacity(0.8),
                fullWidth: 4,
                percentWidth: 10,
              ),
            ),
            Container(
                child: GaugeAnimated.build(
                    driver: driver,
                    centerWidget: exampleWidget(),
                    fullColor: Colors.black,
                    percentColor: Colors.red,
                    fullWidth: 10,
                    percentWidth: 4,
                    diameter: 280,
                    percentColorGradient: new SweepGradient(
                      tileMode: TileMode.mirror,
                      colors: [
                        Colors.red,
                        Colors.blue,
                      ],
                      startAngle: 25 * (2 * pi / 60),
                      endAngle: 40 * (2 * pi / 60)
                    ))),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }

  Widget exampleWidget() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text("Example Test"),
        Text("Current Percentage: " + driver.getValue.toString() + "%"),
        Text("Change your text"),
      ],
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  gaugeanimated: ^0.7.1

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:gaugeanimated/gaugeanimated.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
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]
73
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • gaugeanimated that is a package requiring null.

Health suggestions

Format lib/gaugeanimated.dart.

Run flutter format to format lib/gaugeanimated.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test