1

我正在尝试使用导航窗口制作警报对话框。应该有 3 行具有不同的图标按钮以在另一个站点上导航。不幸的是,我是 Flutter 的新手,不知道如何再制作 2 行。有人可以帮帮我吗?甚至有可能做到这一点吗?我的意思是我不能再添加更多的孩子,或者我可以吗?我不知道我是否应该将其拆分为 3 个 AlertDialogs 还是很愚蠢?

那是我第一行的布局

这应该是它的样子,但是有 3 行而不是 2 行,这样我现在拥有的代码可以被复制以使 3 个相同的行平行

代码:

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

void popup(BuildContext context) {
  var alertDialog = AlertDialog(
    backgroundColor: Color(0xffb09c84),
    title: Text(''),
    content: Container(
      constraints: BoxConstraints(minWidth: 0, maxWidth: 300, maxHeight: 600),
      padding: EdgeInsets.all(0),
      width: 300.0,
      height: 560.0,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            children: [
              IconButton(
                icon: FaIcon(
                  FontAwesomeIcons.newspaper,
                  size: 44.0,
                ),
                onPressed: () {},
              ),
              SizedBox(height: 2.0),
              Container(
                child: Text(
                  "       Zeitung",
                  style: TextStyle(
                    fontSize: 14.0,
                  ),
                ),
              ),
            ],
          ),
          Column(
            children: [
              IconButton(
                icon: FaIcon(
                  FontAwesomeIcons.envelope,
                  size: 44.0,
                ),
                onPressed: () {},
              ),
              SizedBox(height: 2.0),
              Container(
                child: Text(
                  "    News",
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    fontSize: 14.0,
                  ),
                ),
              ),
            ],
          ),
          Column(
            children: [
              IconButton(
                icon: FaIcon(
                  FontAwesomeIcons.creativeCommonsSampling,
                  color: Colors.black,
                  size: 44.0,
                ),
                onPressed: () {},
              ),
              SizedBox(
                height: 3.0,
              ),
              Container(
                child: Text(
                  "   Vertretung",
                  style: TextStyle(
                    fontSize: 14.0,
                  ),
                ),
              ),
            ],
          ),
        ],
      ),
    ),
  );

  showDialog(context: context, builder: (BuildContext context) => alertDialog);
}

 
4

1 回答 1

0

这是您的代码:

 Container(
      constraints: BoxConstraints(minWidth: 0, maxWidth: 300, maxHeight: 600),
      padding: EdgeInsets.all(0),
      width: 300.0,
      height: 560.0,
      child: //Row(..the rest you want to copy"

在此行之前添加一列,并复制您的Row三次:

 Container(
      constraints: BoxConstraints(minWidth: 0, maxWidth: 300, maxHeight: 600),
      padding: EdgeInsets.all(0),
      width: 300.0,
      height: 560.0,
      child: Column( children: [ 
        Row1("..the rest you want to copy"),
        Row2("..the rest you want to copy"),
        Row3("..the rest you want to copy)" 
     ]), //Column
   ), //Container
于 2021-04-09T17:55:31.347 回答