どのように私はフラッタ異なる2つのアイコンに1つのアイコンを変更できますか?

Rachmad Riadi HP:

どのように私はフラッタ異なる2つのアイコンに1つのアイコンを変更できますか?これは私がこれまで持っているものです。

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()),
  );
}
グリフィン:

ここで私は一度bool値に基づいてスイッチングアイコンを実装する方法です

bool _newNotification = false;
  Tab(
            icon: _newNotification
                ? Icon(
                    Icons.directions_boat,
                    size: 28,
                    color: Colors.white,
                  ),
                : Icon(
                    Icons.notifications,
                    size: 28,
                    color: Colors.white,
                  ),
),

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=362850&siteId=1