-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Description
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: MyStatefulWidget(),
);
}
}
class MyStatefulWidget extends StatefulWidget {
MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Sample Code'),
),
body: ListView(
children: [
Container(),//<-- Error occurs when scrolling
for(int i=0; i<30; i++)
Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Hello'),
)
],
),
);
}
}
════════ Exception caught by rendering library ═════════════════════════════════
The method '-' was called on null.
Receiver: null
Tried calling: -(0.0)
The relevant error-causing widget was
ListView
lib\main.dart:31
════════════════════════════════════════════════════════════════════════════════
HI
If I put an invisible widget or Container in the first of the ListView, an error occurs when scrolling.
My flutter version is 1.20.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels