FunnelChart constructor
FunnelChart({
- Key? key,
- required int layerCount,
- required int markerCount,
- required BrnFunnelLayerPainter layerPainter,
- required MarkerBuilder builder,
- FunnelShape shape = FunnelShape.leftAndRight,
- double maxLayerWidth = 200,
- double minLayerWidth = 0,
- double layerHeight = 40,
- double layerMargin = 0,
- Offset childOffset = Offset.zero,
- MarkerAlignment alignment = MarkerAlignment.right,
Implementation
FunnelChart({
Key? key,
required this.layerCount,
required this.markerCount,
required this.layerPainter,
required MarkerBuilder builder,
this.shape = FunnelShape.leftAndRight,
this.maxLayerWidth = 200,
this.minLayerWidth = 0,
this.layerHeight = 40,
this.layerMargin = 0,
this.childOffset = Offset.zero,
this.alignment = MarkerAlignment.right,
}) : assert(maxLayerWidth >= minLayerWidth),
assert(layerCount - markerCount == 0 || layerCount - markerCount == 1),
assert(() {
if (shape == FunnelShape.leftOrRight &&
alignment == MarkerAlignment.center) {
debugPrint(
'当shape为FunnelShape.LeftOrRight时,alignment为MarkerAlignment.center无效');
}
return true;
}()),
super(
key: key,
children: () {
List<Widget> children = [];
for (int i = 0; i < markerCount; i++) {
children.add(builder(i));
}
return children;
}());