水平列表

 

 

 

 

 

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      appBar: AppBar(title: Text("flutterDemo")),
      body: HomeContent(),
    ));
  }
}

class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 180.0,
      child: ListView(
        scrollDirection: Axis.horizontal,
        children: <Widget>[
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.red,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.orange,
            child: ListView(
              children: <Widget>[
                Image.network(
                  "https://www.itying.com/images/202004/goods_img/1101_P_1587123548040.jpg",
                ),
                Text('我是文本'),
              ],
            ),
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.blue,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.deepOrange,
          ),
          Container(
            width: 180.0,
            height: 180.0,
            color: Colors.deepPurpleAccent,
          )
        ],
      ),
    );
  }
}
posted @ 2021-07-31 20:59  13522679763-任国强  阅读(35)  评论(0)    收藏  举报