Skip to content

Instantly share code, notes, and snippets.

@hariangr
Created June 5, 2019 13:31
Show Gist options
  • Save hariangr/2739c25dda72edcbc18073b907ef057a to your computer and use it in GitHub Desktop.
Save hariangr/2739c25dda72edcbc18073b907ef057a to your computer and use it in GitHub Desktop.
Docked FloatingActionButton center with BottomNavigationBar
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: Scaffold(
appBar: AppBar(title: Text('Title')),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
bottomNavigationBar: BottomAppBar(
shape: CircularNotchedRectangle(),
child: Container(
height: 56,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(icon: Icon(Icons.home), onPressed: () {}),
IconButton(icon: Icon(Icons.search), onPressed: () {}),
SizedBox(width: 40), // The dummy child
IconButton(icon: Icon(Icons.notifications), onPressed: () {}),
IconButton(icon: Icon(Icons.message), onPressed: () {}),
],
),
)),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment