自定义抽屉图标颤动

时间:2021-06-16 20:53:46

标签: flutter dart flutter-layout

我正在尝试将抽屉图标设置为大于默认大小,我正在使用 class Simpleimage { var $image; function resize($width, $height) { $new_image = imagecreatetruecolor($width, $height); imagecolortransparent($new_image, imagecolorallocatealpha($new_image, 0, 0, 0, 127)); imagealphablending($new_image, false); imagesavealpha($new_image, true); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } 但它不起作用,我不知道为什么。然后我希望 width: MediaQuery.of (context) .size.width * 0.85 来自左侧而不是右侧,但我需要菜单图标位于右侧。我该怎么做?

ListView

2 个答案:

答案 0 :(得分:0)

Scaffold(
  appBar: AppBar(
    title:Text('hi'),
    leading: IconButton(
      icon: Icon(Icons.menu),
      onPressed: () => Scaffold.of(context).openDrawer(),
    ),
  ),

答案 1 :(得分:0)

我找到了解决方法

appBar: AppBar(
    automaticallyImplyLeading: false,
    //backgroundColor: red,
    toolbarHeight: 120,
    centerTitle: false,
    actions: [
      IconButton(
        icon: Icon(Icons.menu_rounded),
        iconSize: 35,
        onPressed: () => _scaffoldKey.currentState!.openDrawer()
      ),
    ],
    leading: IconButton(
      icon: Icon(Icons.arrow_back),
      iconSize: 35,
      onPressed: () => Navigator.of(context).pop(),
    ),
    title: Text('App Bar', style: TextStyle(color: white, fontSize: 30,),),
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.vertical(
        bottom: Radius.circular(30),
      ),
    ),
  ),