基于?syncfusion_flutter_charts 統(tǒng)計圖表進行的調(diào)整
我遇到的問題是 使用 syncfusion_flutter_charts 統(tǒng)計圖數(shù)據(jù)多的話需要左右可以滑動,但是假如在list里面,syncfusion_flutter_charts 圖標的滑動手勢優(yōu)先級高于 界面本身list的滑動。這就導(dǎo)致在手指碰觸到統(tǒng)計圖表滑動界面的時候滑不動。
基于這個情況,針對syncfusion_flutter_charts源碼進行分析得出圖標上添加了橫向滑動和縱向滑動的手勢。他們是統(tǒng)一添加到圖標上的,針對該情況,對源碼進行的調(diào)整,把界面上添加的手勢全部給放出來,這樣可以針對性對弄個手勢進行禁用或啟用。方便使用
改造后的插件地址??https://gitee.com/breakfly/syncfusion_flutter_charts.git
本插件使用了是?syncfusion_flutter_charts 26.1.41為依托修改的,在flutter 3.22.0一下版本的時候會出現(xiàn)syncfusion_flutter_core 中 colorTheme報錯的問題。原因是找不到對應(yīng)的參數(shù)。針對這個我進行了統(tǒng)一改成統(tǒng)一顏色值處理 在 packages/syncfusion_flutter_core 中
添加插件
syncfusion_flutter_charts:
? ? git:
? ? ? url: https://gitee.com/breakfly/syncfusion_flutter_charts.git
? ? ? path: packages/syncfusion_flutter_charts
實例
SfCartesianChart(
? ? ? ? ? ? ? plotAreaBorderWidth: 0,
? ? ? ? ? ? ? primaryXAxis: const CategoryAxis(
? ? ? ? ? ? ? ? autoScrollingDelta: 10,
? ? ? ? ? ? ? ? majorGridLines: MajorGridLines(dashArray: [5, 5]),
? ? ? ? ? ? ? ),
? ? ? ? ? ? ? primaryYAxis: const NumericAxis(
? ? ? ? ? ? ? ? minimum: 0,
? ? ? ? ? ? ? ? interval: 20,
? ? ? ? ? ? ? ? majorGridLines: MajorGridLines(dashArray: [5, 5]),
? ? ? ? ? ? ? ),
? ? ? ? ? ? ? tooltipBehavior: TooltipBehavior(enable: true),
? ? ? ? ? ? ? zoomPanBehavior:
? ? ? ? ? ? ? ? ? CustomPanBehavior(panDirection: AxisOrientation.horizontal),
? ? ? ? ? ? ? margin: EdgeInsets.fromLTRB(10, 30.w, 20, 10),
? ? ? ? ? ? ? series: <CartesianSeries<CheckModel, dynamic>>[
? ? ? ? ? ? ? ? // Renders line chart
? ? ? ? ? ? ? ? ColumnSeries<CheckModel, dynamic>(
? ? ? ? ? ? ? ? ? ? dataSource: [
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 12, text: "12月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 20, text: "11月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 18, text: "10月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 17, text: "9月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "8月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "7月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "6月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "5月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "4月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "3月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "2月"),
? ? ? ? ? ? ? ? ? ? ? CheckModel(id: 22, text: "1月")
? ? ? ? ? ? ? ? ? ? ],
? ? ? ? ? ? ? ? ? ? name: '簽約',
? ? ? ? ? ? ? ? ? ? gradient: const LinearGradient(
? ? ? ? ? ? ? ? ? ? ? ? begin: Alignment.bottomCenter,
? ? ? ? ? ? ? ? ? ? ? ? end: Alignment.topCenter,
? ? ? ? ? ? ? ? ? ? ? ? colors: [Color(0xffffffff), Color(0xff0772D8)]),
? ? ? ? ? ? ? ? ? ? markerSettings: const MarkerSettings(isVisible: false),
? ? ? ? ? ? ? ? ? ? xValueMapper: (CheckModel sales, _) => sales.text,
? ? ? ? ? ? ? ? ? ? yValueMapper: (CheckModel sales, _) => sales.id),
? ? ? ? ? ? ? ]),