小编key*_*key的帖子

在flutter中调用多个不同的图表-Charts_flutter 0.5.0程序包

我有一个来自Charts_flutter 0.5.0包的简单条形图,我想在另一个页面中调用它,或者我的目标是在其中添加更多的图,例如饼图和其他一些图。

 Widget build(BuildContext context) {

    List<Series> seriesList;

    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        title: Text(
          "Charts",
          style: TextStyle(color: Colors.blueGrey),
          textAlign: TextAlign.center,
        ),
        backgroundColor: Colors.transparent,
        iconTheme: IconThemeData(color: Colors.blueGrey),
      ),
      body: ListView(
        children: <Widget>[
          SimpleBarChart(seriesList), //<-- I've added this line
        ],
      ),
    );
  }
Run Code Online (Sandbox Code Playgroud)

图表的代码是这样:在此处查找更多信息:https : //google.github.io/charts/flutter/gallery.html

/// Bar chart example
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:flutter/material.dart';

class SimpleBarChart extends StatelessWidget {
  final List<charts.Series> seriesList;
  final bool animate;

  SimpleBarChart(this.seriesList, {this.animate});

  /// Creates a [BarChart] with sample data and no transition. …
Run Code Online (Sandbox Code Playgroud)

charts package flutter

1
推荐指数
1
解决办法
1646
查看次数

标签 统计

charts ×1

flutter ×1

package ×1