ai_chart 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

ai_chart #

totem


English Document中文文档

我们的宗旨是:帮助开发者更加便利开发、切身体会编程之美! #

ai_chart: #

pub package

ai_chart项目中的实战应用flutter sample

效果图 #

iOSAndroid
ai_chart->iosai_chart->android
:-:-
macOSweb
ai_chart->macOSai_chart->web
:-:-

1.安装 #

使用当前包作为依赖库

1. 依赖此库 #

在文件 'pubspec.yaml' 中添加

pub package


dependencies:

  ai_chart: ^version

或以这种方式添加


  # chart package.
  ai_chart:
    git:
      url: https://github.com/pdliuw/ai_chart.git

2. 安装此库 #

你可以通过下面的命令行来安装此库


$ flutter pub get


你也可以通过项目开发工具通过可视化操作来执行上述步骤

3. 导入此库 #

现在,在你的Dart编辑代码中,你可以使用:


import 'package:ai_chart/ai_chart.dart';

2.使用 #


            Container(
              width: 150,
              height: 150,
              margin: EdgeInsets.all(10),
              child: AirPieChart(
                size: Size(100, 100),
                roundCap: false,
                filled: false,
                useCenter: false,
                pieChartData: [
                  AirChartData(
                    value: _valueFirst,
                    color: Colors.orange,
                  ),
                  AirChartData(
                    value: _valueSecond,
                    color: Colors.green,
                  ),
                  AirChartData(
                    value: _valueThird,
                    color: Colors.red,
                  ),
                ],
                value: 50,
                valueStrokeWidth: 20,
                pathStrokeWidth: 20,
              ),
            ),

*6、更多用法点击,查看更多

LICENSE #

BSD 3-Clause License

Copyright (c) 2020, pdliuw
All rights reserved.

[0.0.2] - update example #

  • initial.

[0.0.1] - initial #

  • initial.

example/lib/main.dart

import 'package:ai_chart/ai_chart.dart';
import 'package:flutter/material.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: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  double _min = 0;
  double _max = 100;
  double _valueFirst = 50;
  double _valueSecond = 50;
  double _valueThird = 50;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Spacer(),
            Spacer(),
            Spacer(),
            Container(
              width: 150,
              height: 150,
              margin: EdgeInsets.all(10),
              child: AirPieChart(
                size: Size(100, 100),
                roundCap: false,
                filled: false,
                useCenter: false,
                pieChartData: [
                  AirChartData(
                    value: _valueFirst,
                    color: Colors.orange,
                  ),
                  AirChartData(
                    value: _valueSecond,
                    color: Colors.green,
                  ),
                  AirChartData(
                    value: _valueThird,
                    color: Colors.red,
                  ),
                ],
                value: 50,
                valueStrokeWidth: 20,
                pathStrokeWidth: 20,
              ),
            ),
            Spacer(),
            Spacer(),
            Row(
              children: [
                Expanded(
                  child: Slider(
                      min: _min,
                      max: _max,
                      value: _valueFirst,
                      onChanged: (double value) {
                        setState(() {
                          _valueFirst = value.toInt().toDouble();
                        });
                      }),
                ),
                Text("$_valueFirst"),
                Container(
                  width: 20,
                ),
              ],
            ),
            Spacer(),
            Row(
              children: [
                Expanded(
                  child: Slider(
                      min: _min,
                      max: _max,
                      value: _valueSecond,
                      onChanged: (double value) {
                        setState(() {
                          _valueSecond = value.toInt().toDouble();
                        });
                      }),
                ),
                Text("$_valueSecond"),
                Container(
                  width: 20,
                ),
              ],
            ),
            Spacer(),
            Row(
              children: [
                Expanded(
                  child: Slider(
                      min: _min,
                      max: _max,
                      value: _valueThird,
                      onChanged: (double value) {
                        setState(() {
                          _valueThird = value.toInt().toDouble();
                        });
                      }),
                ),
                Text("$_valueThird"),
                Container(
                  width: 20,
                ),
              ],
            ),
            Spacer(),
            Spacer(),
            Spacer(),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  ai_chart: ^0.0.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:ai_chart/ai_chart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [ai_chart] that is in a package requiring null.

Health suggestions

Fix lib/src/pie_chart.dart. (-1 points)

Analysis of lib/src/pie_chart.dart reported 2 hints:

line 21 col 7: The value of the field '_value' isn't used.

line 149 col 7: The value of the field '_min' isn't used.

Format lib/src/chart_data_model.dart.

Run flutter format to format lib/src/chart_data_model.dart.

Maintenance suggestions

The package description is too short. (-20 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.

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.

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