-1

在此处输入图像描述您好,我正在制作一个需要最大化和最小化屏幕的应用程序。但我想减少“A+”(即最大化屏幕)和“A-”(即最小化)之间的空间。我正在附加一个图片以便更好地理解。谢谢。

这是代码:

return Scaffold(
      appBar: AppBar(
        title: Text(''),
        backgroundColor: Color(0xFF125688),
        actions: <Widget>[
           FlatButton(
                padding: EdgeInsets.all(0),
                onPressed: null,
                child: Text('A+',style: TextStyle(
                  fontSize: 22.0,fontWeight: FontWeight.bold,color: Colors.white
                ),)),

          FlatButton(
            padding: EdgeInsets.all(0),
            onPressed: null,
            child: Text('A-',style: TextStyle(
                fontSize: 15.0,fontWeight: FontWeight.bold,color: Colors.white
            ),),

          )

        ],
      ),
4

3 回答 3

1

使用大小框

Scaffold(
      appBar: AppBar(
        title: Text(''),
        titleSpacing: 10,
        backgroundColor: Color(0xFF125688),
        actions: <Widget>[
           SizedBox(
             width: 30,
             child: FlatButton(
                padding: EdgeInsets.all(0),
                onPressed: null,
                child: Text('A+',style: TextStyle(
                  fontSize: 22.0,fontWeight: FontWeight.bold,color: Colors.white
                ),))),

          SizedBox(
             width: 30,
             child:FlatButton(
            padding: EdgeInsets.all(0),
            onPressed: null,
            child: Text('A-',style: TextStyle(
                fontSize: 15.0,fontWeight: FontWeight.bold,color: Colors.white
            ),),

          ))

        ],
      ))
于 2020-02-13T12:19:10.243 回答
0

使用Cupertino Button而不是FlatButton

CupertinoButton(
      minSize: double.minPositive,
      padding: EdgeInsets.zero,
      child: Text('A+'),
      onPressed: () {},
      pressedOpacity: 1.0,
    )
于 2020-02-13T12:20:51.927 回答
0

扁平按钮的图像:

在此处输入图像描述

Container(
        decoration: new BoxDecoration(
          color: Colors.white,
          border: Border.all(color: Colors.blue, width: 1.0),
          borderRadius: new BorderRadius.all(Radius.circular(3.0)),
        ),
        width: double.infinity,
        child: FlatButton(
          padding: EdgeInsets.all(8.0),
          onPressed: () {
            // Write the function
          },
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Text("Add a Note"),
              Icon(
                Icons.note_add,
                color: Colors.blue,
              ),
            ],
          ),
        ),
      ),
于 2021-09-17T06:42:53.607 回答