如何在同一起始点使文本在不同行中的上下对齐

问题描述 投票:0回答:2

我希望你们一切都好。这是我第一个扑扑的项目,我想寻求你们的指导。

This is my current layout but I would like to align the 3 rows of text label and the star rating

抱歉,我还有2个问题,>]

如何分隔第一颗星和文本字段之间的空间?

有什么方法可以创建更大的文本字段?我已经试过了身高,但并没有使视野变大。

谢谢,希望你们有美好的一天:)

这是我当前的代码:

 @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Form(
            key: _formKey,
            child: Container(
                padding: EdgeInsets.all(30),
                child: Center(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: <Widget>[
                      SizedBox(height: 100),
                      new TextFormField(
                        style: new TextStyle(
                          height: 1.0,
                        ),
                        validator: (value) {
                          if (value.isEmpty) {
                            return 'Field can\'t be empty!';
                          }
                          return null;
                        },
                        onSaved: (value) => _feedback = value,
                        decoration: new InputDecoration(
                            labelText: "Enter Message",
                            fillColor: Colors.white),
                        keyboardType: TextInputType.text,
                      ),
                      new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        // crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text(
                            "AACCDDEE",
                            textAlign: TextAlign.center,
                            style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20),
                          ),
                          StarRating(
                            rating: safetyrating,
                            starConfig: StarConfig(
                              size: 30.0,
                            ),
                            onChangeRating: (int rating) {
                              setState(() {
                                this.safetyrating = rating.toDouble();
                              });
                            },
                          )
                        ],
                      ),

                      new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: <Widget>[
                          Text(
                            "B",
                            textAlign: TextAlign.center,
                            style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20),
                          ),
                          StarRating(
                            rating: speedrating,
                            starConfig: StarConfig(
                              size: 30.0,
                            ),
                            onChangeRating: (int rating) {
                              setState(() {
                                this.speedrating = rating.toDouble();
                              });
                            },
                          )
                        ],
                      ),

                      new Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        children: <Widget>[
                          Text(
                            "AAS",
                            textAlign: TextAlign.center,
                            style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20),
                          ),
                          StarRating(
                            rating: enjoymentrating,
                            starConfig: StarConfig(
                              size: 30.0,
                            ),
                            onChangeRating: (int rating) {
                              setState(() {
                                this.enjoymentrating = rating.toDouble();
                              });
                            },
                          )
                        ],
                      ),
                      new Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[
                          RaisedButton(
                            child: Text('SUBMIT'),
                            // height: 50.0,
                            // minWidth: 150.0,
                            color: Colors.blueGrey,
                            splashColor: Colors.black,
                            textColor: Colors.black,
                            // child: new Icon(FontAwesomeIcons.signInAlt),
                            onPressed: feedback,
                          ),
                        ],
                      ),
                    ],
                  ),
                ))));
  }

我希望你们一切都好。这是我第一个扑扑的项目,我想寻求你们的指导。这是我当前的布局,但是我想对齐3行文本标签...

flutter flutter-layout
2个回答
0
投票

我认为,唯一可能的变形是创建以下结构:


0
投票

为了对齐,我建议使用2列而不是3行的行。

© www.soinside.com 2019 - 2024. All rights reserved.