zoukankan      html  css  js  c++  java
  • flutter ListView

    代码:

    import 'package:flutter/material.dart';
    void main() => runApp(MyTestApp());

    class MyTestApp extends StatelessWidget{
    Widget build(BuildContext context){
    return MaterialApp(
    title: 'Flutter test',
    home: Scaffold(
    appBar: new AppBar(title: new Text('ListView'),),
    body: new ListView(
    children: <Widget>[
    new ListTile(
    leading: new Icon(Icons.ac_unit),
    title: new Text('图标'),

    ), new ListTile(
    leading: new Icon(Icons.access_alarm),
    title: new Text('闹钟'),

    ), new ListTile(
    leading: new Icon(Icons.access_time),
    title: new Text('时间'),

    ),
     
    new Container(
    child:new Image.network(
    'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1578312966654&di=09a975b6c05a1447fc6f8aeae463cf41&imgtype=0&src=http%3A%2F%2Fp2.qhimgs4.com%2Ft0128307802c64fd817.jpg',
    fit: BoxFit.cover,
    ),
    300.0,
    height: 200.0,
    padding: const EdgeInsets.all(10.0),
    color: Colors.greenAccent,
    ),new Image.network(
    'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1578317300003&di=5c3292475c58134de976eca46a0dd82f&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn08%2F183%2Fw1024h759%2F20180801%2F8da9-hhacrce6850409.jpg',
    100.0,
    height: 50.0,
    )

    ],
    )
     
    ),
    );
    }
    }
     
     
    总结:

    listView 

    children: <widget>[//list 里的控件

    new listTitle(//左图 右文字

    leading:new Icon(Icons.xxx)//flutter 自带的图标

    title :new Text(‘xxx’)//文字

     

    new Image.network(

    ‘http://xxxx

    )

     

    )

    还可以添加contain 在区域里添加图片设置图片位置 样式

     

  • 相关阅读:
    python和matlab
    进程和线程的主要区别
    如何理解卷积
    Leetcode 961. N-Repeated Element in Size 2N Array
    Leetcode 387. First Unique Character in a String
    Python ord()与chr()函数
    Leetcode 709. To Lower Case
    python 字符串大小写相关函数
    Leetcode 367. Valid Perfect Square
    Leetcode 1014. Capacity To Ship Packages Within D Days
  • 原文地址:https://www.cnblogs.com/pp-pping/p/12157892.html
Copyright © 2011-2022 走看看