Flutter: floatingActionButton

class _MyHomeState extends State<MyHome> with SingleTickerProviderStateMixin {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Demo'),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {},
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, // 调整button在bottomNavigationBar上的位置
      bottomNavigationBar: BottomAppBar(
        color: Colors.yellow,
        child: Container(height: 50.0,),
      ),
      body: Column(
        children: <Widget>[],
      ),
    );
  }
}

猜你喜欢

转载自www.cnblogs.com/ajanuw/p/10923829.html