diff --git a/lib/screens/query.dart b/lib/screens/query.dart index cc3d80f..d0cc205 100644 --- a/lib/screens/query.dart +++ b/lib/screens/query.dart @@ -26,7 +26,7 @@ class _QueryScreenState extends State { setState(() => _isLoading = true); final FoodDataController data = Get.find(); - if (data.getApiKey() == null) { + if (data.getApiKey() == null || data.getApiKey()!.isEmpty) { setState(() => _hasApiKey = false); return; } @@ -44,7 +44,11 @@ class _QueryScreenState extends State { void initState() { super.initState(); final FoodDataController data = Get.find(); - data.initialize(context); + data.initialize(context).then((_) { + setState(() { + _hasApiKey = data.getApiKey() != null && data.getApiKey()!.isNotEmpty; + }); + }); } @override diff --git a/lib/translations/en_us.dart b/lib/translations/en_us.dart index edffe92..6f63dda 100644 --- a/lib/translations/en_us.dart +++ b/lib/translations/en_us.dart @@ -49,5 +49,5 @@ const i18nEnglish = { 'searchHint': 'Type keywords below to search', 'searchNoKeyHint': 'No API key, please first set up the API key in "Settings" > "Data Source"', - 'searchResultHint': '@count records matched (up to the first 100)', + 'searchResultHint': '@count records matched (showing 100)', }; diff --git a/lib/translations/zh_cn.dart b/lib/translations/zh_cn.dart index d2af1ea..0ca2a58 100644 --- a/lib/translations/zh_cn.dart +++ b/lib/translations/zh_cn.dart @@ -42,5 +42,5 @@ const i18nSimplifiedChinese = { 'loading': '加载中', 'searchHint': '在下方键入关键词来搜索', 'searchNoKeyHint': '无 API 令牌,请先在「设置」>「数据源」设置 API 密钥', - 'searchResultHint': '共命中 @count 条记录(截取前 100 条)', + 'searchResultHint': '共命中 @count 条记录(显示前 100 条)', };