Skip to content

Commit a25fdd3

Browse files
committed
update example
1 parent 3dcd86f commit a25fdd3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

example/charts.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ChartsState extends State<ChartsExample> {
4848
late int maxValue;
4949
int current = 6;
5050
Map<int, Rect> polylineData = HashMap();
51+
ScrollController controller = ScrollController();
5152

5253
@override
5354
void initState() {
@@ -68,7 +69,9 @@ class ChartsState extends State<ChartsExample> {
6869
),
6970
body: Scrollbar(
7071
isAlwaysShown: true,
72+
controller: controller,
7173
child: SingleChildScrollView(
74+
controller: controller,
7275
child: ConstraintLayout(
7376
width: wrapContent,
7477
children: [
@@ -88,7 +91,7 @@ class ChartsState extends State<ChartsExample> {
8891
Container(
8992
color: Colors.black,
9093
).applyConstraint(
91-
id: cId('base'),
94+
id: cId('yAxis'),
9295
height: 1,
9396
width: matchParent,
9497
bottom: parent.bottom.margin(40),
@@ -99,7 +102,7 @@ class ChartsState extends State<ChartsExample> {
99102
).applyConstraint(
100103
height: 1,
101104
width: matchParent,
102-
bottom: cId('base').bottom.margin(100 * (i + 1).toDouble()),
105+
bottom: cId('yAxis').bottom.margin(100 * (i + 1).toDouble()),
103106
),
104107
for (int i = 0; i < data.length; i++)
105108
GestureDetector(
@@ -108,9 +111,13 @@ class ChartsState extends State<ChartsExample> {
108111
current = i;
109112
});
110113
},
111-
child: Container(
112-
color:
113-
i == current ? Colors.deepOrange : Colors.orangeAccent,
114+
child: MouseRegion(
115+
child: Container(
116+
color: i == current
117+
? Colors.deepOrange
118+
: Colors.orangeAccent,
119+
),
120+
cursor: SystemMouseCursors.click,
114121
),
115122
).applyConstraint(
116123
id: cId('data$i'),
@@ -138,7 +145,7 @@ class ChartsState extends State<ChartsExample> {
138145
),
139146
),
140147
).applyConstraint(
141-
top: cId('base').bottom,
148+
top: cId('yAxis').bottom,
142149
centerHorizontalTo: cId('data$i'),
143150
),
144151
Container(

0 commit comments

Comments
 (0)