你需要用容器包裹 UnicornDialer 并控制缺口边距,请注意 notchMargin 可以取负值,
似乎 bottomAppBar 凹槽的渲染器无法从原始 UnicornDialer 正确计算 Besier 曲线。
您可以使用以下代码作为指导。它运行良好
import 'package:flutter/material.dart';
import 'package:unicorndial/unicorndial.dart';
void main() =>
runApp(new MaterialApp(debugShowCheckedModeBanner: false, home: Example()));
class Example extends StatefulWidget {
_Example createState() => _Example();
}
class _Example extends State<Example> {
@override
Widget build(BuildContext context) {
var childButtons = List<UnicornButton>();
childButtons.add(UnicornButton(
hasLabel: true,
labelText: "Choo choo",
currentButton: FloatingActionButton(
heroTag: "train",
backgroundColor: Colors.redAccent,
mini: true,
child: Icon(Icons.train),
onPressed: () {},
)));
childButtons.add(UnicornButton(
currentButton: FloatingActionButton(
heroTag: "airplane",
backgroundColor: Colors.greenAccent,
mini: true,
child: Icon(Icons.airplanemode_active))));
childButtons.add(UnicornButton(
currentButton: FloatingActionButton(
heroTag: "directions",
backgroundColor: Colors.blueAccent,
mini: true,
child: Icon(Icons.directions_car))));
return Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: new BottomAppBar(
shape: CircularNotchedRectangle(),
notchMargin: -10.0,
color: Colors.blue,
child: new Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(Icons.menu),
onPressed: () {},
),
IconButton(
icon: Icon(Icons.search),
onPressed: () {},
),
],
),
),
//floatingActionButton: FloatingActionButton(onPressed: (){}),
floatingActionButton: Container(
width: 100.0,
height: 100.0,
child: UnicornDialer(
hasNotch: true,
//hasBackground: false,
backgroundColor: Color.fromRGBO(255, 255, 255, 0.0),
parentButtonBackground: Colors.redAccent,
orientation: UnicornOrientation.VERTICAL,
parentButton: Icon(Icons.add),
childButtons: childButtons),
),
appBar: AppBar(),
body: Container(
child: Center(
child: RaisedButton(
onPressed: () {
setState(() {});
},
),
),
),
);
}
}