flutter 切换语言报错

class MyHomePage extends StatefulWidget {
_MyHomePageState createState() => new _MyHomePageState();
}
bool sign=true;
class _MyHomePageState extends State<MyHomePage>{
@override
Widget build(BuildContext context){

return new Scaffold(
  appBar: new AppBar(
    title: new Text(Translations.of(context).text('app_title')),  // 试着使用下翻译库
  ),
  body: new GestureDetector(
    child:new Container(
      child: new Text(Translations.of(context).text('main_title'),style: new TextStyle(fontSize: 17,color: Colors.black),)
    ),
    onTap: (){
      sign=!sign;
      setState(() {
        applic.onLocaleChanged(new Locale(sign?'fr':'en'));
      });
    },
  ),
);

}
image.png
image.png
image.png
image.png
image.png

这是什么问题啊,刚学flutter,求教,谢谢

阅读 1.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题