Why aren't my apps showing anything after i added list tile
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class Reservation extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appTitle = 'Car Reservation';
return MaterialApp(
title: appTitle,
home: Scaffold(
appBar: AppBar(
title: Text(appTitle),
),
body: MyCustomForm(),
),
);
}
}
// Create a Form widget.
class MyCustomForm extends StatefulWidget {
@override
MyCustomFormState createState() {
return MyCustomFormState();
}
}
// Create a corresponding State class. This class holds data related to the form.
class MyCustomFormState extends State<MyCustomForm> {
// Create a global key that uniquely identifies the Form widget
// and allows validation of the form.
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
// Build a Form widget using the _formKey created above.
return Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.person),
hintText: 'Enter your name',
labelText: 'Name',
),
),
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.phone),
hintText: 'Enter a phone number',
labelText: 'Phone',
),
),
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.car_repair_outlined),
hintText: 'Enter your car plate',
labelText: 'Plate Number',
),
),
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.punch_clock),
hintText: 'How many hours',
labelText: 'Hours',
),
),
TextFormField(
decoration: const InputDecoration(
icon: const Icon(Icons.space_bar),
hintText: '',
labelText: 'Reservation Spot create as ListTile',
),
),
ListView(
children: const <Widget>[
Card(child: ListTile(title: Text('One-line ListTile'))),
Card(
child: ListTile(
leading: FlutterLogo(),
title: Text('One-line with leading widget'),
),
),
Card(
child: ListTile(
title: Text('One-line with trailing widget'),
trailing: Icon(Icons.more_vert),
),
),
Card(
child: ListTile(
leading: FlutterLogo(),
title: Text('One-line with both widgets'),
trailing: Icon(Icons.more_vert),
),
),
Card(
child: ListTile(
title: Text('One-line dense ListTile'),
dense: true,
),
),
Card(
child: ListTile(
leading: FlutterLogo(size: 56.0),
title: Text('Two-line ListTile'),
subtitle: Text('Here is a second line'),
trailing: Icon(Icons.more_vert),
),
),
Card(
child: ListTile(
leading: FlutterLogo(size: 72.0),
title: Text('Three-line ListTile'),
subtitle: Text(
'A sufficiently long subtitle warrants three lines.'
),
trailing: Icon(Icons.more_vert),
isThreeLine: true,
),
),
],
),
new Container(
padding: const EdgeInsets.only(left: 40.0, top: 40.0),
child: new RaisedButton(
child: const Text('Submit'),
onPressed: (){},
)),
],
),
);
}
}
The app won't show after I add the list tile inside, can anyone tell me what went wrong?
Here is after I add my list tile code inside
And here's before I add the list tile code inside
I am wondering if anyone can help me with this one. I still don't understand the flow of it, to be honest.
1 answer
-
answered 2022-05-07 04:23
Yeasin Sheikh
The issue is coming after adding
ListView
insideColumn
widget. You can wrapListView
withExpanded
.Expanded( child: ListView( children: const <Widget>[ ...
I will encourage you to check Unbounded height / width | Decoding Flutter.
How many English words
do you know?
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
how many words do you know
Powered by Examplum