Update SDK
This commit is contained in:
@@ -318,8 +318,12 @@ class _PriceChartState extends State<PriceChart> {
|
||||
_yAxisMax = _baseYAxisMax;
|
||||
}
|
||||
|
||||
// Calculate 65% of viewport height for the chart
|
||||
final screenHeight = MediaQuery.of(context).size.height;
|
||||
final chartHeight = screenHeight * 0.65;
|
||||
|
||||
return Container(
|
||||
height: 250, // Reduced from 300 for more compact layout
|
||||
height: chartHeight,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF0A0E27),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
@@ -333,23 +337,28 @@ class _PriceChartState extends State<PriceChart> {
|
||||
_yAxisMax = _baseYAxisMax;
|
||||
});
|
||||
},
|
||||
child: Listener(
|
||||
onPointerSignal: (pointerSignal) {
|
||||
if (pointerSignal is PointerScrollEvent) {
|
||||
setState(() {
|
||||
// Scroll up = zoom in (decrease Y max), scroll down = zoom out (increase Y max)
|
||||
final delta = pointerSignal.scrollDelta.dy;
|
||||
final zoomFactor = delta > 0 ? 1.1 : 0.9; // Zoom sensitivity
|
||||
|
||||
_yAxisMax *= zoomFactor;
|
||||
|
||||
// Clamp Y-axis max to reasonable bounds
|
||||
final minY = maxPrice * 0.1; // Don't zoom in too much
|
||||
final maxY = maxPrice * 10; // Don't zoom out too much
|
||||
_yAxisMax = _yAxisMax.clamp(minY, maxY);
|
||||
});
|
||||
}
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (ScrollNotification notification) {
|
||||
// Consume scroll notifications to prevent them from bubbling up
|
||||
return true;
|
||||
},
|
||||
child: Listener(
|
||||
onPointerSignal: (pointerSignal) {
|
||||
if (pointerSignal is PointerScrollEvent) {
|
||||
setState(() {
|
||||
// Scroll up = zoom in (decrease Y max), scroll down = zoom out (increase Y max)
|
||||
final delta = pointerSignal.scrollDelta.dy;
|
||||
final zoomFactor = delta > 0 ? 1.1 : 0.9; // Zoom sensitivity
|
||||
|
||||
_yAxisMax *= zoomFactor;
|
||||
|
||||
// Clamp Y-axis max to reasonable bounds
|
||||
final minY = maxPrice * 0.1; // Don't zoom in too much
|
||||
final maxY = maxPrice * 10; // Don't zoom out too much
|
||||
_yAxisMax = _yAxisMax.clamp(minY, maxY);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: LineChart(
|
||||
LineChartData(
|
||||
backgroundColor: const Color(0xFF0A0E27),
|
||||
@@ -491,6 +500,7 @@ class _PriceChartState extends State<PriceChart> {
|
||||
handleBuiltInTouches: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user