小编Has*_*nso的帖子

如何本地化 BottomNavigationBarItem 标签

是否有任何解决方法可以将 BottomNavigationBarItem 翻译成不同的语言?我使用 Lang.getString(context, key) 访问地图(从 json 文件加载)以获取正确的翻译,对这样的标签进行硬编码没有任何意义,标签:“Home”。我应该怎么办?

PageView(
        controller: pageController,
        onPageChanged: _pageSwipped,
        children: <Widget>[Page1()],
      ),
      bottomNavigationBar: BottomNavigationBar(
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: Lang.getString(context, key), // it doesn't work because it should be constant.
          ),
        ],
        currentIndex: _currenIndex,
        selectedItemColor: Colors.blue,
        iconSize: _deviceSize.size.height * 0.046,
        selectedFontSize: _deviceSize.size.height * 0.023,
        unselectedItemColor: Colors.grey,
        onTap: _bottomTapped,
      )
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-widget

9
推荐指数
1
解决办法
1034
查看次数

如何在颤动应用程序窗口之外获取鼠标位置

我想获取光标位于颤振应用程序窗口之外时的鼠标位置和点击次数。

MouseRegion仅在小部件的尺寸内起作用...

mouse flutter

6
推荐指数
0
解决办法
292
查看次数

标签 统计

flutter ×2

dart ×1

flutter-widget ×1

mouse ×1