I'm trying to build a very simple ToDo app. It consists of a TextField
and a Button
(a form) on the top of the screen that allow the user to add items to the ListView
that is just under the TextField
.
I'm capable to display the TextField
and the Button
, and I'm also capable to display a ListView
, but when I try to display both at the same time, the screen is empty.
Am I missing something? I try to display the ListView into a Column widget but it looks like it doesn't work.
Here is my short code without the form:
import 'package:flutter/material.dart';
void main(){
runApp(MyApp());
}
class MyApp extends StatelessWidget{
@override
Widget build(BuildContext context){
return MaterialApp(
title: "Mon app",
home: Scaffold(
appBar: AppBar(
title: Text("My app")
),
body: Column(
children: <Widget>[
ListView(
children: <Widget>[
ListTile(
leading: Icon(Icons.map),
title: Text('Map'),
),
ListTile(
leading: Icon(Icons.photo_album),
title: Text('Album'),
),
ListTile(
leading: Icon(Icons.phone),
title: Text('Phone'),
),
],
)
])),
);
}
}
Thanks!