If you want to add Floating action Button in Bottom Navigation Bar in Center with border? There are many possible solutions, one of them is to add padding and border.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import 'package:charts_flutter/flutter.dart' as prefix0; import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( backgroundColor: Colors.blueAccent, floatingActionButton: Padding( padding: EdgeInsets.only(top: 20), child: SizedBox( height: 70, width: 70, child: FloatingActionButton( backgroundColor: Colors.transparent, elevation: 0, onPressed: () {}, child: Container( height: 70, width: 70, decoration: BoxDecoration( border: Border.all(color: Colors.white, width: 4), shape: BoxShape.circle, gradient: LinearGradient( begin: const Alignment(0.7, -0.5), end: const Alignment(0.6, 0.5), colors: [ Color(0xFF53a78c), Color(0xFF70d88b), ], ), ), child: Icon(Icons.photo_camera, size: 30), ), ), ), ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: BottomAppBar( color: Colors.white, child: Container( height: 80, color: Colors.white, ), ), ), ); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.