preface

Every time I encounter a problem, I Google for the answer. I am used to being a helper for many years. How happy it is. Recently, I learned to learn Flutter when I was free. As an Android developer, I felt the rush of IOS development. Learning about Flutter is actually quite easy compared to Android.

background

I am very interested in financial products, so I decided to write a K-line component to practice. If it goes well, then access to trade yourself.

Feature

  • Candle drawing
  • Volume chart
  • MACD indicator chart, other indicator chart can be extended
  • Common channels such as MA, EMA and BOLL can be drawn on the candle diagram
  • Signal processing
    • Horizontal sliding treatment
    • Zoom processing
    • Long press processing
  • Custom scribing function

Self-reflection before action

  1. How do I save the states?
  2. What are the ways to customize widgets?
  3. How should touchEvents in Flutter be handled?

Problem 1: Creating a Flutter project generates a Flutter Hello World snippet by default. First of all to learn is StatelessWidget StatefulWidget. StatefulWidget is specifically designed to store state, but StatefulWidget has its limitations and can be complex to transfer state across components. Therefore, I use a Provider as the manager of the state machine to facilitate cross-component communication. Q2: Flutter creates the CustomPainter class to make it easier to customize widgets. The paint function can be overridden with Flutter, which is very convenient and user-friendly. I chose not to draw the image directly with CustomPainter for the time being. The three core trees of Flutter are the Widget tree, Element tree and RenderObject tree. To facilitate learning, RenderObject is used for rendering. Q.3: Check that flutter provides a GestureDetector to recognize gestures. For the time being, the GestureDetector is used to implement this gesture. However, we need to learn how to handle this gesture.

conclusion

Because it is the first article will not post code, do a simple narrative good.