Skip to content

Commit

Permalink
Make figure height more dynamic to not overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andreped committed Aug 11, 2024
1 parent b3613d7 commit e9e4aa0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/tabs/visualization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ class _VisualizationTabState extends State<VisualizationTab> {
const SizedBox(height: 16.0),
_buildChartTypeToggle(),
const SizedBox(height: 16.0),
SizedBox(
height: 300.0,
Expanded(
child: _dataPoints.isEmpty
? Center(
child: Text(
Expand All @@ -112,7 +111,22 @@ class _VisualizationTabState extends State<VisualizationTab> {
),
),
)
: _buildChart(theme),
: LayoutBuilder(
builder: (context, constraints) {
// Calculate height dynamically based on screen size
final chartHeight = constraints.maxHeight;

return ConstrainedBox(
constraints: BoxConstraints(
maxHeight: chartHeight,
),
child: SizedBox(
height: chartHeight,
child: _buildChart(theme),
),
);
},
),
),
],
),
Expand Down

0 comments on commit e9e4aa0

Please sign in to comment.