Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在底部导航栏中心添加带凹槽的浮动操作按钮? 我试图在底部导航栏的中间添加一个浮动动作按钮。问题并没有出现。这是一张关于这个问题的图片_Android_Dart_Flutter_Flutter Layout - Fatal编程技术网

Android 如何在底部导航栏中心添加带凹槽的浮动操作按钮? 我试图在底部导航栏的中间添加一个浮动动作按钮。问题并没有出现。这是一张关于这个问题的图片

Android 如何在底部导航栏中心添加带凹槽的浮动操作按钮? 我试图在底部导航栏的中间添加一个浮动动作按钮。问题并没有出现。这是一张关于这个问题的图片,android,dart,flutter,flutter-layout,Android,Dart,Flutter,Flutter Layout,我的代码是这样的 import 'package:flutter/material.dart'; class MyHome extends StatefulWidget { @override _MyHomeState createState() => _MyHomeState(); } class _MyHomeState extends State<MyHome> { int _selectedTab = 0; final _pageOptions =

我的代码是这样的

import 'package:flutter/material.dart';

class MyHome extends StatefulWidget {
  @override
  _MyHomeState createState() => _MyHomeState();
}

class _MyHomeState extends State<MyHome> {
  int _selectedTab = 0;
  final _pageOptions = [
    Text('Item 1'),
    Text('Item 2'),
    Text('Item 3'),
    Text('Item 4'),
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primaryColor: Color(0xffFF5555),
      ),
      home: Scaffold(
        body: _pageOptions[_selectedTab],
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
        floatingActionButton: FloatingActionButton(
          onPressed: () {},
          child: Icon(Icons.add),
          backgroundColor: Colors.red,
          foregroundColor: Colors.white,
          elevation: 2.0,
        ),
        bottomNavigationBar: BottomAppBar(
          notchMargin: 2.0,
          shape: CircularNotchedRectangle(),
          child: SizedBox(
            height: 80,
            child: Theme(
              data: Theme.of(context).copyWith(
                  // sets the background color of the `BottomNavigationBar`
                  canvasColor: Color(0xff1B213B),

                  // sets the active color of the `BottomNavigationBar` if `Brightness` is light
                  primaryColor: Color(0xffFF5555),
                  textTheme: Theme.of(context)
                      .textTheme
                      .copyWith(caption: new TextStyle(color: Colors.white))),
              child: BottomNavigationBar(
                type: BottomNavigationBarType.fixed,
                currentIndex: _selectedTab,
                onTap: (int index) {
                  setState(() {
                    _selectedTab = index;
                  });
                },
                fixedColor: Color(0xffFF5555),
                items: [
                  BottomNavigationBarItem(
                      icon: Icon(Icons.tv), title: Text('')),
                  BottomNavigationBarItem(
                      icon: Icon(Icons.card_membership), title: Text('')),
                  BottomNavigationBarItem(
                      icon: Icon(Icons.share), title: Text('')),
                  BottomNavigationBarItem(
                      icon: Icon(Icons.home), title: Text('')),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

我想在中间的那个红色的Fab图标上加个凹口。我尝试了两种形状:圆形和自动匹配的形状方法。但什么都没用。大多数示例显示如何在BottomAppBar中使用行。但我想使用BottomNavigationBar。请帮助我找到解决方案

在BottomAppBar的小部件中使用此属性


clipBehavior:Clip.antialas,

在小部件的BottomAppBar中使用此属性


clipBehavior:Clip.antialas,

这正是您想要的@Farid不,不是。。。这是过时的定制解决方案。这正是您想要的@Farid不,不是。。。这是过时的定制解决方案。