How do I change one icon into two different icons in flutter? This is what I have so far.
Widget build(BuildContext context) {
final WebPage currentPage = webPages[currentPageIndex];
return Scaffold(
body: SafeArea(
child: WebView(
initialUrl: currentPage.url,
javaScriptMode: JavaScriptMode.unrestricted,
onWebViewCreated: _controller.complete,
),
),
bottomNavigationBar: BottomNavigationBar(
onTap: onTapNavigation,
currentIndex: currentPageIndex,
items: webPages
.map((webPage) => BottomNavigationBarItem(
icon: Icon(Icons.school), title: Text(webPage.title)))
.toList()),
);
}
here is how i once implemented switching icons based on a bool value
bool _newNotification = false;
Tab(
icon: _newNotification
? Icon(
Icons.directions_boat,
size: 28,
color: Colors.white,
),
: Icon(
Icons.notifications,
size: 28,
color: Colors.white,
),
),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.