[英]How can I use checkboxlisttile in alertDialog in flutter?
[英]How can I translate a CheckboxListTile in Flutter?
這是我的代碼:
CheckboxListTile (
value: agree,
title: Text (AppLocalizations.of(context).translate('Do you accept the terms and conditions?'),
style: TextStyle(fontSize: 18)),
onChanged: (bool value) {
setState(() {
this.agree = value;
});
},
),
錯誤是:
必須向文本小部件提供非 null 字符串
嘗試在文本小部件中添加后備文本
Text(AppLocalizations.of(context).translate('Do you accept the terms and conditions?' ?? 'Do you accept the terms and conditions?');
如果你想翻譯它,你必須檢查你的文件夾:assets > lang
您將看到項目中的所有翻譯,我將以下內容放在英文版中:
"DoYouAcceptTheTermsAndConditions?": "您接受條款和條件嗎?",
西班牙語:
"DoYouAcceptTheTermsAndConditions?": "¿Aceptas los terminos y condiciones?",
有問題可以問我:D
編輯:我的代碼現在看起來像這樣:
CheckboxListTile ( title: Text(AppLocalizations.of(context).translate('DoYouAcceptTheTermsAndConditions?'), style: TextStyle(fontSize: 18)), value: agree, onChanged: (bool value) { setState(() { this.agree = 值; }); }, ),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.