How To Create Basic Listview Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 27-11-2020

ListView is the most commonly used scrolling widget. It displays its children one after another in the scroll direction. In the cross axis, the children are required to fill the ListView.If non-null, the itemExtent forces the children to have the given extent in the scroll direction. Specifying an itemExtent is more efficient than letting the children determine their own extent because the scrolling machinery can make use of the foreknowledge of the children's extent to save work, for example when the scroll position changes drastically.

How To Create Basic Listview Using Flutter Android App

Basic Listview
Complete Code For Basic Listview In Flutter
main.dart

import 'dart:async';
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}
class MyHomePage extends StatefulWidget {
  final String title;
  MyHomePage({this.title});
  @override
  _MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.blue[900],
        title: Text('A Basic ListView'),
      ),
      body: ListView(
        padding: EdgeInsets.all(8.0),
        //Add any type of `Widget` to the ListView
        children: <Widget>[
          Text("A List View with many Text - Here's one!"),
          Text("A List View with many Text - Here's another!"),
          Text("A List View with many Text - Here's more!"),
          Text("A List View with many Text - Here's more!"),
          Text("A List View with many Text - Here's more!"),
          Text("A List View with many Text - Here's more!"),
          Text("A List View with many Text - Here's more!"),
          Text("A List View with many Text - Here's more!"),
          Text("A List View with many Text - Here's more!"),
        ],
      ),
    );
  }
}

Related Post