如何在应用程序栏右侧添加图标的间距

时间:2020-01-09 11:49:01

标签: flutter

我刚刚开始拍打,在这里我很困惑如何增加间距。

请帮帮我。

enter image description here

if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {

    Intent shortcutIntent = new Intent(getApplicationContext(), SplashScreen.class);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    shortcutIntent.setAction(Intent.ACTION_MAIN);

    ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(getApplicationContext(), "shortcut")
            .setShortLabel(getResources().getString(R.string.app_name))
            .setIcon(IconCompat.createWithResource(getApplicationContext(), R.mipmap.apt_launcher))
            .setIntent(shortcutIntent)
            .build();
    ShortcutManagerCompat.requestPinShortcut(getApplicationContext(), shortcut, null);
}

2 个答案:

答案 0 :(得分:1)

使用IconButton代替Icon

appBar: AppBar(
        title: Text('Breeds of Dogs'),
        automaticallyImplyLeading: false,
        actions: <Widget>[
          IconButton(
              icon: Icon(
                Icons.add_a_photo,
                color: Colors.white,
              ),
              onPressed: () {}),
        ],
      ),

答案 1 :(得分:0)

使用图标按钮代替icon

appBar: AppBar(
        title: Text('Breeds of Dogs'),
        actions: <Widget>[
          IconButton(
              icon: Icon(
                Icons.add_a_photo,
              ),
              onPressed: () {
              print("Hello");
             }),
        ],
      )