Try with this i slowed for 1 second because if i don't add this you will see always 0 .
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: idcard(),
));
class idcard extends StatefulWidget {
@override
State<idcard> createState() => _idcardState();
}
class _idcardState extends State<idcard> {
int ballNumber = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[800],
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
for (ballNumber = 0; ballNumber <= 5; ballNumber += 1);
});
Future.delayed(Duration(seconds:1),(){
setState((){
ballNumber=0;
});
});
},
backgroundColor: Colors.yellow[800],
child: Icon(Icons.add),
),
appBar: AppBar(
backgroundColor: Colors.yellow[800],
title: Text("Ball Counter"),
centerTitle: true,
elevation: 0.0,
),
body: Padding(
padding: EdgeInsets.fromLTRB(0, 50, 0, 0),
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text("Ball number",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, color: Colors.white)),
SizedBox(height: 10),
Text("$ballNumber",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 90, color: Colors.yellow[800])),
],
),
),
),
);
}
}
You can add `Container` and `ListView` in `Column`.
```dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Text("Demo App1"),
),
body: Column(
children: <Widget>[
Container(
height: 40.0,
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.all(4.0),
width: 100.0,
child: Text(
"Name",
style: TextStyle(fontSize: 18),
)),
Container(
padding: EdgeInsets.all(4.0),
width: 100.0,
child: Text(
"Age",
style: TextStyle(fontSize: 18),
)),
],
),
),
Expanded(
child: ListView.builder(
itemCount: 100,
itemBuilder: (BuildContext context, int index) {
return Row(
children: <Widget>[
Container(
padding: EdgeInsets.all(4.0),
width: 100.0,
child: Text(
"Name $index",
style: TextStyle(fontSize: 18),
)),
Container(
padding: EdgeInsets.all(4.0),
width: 100.0,
child: Text(
"Age $index",
style: TextStyle(fontSize: 18),
),
)
],
);
},
),
),
],
),
),
);
}
}
```