Skip to content

Commit

Permalink
Merge pull request #142 from andreped/139-bug-figure-too-large-in-vis…
Browse files Browse the repository at this point in the history
…ualization-for-small-screens

Make figure height more dynamic to not overflow
  • Loading branch information
andreped authored Aug 11, 2024
2 parents b3613d7 + 4d22023 commit ba99b93
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions lib/tabs/visualization.dart
Original file line number Diff line number Diff line change
@@ -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(
@@ -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),
),
);
},
),
),
],
),
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.4.0+14
version: 0.4.1+15

environment:
sdk: '>=3.4.3 <4.0.0'

0 comments on commit ba99b93

Please sign in to comment.