Technology Sharing

Flutter - the most detailed (Table) grid and table component usage tutorial

2024-07-11

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

background

Used to display table components, you can specify line width, column width, text direction and other properties

Attributeseffect
columnWidthsColumn Width
defaultVerticalAlignmentComponent placement direction inside the grid
borderGrid style modification
childrenComponents in the table
textDirectionText sorting direction
import 'package:flutter/material.dart';

class CustomTable extends StatelessWidget {
  const CustomTable({Key? key}) : super(key: key);

  
  Widget build(BuildContext context) {
    _ItemBean title = _ItemBean("姓名", "年龄", "性别", "单位名称", "单位地点");
    _ItemBean m = _ItemBean("周", "20", "男", "得意", "武汉");
    _ItemBean kg = _ItemBean("王", "18", "男", "中科", "武汉");
    _ItemBean s = _ItemBean("李", "18", "男", "互动", "武汉");
    _ItemBean a = _ItemBean("菜", "18", "男", "阿里", "武汉");
    _ItemBean k = _ItemBean("热", "18", "男", "字节", "武汉");
    _ItemBean mol = _ItemBean("赵", "18", "女", "腾讯", "武汉");
    _ItemBean cd = _ItemBean("曹", "18", "男", "盛天", "武汉");

    List