-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script error #2514
Comments
I ran this in a local Flutter dev environment and received the following error: Vertical viewport was given unbounded height.
Viewports expand in the scrolling direction to fill their container. In this case, a vertical
viewport was given an unlimited amount of vertical space in which to expand. This situation
typically happens when a scrollable widget is nested inside another scrollable widget.
If this widget is always nested in a scrollable widget there is no need to use a viewport because
there will always be enough vertical space for the children. In this case, consider using a Column
or Wrap instead. Otherwise, consider using a CustomScrollView to concatenate arbitrary slivers into
a single scrollable.
The relevant error-causing widget was:
ListView
ListView:file:///Users/brettmorgan/Documents/flutter-projects/issue_2514/lib/main.dart:40:13 The updated code, to eliminate linter warnings: import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text('Title'),
),
body: const TestWidget(),
),
);
}
}
class TestWidget extends StatefulWidget {
const TestWidget({Key? key}) : super(key: key);
@override
State<TestWidget> createState() => _TestWidgetState();
}
class _TestWidgetState extends State<TestWidget> {
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
ListView(
children: [
for (int i = 1; i < 20; i++)
ListTile(
title: Text('Item $i'),
onTap: () async {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("label"),
),
);
await Future.delayed(const Duration(seconds: 1));
if (!mounted) return;
Navigator.pop(context);
},
),
],
),
IconButton(onPressed: () {}, icon: const Icon(Icons.add)),
],
)
],
);
}
} |
The correct error should be in the Dartpad output. This shouldn't be closed, not have the exception in Dartpad renders it functionality useless. |
Hey @johnpryan do you have a tracking issue for exposing flutter run time issues? |
This looks like the same issue as #1966 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
Script error.
Based on Flutter 3.7.12 Dart SDK 2.19.6
Steps to reproduce problem
See code
Additional info
Browser
Browser: Brave
Version: Version 1.51.110 Chromium: 113.0.5672.77 (Official Build) (64-bit)
Are you using any extensions/plugins that affect website behavior
(particularly those that affect iframes, such as ad blockers)?
Are there any warnings or errors in your browser's JavaScript console?
If so, paste them below:
dartpad.dev-1683713703099.log
Machine
Operating system: Windows 10 64 bits
Version:
Your code
What code was in the editor, if any, when the failure occurred? You
can paste it in below:
DartPad's output
Did DartPad print anything to the console pane? If so, paste it below:
The text was updated successfully, but these errors were encountered: