Skip to content

Commit 9534c24

Browse files
Merge pull request #3 from merixstudio/feature/doc
Add documentation
2 parents 70a2895 + a8137b7 commit 9534c24

File tree

61 files changed

+701
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+701
-5
lines changed

lib/mrx_charts.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
library mrx_charts;
2+
13
export 'src/chart.dart';
24
export 'src/models/animation/chart_animation.dart';
35
export 'src/models/axis/chart_axis_layer.dart';
@@ -19,5 +21,5 @@ export 'src/models/touchable/arc_shape.dart';
1921
export 'src/models/touchable/rectangle_shape.dart';
2022
export 'src/models/touchable/touchable_shape.dart';
2123
export 'src/painter/chart_painter.dart';
24+
export 'src/touch/chart_touch_callback_data.dart';
2225
export 'src/touch/chart_touch_detector.dart';
23-
export 'src/touch/stock_touch_callback_data.dart';

lib/src/chart.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ import 'package:mrx_charts/src/models/chart_layer.dart';
33
import 'package:mrx_charts/src/models/touchable/touchable_shape.dart';
44
import 'package:mrx_charts/src/painter/chart_painter.dart';
55
import 'package:mrx_charts/src/touch/chart_touch_detector.dart';
6-
import 'package:mrx_charts/src/touch/stock_touch_callback_data.dart';
6+
import 'package:mrx_charts/src/touch/chart_touch_callback_data.dart';
77
import 'package:flutter/material.dart';
88

9+
/// Widget of charts.
910
class Chart extends StatefulWidget {
11+
/// The duration of the chart animations.
12+
///
13+
/// Defaults to Duration(milliseconds: 300)
1014
final Duration duration;
15+
16+
/// The layers of charts.
1117
final List<ChartLayer> layers;
18+
19+
/// The padding of charts.
20+
///
21+
/// Defaults to EdgeInsets.zero
1222
final EdgeInsets padding;
1323

1424
const Chart({

lib/src/models/animation/chart_animation.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ part 'chart_position_animation.dart';
66
part 'chart_size_animation.dart';
77
part 'chart_text_style_animation.dart';
88

9+
/// Abstract class for animation.
910
abstract class ChartAnimation {
1011
void dispose();
1112
}

lib/src/models/animation/chart_color_animation.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
part of 'chart_animation.dart';
22

3+
/// Provides color animation values.
34
class ChartColorAnimation implements ChartAnimation {
45
Animation<Color?>? _animation;
56
Color _lastColor = Colors.transparent;
67

78
ChartColorAnimation();
89

10+
/// Current value during the animation.
11+
///
12+
/// Defaults to Colors.transparent
913
Color get current => _lastColor = _animation?.value ?? Colors.transparent;
1014

15+
/// Last value on finish/stop animation.
16+
///
17+
/// Defaults to Colors.transparent
1118
Color get last => _lastColor;
1219

20+
/// Dispose animation.
1321
@override
1422
void dispose() {
1523
_animation = null;
1624
}
1725

26+
/// Initialize animation.
1827
void setup({
1928
required Color color,
2029
required AnimationController controller,

lib/src/models/animation/chart_double_animation.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
part of 'chart_animation.dart';
22

3+
/// Provides double animation values.
34
class ChartDoubleAnimation implements ChartAnimation {
45
Animation<double>? _animation;
56
double _lastValue = 0.0;
67

78
ChartDoubleAnimation();
89

10+
/// Current value during the animation.
11+
///
12+
/// Defaults to 0.0
913
double get current => _lastValue = _animation?.value ?? 0.0;
1014

15+
/// Last double value on finish/stop animation.
16+
///
17+
/// Defaults to 0.0
1118
double get last => _lastValue;
1219

20+
/// Dispose animation.
1321
@override
1422
void dispose() {
1523
_animation = null;
1624
}
1725

26+
/// Initialize animation.
1827
void setup({
1928
required AnimationController controller,
2029
required double value,

lib/src/models/animation/chart_position_animation.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
part of 'chart_animation.dart';
22

3+
/// Provides position animation values.
34
class ChartPositionAnimation implements ChartAnimation {
45
Animation<Offset>? _animation;
56
Offset _lastPosition = Offset.zero;
67

78
ChartPositionAnimation();
89

10+
/// Current value during the animation.
11+
///
12+
/// Defaults to Offset.zero
913
Offset get current => _lastPosition = _animation?.value ?? Offset.zero;
1014

15+
/// Last value on finish/stop animation.
16+
///
17+
/// Defaults to Offset.zero
1118
Offset get last => _lastPosition;
1219

20+
/// Dispose animation.
1321
@override
1422
void dispose() {
1523
_animation = null;
1624
}
1725

26+
/// Initialize animation.
1827
void setup({
1928
required AnimationController controller,
2029
required Offset position,

lib/src/models/animation/chart_size_animation.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
part of 'chart_animation.dart';
22

3+
/// Provides size animation values.
34
class ChartSizeAnimation implements ChartAnimation {
45
Animation<Size>? _animation;
56
Size _lastSize = Size.zero;
67

78
ChartSizeAnimation();
89

10+
/// Current value during the animation.
11+
///
12+
/// Defaults to Size.zero
913
Size get current => _lastSize = _animation?.value ?? Size.zero;
1014

15+
/// Last value on finish/stop animation.
16+
///
17+
/// Defaults to Size.zero
1118
Size get last => _lastSize;
1219

20+
/// Dispose animation.
1321
@override
1422
void dispose() {
1523
_animation = null;
1624
}
1725

26+
/// Initialize animation.
1827
void setup({
1928
required AnimationController controller,
2029
required Size size,

lib/src/models/animation/chart_text_style_animation.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
part of 'chart_animation.dart';
22

3+
/// Provides text style animation values.
34
class ChartTextStyleAnimation implements ChartAnimation {
45
Animation<TextStyle>? _animation;
56
TextStyle _lastTextStyle = const TextStyle(
@@ -8,18 +9,26 @@ class ChartTextStyleAnimation implements ChartAnimation {
89

910
ChartTextStyleAnimation();
1011

12+
/// Current value during the animation.
13+
///
14+
/// Defaults to TextStyle(color: Colors.transparent)
1115
TextStyle get current => _lastTextStyle = _animation?.value ??
1216
const TextStyle(
1317
color: Colors.transparent,
1418
);
1519

20+
/// Last value on finish/stop animation.
21+
///
22+
/// Defaults to TextStyle(color: Colors.transparent)
1623
TextStyle get last => _lastTextStyle;
1724

25+
/// Dispose animation.
1826
@override
1927
void dispose() {
2028
_animation = null;
2129
}
2230

31+
/// Initialize animation.
2332
void setup({
2433
required AnimationController controller,
2534
required TextStyle textStyle,

lib/src/models/axis/chart_axis_layer.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ part 'data/chart_axis_data_item.dart';
77
part 'settings/chart_axis_settings.dart';
88
part 'settings/chart_axis_settings_axis.dart';
99

10+
/// This layer allows to render axises.
1011
class ChartAxisLayer extends ChartLayer {
12+
/// The x of the axis.
1113
final ChartAxisData x;
14+
15+
/// The y of the axis.
1216
final ChartAxisData y;
17+
18+
/// The settings of the axis.
1319
final ChartAxisSettings settings;
1420

1521
ChartAxisLayer({
@@ -23,6 +29,7 @@ class ChartAxisLayer extends ChartLayer {
2329
label: labelY,
2430
);
2531

32+
/// Disposing all animations.
2633
@override
2734
void dispose() {
2835
x.dispose();

lib/src/models/axis/data/chart_axis_data.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
part of '../chart_axis_layer.dart';
22

3+
/// Providing datas of the selected axis.
34
class ChartAxisData {
5+
/// The items data of axis.
46
final List<ChartAxisDataItem> items;
7+
8+
/// The max value in the data.
59
final double max;
10+
11+
/// The min value in the data.
612
final double min;
713

814
ChartAxisData({
@@ -11,6 +17,7 @@ class ChartAxisData {
1117
required this.min,
1218
});
1319

20+
/// Disposing all animations.
1421
void dispose() {
1522
for (final ChartAxisDataItem item in items) {
1623
item.dispose();

0 commit comments

Comments
 (0)