Flutter之GridView

#资料

基本

在这里插入图片描述

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

class GridViewWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Container"),
      ),
      body: GridView.count(
        crossAxisCount: 2,
        primary: false,
        padding: const EdgeInsets.all(20.0),
        crossAxisSpacing: 10.0,
        children: <Widget>[
          Container(
            color: Colors.red,
            child: const Text('He\'d have you all unravel at the '),
          ),
          Container(
            color: Colors.green,
            child: const Text('Heed not be rabble'),
          ),
          Container(
            color: Colors.blueAccent,
            child: const Text('Sound of screams but the'),
          ),
          const Text('Who sscream'),
          const Text('Revolution is coming...'),
          const Text('Revolution, they...'),
        ],
      ),
    );
  }
}
发布了167 篇原创文章 · 获赞 62 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/AdrianAndroid/article/details/104330382