I want to make such a design, but I could not design the shopping cart icon in this format, how can I do it?
import 'package:flutter/material.dart';
void main() {
runApp( MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Container(),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart ,), label:'',
backgroundColor: Colors.red,
),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart), label:''),
],
),
),
);
}
}
This is the code I tried to do, I couldn’t format the basket icon as shown in the figma design image
2
Answers
I modified your code for the first
BottomNavigationBarItem
so it has red circular background:You can change the values of
height
,width
andcolor
to match your needs.Also, I would recommend adding these parameters to your
BottomNavigationBar
to center the icons (use it only if you are going to keep all of the labels as empty strings):empty text
with widget option list (_widgetOptions
)BottomNavigationBarItem with empty label
and in the icon widget, placecontainer with BoxShape.circle
decoration and use acustom icon
of container childselected and unselected item color
property_onItemTapped
set a condition for the middle selection iconSee the full codes