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 在区域里添加图片设置图片位置 样式

     

  • 相关阅读:
    付宇泽20190912-1 每周例行报告
    付宇泽20190912-3 词频统计
    付宇泽20190912-2 命令行
    付宇泽20190905-1 每周例行报告
    付宇泽20190905-2 博客作业
    付宇泽20190905-3 命令行和控制台编程
    罗杨美慧 20190905-3 命令行和控制台编程
    【Linux运维】Centos7上借助ansible搭建LVS+Keepalived
    【shell 练习1】编写Shell条件句练习
    【第四章】Shell 条件测试表达式
  • 原文地址:https://www.cnblogs.com/pp-pping/p/12157892.html
Copyright © 2011-2022 走看看