简体   繁体   中英

How to collapse the popup menu in Flutter

How can I narrow the width of the popup menu in the navbar? How can I zoom the icon and text? I can't open the width tag, I think a different customization is required.

现在看起来像这样

actions: <Widget>[
      PopupMenuButton<_MenuValues>(
      color: const Color(0xFF212121),
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(15.0))
      ),
      itemBuilder: (BuildContext context) => [
        PopupMenuItem(
            child: ListTile(
              leading: Icon(Icons.settings, color: Colors.white),
              title: Text("Settings", style: TextStyle(color: Colors.white)),
            ),
            value: _MenuValues.settings
            ),
      ],
      onSelected: (value) {
          switch(value) {
            case _MenuValues.settings:
              Navigator.of(context).push(MaterialPageRoute(
                builder: (context) => settings(),
              ));
              break;
          }
        },
      ),
    ],

use sizedBox

          PopupMenuItem(
            value: 1,
            // row has two child icon and text.
            child: SizedBox(
              width: 500,
              child: Row(
                children: [
                  Icon(Icons.settings , size: 10,),
                  Text("Settings", style: TextStyle(fontSize: 10),)
                ],
              ),
            )
          ),
        ],

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM