Example 009-Simple ListView-(Learning Flutter Day 2)

Insert picture description here

Web page address: Web page demo
(the web page is slower)

Reference: Original

1. Create a project

flutter create example009_listview

2. AS opens

Three. Add dependencies, put in resource files

Four. Writing code

main.dart

import 'package:flutter/material.dart';

void main() {
    
    
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
    
    
  @override
  Widget build(BuildContext context) {
    
    
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
          appBar: new AppBar(title: new Text('ListView Widget')),
          body: new ListView(
            children: <Widget>[
              new ListTile(
                  leading: new Icon(Icons.perm_camera_mic),
                  title: new Text('拍照')),
              new ListTile(
                  leading: new Icon(Icons.add_call),
                  title: new Text('打电话')),
              new ListTile(
                  leading: new Icon(Icons.add_shopping_cart),
                  title: new Text('购物')),
            ],
          )
      )
    );
  }
}

5. Debugging and running

Open the Android or iOS simulator in AS first, and click the run button.
Or run in the command line:

flutter run

6. Package the web

flutter build web

Source code

https://gitee.com/ruik2080/example-flutter

Guess you like

Origin blog.csdn.net/qiang2080/article/details/115132020