kline_chart 0.0.1+2 copy "kline_chart: ^0.0.1+2" to clipboard
kline_chart: ^0.0.1+2 copied to clipboard

flutter kline chart plugin

kline chart #

flutter kline chart plugin #

Demo Gif

Usage

import 'package:flutter/material.dart';
import 'package:flutter_kline/flutter_kline.dart';


class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  bool _showTimeChart = false;

  @override
  initState() {
    super.initState();

    // setup kline data
    _loadJson().then((value) {
      KLineController.shared.data = value;
      setState(() {});
    });
  }

  Future<List<KLineData>> _loadJson() async {
    final jsonStr = await rootBundle.loadString('lib/kline.json');
    List jsonList = json.decode(jsonStr);
    List<KLineData> dataList = [];
    for (var data in jsonList) {
      var klineData = KLineData()
        ..open = double.parse(data[1] ?? '0')
        ..high = double.parse(data[2] ?? '0')
        ..low = double.parse(data[3] ?? '0')
        ..close = double.parse(data[4] ?? '0')
        ..volume = double.parse(data[5] ?? '0')
        ..time = data[6] ?? 0;

      dataList.add(klineData);
    }
    return dataList;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Center(
            child: Container(
                width: MediaQuery.of(context).size.width,
                height: 400,
                decoration: const BoxDecoration(border: Border.symmetric(horizontal: BorderSide(color: Colors.black))),
                child: KLineView()
            )
        )
    );
  }
}

Todo:

  • MA indicator

  • EMA indicator

  • Boll indicator

  • VOL sub indicator

  • KDJ sub indicator

  • WR sub indicator

  • OBV indicator

  • Y-axis ruler text

  • Long press info display

  • Improve accuracy

  • current price

  • Time Chart

  • Publish to pub.dev

  • Improve scale gesture

  • MACD sub indicator

  • RSI sub indicator

  • SAR indicator

  • Highly customized

  • Fit all screens

  • Performance optimization

  • Finish usage document

2
likes
140
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

flutter kline chart plugin

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on kline_chart