是否可以在启动按钮中对齐文本

时间:2019-11-16 14:34:33

标签: android ios flutter

我有一个非常简单的按钮:

RaisedButton(
   onPressed: () => print(title),
   color: Colors.white,
   elevation: 1,
   child: AutoSizeText(
     title,
     maxLines: 1,
   ),
);

但是我需要在开始时对齐文本,这可能吗。我知道可以使用InkWell选项,但是无法同时获得边框和飞溅效果。

3 个答案:

答案 0 :(得分:0)

RaisedButton(
   onPressed: () => print(title),
   color: Colors.white,
   elevation: 1,
   child: Text('Button',),
),

答案 1 :(得分:0)

RaisedButton(
   onPressed: () => print(title),
   color: Colors.white,
   elevation: 1,
   child: Text('Your Text Here', textAlign: TextAlign.left)
);

答案 2 :(得分:-1)

这很适合我

Positioned(
        bottom: 0.0,
        child: Container(
          width: MediaQuery.of(context).size.width,
          height: 40,
          color: Colors.blue,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              ButtonTheme(
                minWidth: 100,
                height: 40,
                child: RaisedButton(
                  color: Colors.purple,
                  padding: EdgeInsets.all(0),
                  child: SizedBox(
                    width: 100,
                    child: Text(
                      'SKIP',
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 18,
                      ),
                      textAlign: TextAlign.left,
                    ),
                  ),
                  onPressed: () {},
                ),
              ),
              ButtonTheme(
                minWidth: 100,
                height: 40,
                child: RaisedButton(
                  color: Colors.purple,
                  padding: EdgeInsets.all(0),
                  child: SizedBox(
                    width: 100,
                    child: Text(
                      'Next',
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 18,
                      ),
                      textAlign: TextAlign.right,
                    ),
                  ),
                  onPressed: () {},
                ),
              ),
            ],
          ),
        ),
      ),