KChartWidget constructor
KChartWidget(
- List<
KLineEntity> ? datas, { - ChartStyle? chartStyle,
- ChartColors? chartColors,
- bool enableTheme = true,
- required bool isTrendLine,
- double xFrontPadding = 100,
- MainState mainState = MainState.MA,
- SecondaryState secondaryState = SecondaryState.MACD,
- dynamic onSecondaryTap()?,
- bool volHidden = false,
- bool isLine = false,
- bool isTapShowInfoDialog = false,
- bool hideGrid = false,
- bool isChinese = false,
- bool showNowPrice = true,
- bool showInfoDialog = true,
- bool materialInfoDialog = true,
- Map<
String, ChartTranslations> translations = kChartTranslations, - List<
String> timeFormat = TimeFormat.YEAR_MONTH_DAY, - dynamic onLoadMore()?,
- int fixedLength = 2,
- List<
int> maDayList = const [5, 10, 20], - int flingTime = 350,
- double flingRatio = 0.9,
- Curve flingCurve = Curves.easeOutCubic,
- dynamic isOnDrag()?,
- VerticalTextAlignment verticalTextAlignment = VerticalTextAlignment.left,
- bool enableDrawingTools = false,
- DrawingToolManager? drawingToolManager,
- double minScale = 0.1,
- double maxScale = 5.0,
- double scaleAnimationDuration = 300.0,
- Curve scaleAnimationCurve = Curves.easeOutCubic,
- bool enableScaleAnimation = true,
- dynamic onScaleChanged()?,
- bool enableBoundaryFeedback = true,
- double scaleSensitivity = 2.5,
- bool enableScaleCenterPoint = true,
- KChartController? controller,
- bool enablePerformanceMode = false,
- bool enablePinchZoom = true,
- bool enableScrollZoom = true,
- double scrollZoomFactor = 1.1,
- bool enableScaleHapticFeedback = true,
- dynamic onCrossLineTap(
- double price
- bool enableHapticFeedback = true,
- bool longPressHaptic = true,
- bool crossLineTapHaptic = true,
- bool scaleHaptic = false,
- bool boundaryHaptic = true,
Implementation
KChartWidget(
this.datas, {
this.chartStyle,
this.chartColors,
this.enableTheme = true, // 默认启用主题系统
required this.isTrendLine,
this.xFrontPadding = 100,
this.mainState = MainState.MA,
this.secondaryState = SecondaryState.MACD,
this.onSecondaryTap,
this.volHidden = false,
this.isLine = false,
this.isTapShowInfoDialog = false,
this.hideGrid = false,
this.isChinese = false,
this.showNowPrice = true,
this.showInfoDialog = true,
this.materialInfoDialog = true,
this.translations = kChartTranslations,
this.timeFormat = TimeFormat.YEAR_MONTH_DAY,
this.onLoadMore,
this.fixedLength = 2,
this.maDayList = const [5, 10, 20],
this.flingTime = 350, // 更短惯性动画
this.flingRatio = 0.9, // 更自然的惯性距离
this.flingCurve = Curves.easeOutCubic, // 丝滑曲线
this.isOnDrag,
this.verticalTextAlignment = VerticalTextAlignment.left,
// 绘图工具配置
this.enableDrawingTools = false, // 默认关闭绘图工具
this.drawingToolManager,
// 缩放配置参数
this.minScale = 0.1,
this.maxScale = 5.0,
this.scaleAnimationDuration = 300.0,
this.scaleAnimationCurve = Curves.easeOutCubic,
this.enableScaleAnimation = true,
this.onScaleChanged,
this.enableBoundaryFeedback = true,
this.scaleSensitivity = 2.5, // 默认提升灵敏度
this.enableScaleCenterPoint = true,
this.controller,
this.enablePerformanceMode = false, // 默认关闭性能模式
// 双指缩放和滚轮缩放配置
this.enablePinchZoom = true, // 默认启用双指缩放
this.enableScrollZoom = true, // 默认启用滚轮缩放
this.scrollZoomFactor = 1.1, // 滚轮缩放倍数
this.enableScaleHapticFeedback = true, // 默认启用触觉反馈
this.onCrossLineTap, // 新增:十字线点击回调
// 新增:震动效果配置
this.enableHapticFeedback = true, // 默认启用震动反馈
this.longPressHaptic = true, // 默认长按震动
this.crossLineTapHaptic = true, // 默认点击十字线标签震动
this.scaleHaptic = false, // 默认缩放不震动(避免过于频繁)
this.boundaryHaptic = true, // 默认边界震动
});