Выравнивание таблицы во флаттере? - PullRequest
0 голосов
/ 19 сентября 2018

Я собираюсь использовать таблицу данных в своем приложении.

На моей странице есть фон, что эта таблица данных должна быть в определенной позиции (возможно, в центре), но я не знаюкак установить выравнивание для этого (таблица данных).

Может кто-нибудь сказать мне, как решить эту проблему?

Ответы [ 2 ]

0 голосов
/ 21 мая 2019
child: Table(
        children: [
          TableRow(children: [
            Center(child: Text("item 1"),),
            Center(child: Text("item 2"),),
            Center(child: Text("item 3"),),
            Center(child: Text("item 4"),),
            Center(child: Text("Edit"),),
          ]),

Рабочая.

0 голосов
/ 20 сентября 2018
import 'package:flutter/material.dart';

  void main() => runApp(new Demo());

  class Demo extends StatefulWidget {
    @override
    _DemoState createState() => _DemoState();
  }

  class _DemoState extends State<Demo> with TickerProviderStateMixin {

    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: new Text("table demo"),
          ),
          body: new Container(
            child: Center(
              child: new  Table(
                children: const <TableRow>[
                  TableRow(

                    children: <Widget>[
                      Center(child: Text('AAAAAA')), Center(child: Text('B')), Center(child: Text('C')),
                    ],
                  ),
                  TableRow(
                    children: <Widget>[
                      Center(child: Text('BBBB')), Center(child: Text('AAAAAA')), Center(child: Text('vdsvsdvs')),
                    ],
                  ),
                  TableRow(
                    children: <Widget>[
                      Center(child: Text('CCCCCC')), Center(child: Text('F')), Center(child: Text('CG')),
                    ],
                  ),
                ],
              ),
            ),
          )
        )
      );
    }
  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...