FunnelChart.defaultStyle constructor

FunnelChart.defaultStyle({
  1. Key? key,
  2. required int layerCount,
  3. required int markerCount,
  4. required MarkerBuilder builder,
  5. double maxLayerWidth = 200,
  6. double minLayerWidth = 0,
  7. double layerHeight = 40,
  8. double layerMargin = 0,
  9. Offset childOffset = Offset.zero,
})

漏斗图默认Bruno风格的命名构造函数,layerCount不能大于defaultLayerColors.length

Implementation

FunnelChart.defaultStyle({
  Key? key,
  required this.layerCount,
  required this.markerCount,
  required MarkerBuilder builder,
  this.maxLayerWidth = 200,
  this.minLayerWidth = 0,
  this.layerHeight = 40,
  this.layerMargin = 0,
  this.childOffset = Offset.zero,
})  : this.layerPainter = BrnDefaultFunnelLayerPainter(),
      this.shape = FunnelShape.leftAndRight,
      this.alignment = MarkerAlignment.right,
      assert(layerCount <= defaultLayerColors.length && layerCount >= 0),
      assert(maxLayerWidth >= minLayerWidth),
      assert(layerCount - markerCount == 0 || layerCount - markerCount == 1),
      super(
          key: key,
          children: () {
            List<Widget> children = [];
            for (int i = 0; i < markerCount; i++) {
              children.add(builder(i));
            }
            return children;
          }());