最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Flutter?Widget之NavigationBar使用詳解

 更新時(shí)間:2022年12月07日 16:42:50   作者:程序員界的小學(xué)生  
這篇文章主要為大家介紹了Flutter?Widget之NavigationBar使用詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

正文

這是一個(gè)和時(shí)間一樣古老的故事。您的應(yīng)用程序有三到五個(gè)主要內(nèi)容區(qū)域,您的用戶應(yīng)該能夠在任何屏幕之間切換。

那么,在這種情況下,請(qǐng)查看NavigationBar。

現(xiàn)在,您可能會(huì)想,“底部們有導(dǎo)航欄嗎?,這個(gè)新的導(dǎo)航欄小部件有什么特別之處?“

不同之處在于BoottomNavigationBar使用Material 2設(shè)計(jì)系統(tǒng),而NavigationBar具有新的Material 3外觀和感覺。

例如,藥丸形狀,它以對(duì)比色指示活動(dòng)的目的地。

要啟動(dòng)并運(yùn)行,為NavigationBar提供destination列表,當(dāng)前所選的索引以及每當(dāng)選擇destination時(shí)出發(fā)的回調(diào)而已。

NavigationBar(
    destinations: [
        NavigationDestination(
            icon: Icon(Icons.home),
            label: 'Home',
        ),
        NavigationDestination(
            icon: Icon(Icons.explore),
            label: 'Explore',
        ),
        NavigationDestination(
            icon: Icon(Icons.person),
            label: 'Profile',
        ),
        NavigationDesstination(
            icon: Icon(Icons.settings_rounded,
            label: 'Settings',
        ),
    ],
    selectedIndex: currentPageIndex,
    onDestinationSelected: (int index) {
        setState(() {
            currentPageIndex = index;
        });
    }
)

現(xiàn)在您的應(yīng)用程序可以使用選定的索引來(lái)決定要承鉉哪個(gè)視圖。

Scaffold(
    bottomNavigationBar: NavigationBar(...),
    body: [Widget1, Widget2, Widget3, Widget4][currentPageIndex]
)

您可以使用它并配置諸如labelBehavior

NavigationBar(
    destinations: [...].
    selectedIndex: currentPageIndex,
    onDestinationSelected: (int index) {...},
    labelBehavior: onlyShowSelected,
)

background

NavigationBar(
    destinations: [...],
    selectedIndex: currentPageIndex,
    onDestinationSelected: (int index) {...},
    backgroundColor: Colors.grey,
)

和animationDuration之類的東西,以便當(dāng)destination在選中和未選中之間更改狀態(tài)時(shí)。

NavigationBar(
    destinations: [...],
    selectedIndex: currentPageIndex,
    onDestinationSelected: (int index) {...},
    animationDuration: Duration(ms: 1000),
)

準(zhǔn)備好在大屏幕訪問(wèn)您的應(yīng)用程序了嗎?將NavigationBar與NaviigationRail欄配對(duì),您將立即擁有一個(gè)完全相應(yīng)的導(dǎo)航系統(tǒng)。

如果想了解有關(guān)NavigationBar的內(nèi)容,或者關(guān)于Flutter的其他功能,請(qǐng)?jiān)L問(wèn) flutter.dev

以上就是Flutter Widget之NavigationBar使用詳解的詳細(xì)內(nèi)容,更多關(guān)于Flutter Widget NavigationBar的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論

缙云县| 于田县| 杭州市| 光泽县| 炎陵县| 阆中市| 宣城市| 灌云县| 湾仔区| 内黄县| 玉环县| 贵港市| 南和县| 南昌市| 定日县| 兴安县| 保亭| 杭州市| 中山市| 本溪| 恩施市| 扎赉特旗| 合川市| 和林格尔县| 永顺县| 蒙自县| 会宁县| 余江县| 鄄城县| 临邑县| 清苑县| 娱乐| 江西省| 青州市| 抚州市| 招远市| 南召县| 贵定县| 多伦县| 湘乡市| 龙游县|