是否有任何解决方法可以将 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) 我想获取光标位于颤振应用程序窗口之外时的鼠标位置和点击次数。
MouseRegion仅在小部件的尺寸内起作用...