From 57e8db8af2f862feea4596b09d0e389c4dd67e4a Mon Sep 17 00:00:00 2001 From: kidozh <11661760+kidozh@users.noreply.github.com> Date: Sun, 1 Dec 2024 00:23:22 +0000 Subject: [PATCH] add focus node check --- lib/app/MainApp.dart | 2 + lib/client/SteamApiClient.dart | 1 + lib/client/SteamApiClient.g.dart | 10 +- lib/generated/intl/messages_en.dart | 131 ++++---- lib/generated/intl/messages_zh_CN.dart | 131 ++++---- lib/generated/l10n.dart | 10 + lib/l10n/intl_en.arb | 8 +- lib/l10n/intl_zh_CN.arb | 8 +- lib/page/TestFlightBannerPage.dart | 1 + lib/page/ViewThreadSliverPage.dart | 7 +- lib/utility/NetworkUtils.dart | 2 +- lib/widget/DiscuzHtmlWidget.dart | 5 +- lib/widget/SteamGameWidget.dart | 411 +++++++++++++++---------- 13 files changed, 422 insertions(+), 305 deletions(-) diff --git a/lib/app/MainApp.dart b/lib/app/MainApp.dart index be5eb7c..6bdb95e 100644 --- a/lib/app/MainApp.dart +++ b/lib/app/MainApp.dart @@ -782,6 +782,8 @@ class MainTwoPaneState extends State navigatorKey: this.navigatorKey, ); } + + double paneProportion = 0.35; // directly give return OrientationBuilder(builder: (context, orientation) { diff --git a/lib/client/SteamApiClient.dart b/lib/client/SteamApiClient.dart index 0edd5d7..8d2f713 100644 --- a/lib/client/SteamApiClient.dart +++ b/lib/client/SteamApiClient.dart @@ -15,5 +15,6 @@ abstract class SteamApiClient { @GET("/api/appdetails") Future getSteamGameResultByAppId( @Query("appids") String appId, + @Query("l") String language ); } \ No newline at end of file diff --git a/lib/client/SteamApiClient.g.dart b/lib/client/SteamApiClient.g.dart index 4a2cf73..dbc7f39 100644 --- a/lib/client/SteamApiClient.g.dart +++ b/lib/client/SteamApiClient.g.dart @@ -24,9 +24,15 @@ class _SteamApiClient implements SteamApiClient { final ParseErrorLogger? errorLogger; @override - Future getSteamGameResultByAppId(String appId) async { + Future getSteamGameResultByAppId( + String appId, + String language, + ) async { final _extra = {}; - final queryParameters = {r'appids': appId}; + final queryParameters = { + r'appids': appId, + r'l': language, + }; final _headers = {}; const Map? _data = null; final _options = _setStreamType(Options( diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 6dbc21b..a24dbd4 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -66,74 +66,76 @@ class MessageLookup extends MessageLookupByLibrary { static String m20(device) => "Sent by ${device}."; - static String m21(readAccess, star) => + static String m21(language) => "Not support ${language}"; + + static String m22(readAccess, star) => "Read Access: ${readAccess} and Star: ${star}"; - static String m22(hour) => "${hour} hours ago"; + static String m23(hour) => "${hour} hours ago"; - static String m23(hour) => "${hour} hours later"; + static String m24(hour) => "${hour} hours later"; - static String m24(uri) => "Unable to open the uri: ${uri}."; + static String m25(uri) => "Unable to open the uri: ${uri}."; - static String m25(name) => "${name}\'s Linux device"; + static String m26(name) => "${name}\'s Linux device"; - static String m26(name) => "${name}\'s MacOS device"; + static String m27(name) => "${name}\'s MacOS device"; - static String m27(min) => "${min} minutes ago"; + static String m28(min) => "${min} minutes ago"; - static String m28(min) => "${min} minutes later"; + static String m29(min) => "${min} minutes later"; - static String m29(discuz) => + static String m30(discuz) => "No subscription channel exists for ${discuz} now."; - static String m30(hour) => "${hour} hour(s)."; + static String m31(hour) => "${hour} hour(s)."; - static String m31(pictureBedName) => "Service provided by ${pictureBedName}"; + static String m32(pictureBedName) => "Service provided by ${pictureBedName}"; - static String m32(time) => "Poll will expire at ${time}."; + static String m33(time) => "Poll will expire at ${time}."; - static String m33(people) => "${people} have voted."; + static String m34(people) => "${people} have voted."; - static String m34(pos) => "# ${pos}"; + static String m35(pos) => "# ${pos}"; - static String m35(discuz) => "${discuz} may not support push service"; + static String m36(discuz) => "${discuz} may not support push service"; - static String m36(pid, ptid, author, fullTimeString, trimMessage) => + static String m37(pid, ptid, author, fullTimeString, trimMessage) => "[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=${pid}&ptid=${ptid}]${author} posted at ${fullTimeString}[/url][/size]\n${trimMessage}[/quote]"; - static String m37(name) => "Report ${name}"; + static String m38(name) => "Report ${name}"; - static String m38(discuzName) => "Report to the ${discuzName} Successfully"; + static String m39(discuzName) => "Report to the ${discuzName} Successfully"; - static String m39(username, discuzName) => + static String m40(username, discuzName) => "User ${username} sign in at ${discuzName} successfully."; - static String m40(discuzName) => "Sign in at ${discuzName}"; + static String m41(discuzName) => "Sign in at ${discuzName}"; - static String m41(index) => "Smiley #${index}"; + static String m42(index) => "Smiley #${index}"; - static String m42(checked, allowed) => "Submit (${checked} / ${allowed})"; + static String m43(checked, allowed) => "Submit (${checked} / ${allowed})"; - static String m43(title) => "Successfully remove view history ${title}."; + static String m44(title) => "Successfully remove view history ${title}."; - static String m44(filename) => "Successfully download file: ${filename}."; + static String m45(filename) => "Successfully download file: ${filename}."; - static String m45(num) => + static String m46(num) => "All ${num} favorite threads are synced from the server."; - static String m46(num) => "RP ${num}"; + static String m47(num) => "RP ${num}"; - static String m47(reply) => "${reply} replies"; + static String m48(reply) => "${reply} replies"; - static String m48(view) => "${view} views"; + static String m49(view) => "${view} views"; - static String m49(username) => "User ${username} expired"; + static String m50(username) => "User ${username} expired"; - static String m50(uid) => "UserId ${uid}"; + static String m51(uid) => "UserId ${uid}"; - static String m51(user) => "View ${user}\'s profile."; + static String m52(user) => "View ${user}\'s profile."; - static String m52(name) => "${name}\'s Windows device"; + static String m53(name) => "${name}\'s Windows device"; final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { @@ -565,12 +567,13 @@ class MessageLookup extends MessageLookupByLibrary { "fuchsia": MessageLookupByLibrary.simpleMessage("Fuchsia"), "gameComingSoon": MessageLookupByLibrary.simpleMessage("Coming Soon"), "gameFreeOfCharge": MessageLookupByLibrary.simpleMessage("Free"), + "gameLanguageNotSupported": m21, "goToPushSetting": MessageLookupByLibrary.simpleMessage("Enable push service"), "googleAdSubTitle": MessageLookupByLibrary.simpleMessage( "Advertisement provided by Google"), "googleAdTitle": MessageLookupByLibrary.simpleMessage("AD"), - "groupInfoDescription": m21, + "groupInfoDescription": m22, "habit": MessageLookupByLibrary.simpleMessage("Habits"), "hapticFeedbackTitle": MessageLookupByLibrary.simpleMessage("Vibration feedback"), @@ -579,8 +582,8 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Host is empty in the form."), "hotThread": MessageLookupByLibrary.simpleMessage("Popular"), "hour": MessageLookupByLibrary.simpleMessage("H"), - "hourAgo": m22, - "hourLater": m23, + "hourAgo": m23, + "hourLater": m24, "httpBrowseWarn": MessageLookupByLibrary.simpleMessage("HTTP protocol warning"), "iframeUrlNull": MessageLookupByLibrary.simpleMessage( @@ -622,8 +625,8 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Law information"), "legalInformation": MessageLookupByLibrary.simpleMessage("Legal information"), - "linkUnableToOpen": m24, - "linuxDeviceName": m25, + "linkUnableToOpen": m25, + "linuxDeviceName": m26, "loadFailed": MessageLookupByLibrary.simpleMessage("Load failed"), "loadFinish": MessageLookupByLibrary.simpleMessage("Load completed"), "loadMore": MessageLookupByLibrary.simpleMessage("LoadMore"), @@ -643,7 +646,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("How to login by web?"), "loginSubtitle": MessageLookupByLibrary.simpleMessage("Add a new user"), "loginTitle": MessageLookupByLibrary.simpleMessage("Login"), - "macOSDeviceName": m26, + "macOSDeviceName": m27, "manageAccount": MessageLookupByLibrary.simpleMessage("Manage account"), "manageAccountTitle": MessageLookupByLibrary.simpleMessage("Manage accounts"), @@ -659,8 +662,8 @@ class MessageLookup extends MessageLookupByLibrary { "me": MessageLookupByLibrary.simpleMessage("Me"), "menuIconTooltip": MessageLookupByLibrary.simpleMessage("Menu"), "minute": MessageLookupByLibrary.simpleMessage("M"), - "minuteAgo": m27, - "minuteLater": m28, + "minuteAgo": m28, + "minuteLater": m29, "mobileTemplateNotFound": MessageLookupByLibrary.simpleMessage( "This page is optimized for web view."), "more": MessageLookupByLibrary.simpleMessage("More"), @@ -688,7 +691,7 @@ class MessageLookup extends MessageLookupByLibrary { "noSignature": MessageLookupByLibrary.simpleMessage("No signature"), "noSmileyFoundInDB": MessageLookupByLibrary.simpleMessage( "Try to use the first smiley?"), - "noSubscribeChannelProvided": m29, + "noSubscribeChannelProvided": m30, "notification": MessageLookupByLibrary.simpleMessage("Notification"), "nullDiscuzScreenSubtitle": MessageLookupByLibrary.simpleMessage( "Add discuz ! now to Disfly to enjoy the app."), @@ -699,7 +702,7 @@ class MessageLookup extends MessageLookupByLibrary { "nullDiscuzTitle": MessageLookupByLibrary.simpleMessage("No Discuz! BBS is selected"), "ok": MessageLookupByLibrary.simpleMessage("OK"), - "onlineHours": m30, + "onlineHours": m31, "onlineHoursTitle": MessageLookupByLibrary.simpleMessage("Online Time"), "onlyViewAuthor": MessageLookupByLibrary.simpleMessage("OP mode / View all"), @@ -740,21 +743,21 @@ class MessageLookup extends MessageLookupByLibrary { "These service are not provided by us but the 3rd party service. We exclude any warranties or obligation to them. Some of them are not operated in China and you shall carefully watch their policy change to accommodate your use."), "pictureBedTermsSubtitle": MessageLookupByLibrary.simpleMessage( "This service is not provided by us but the 3rd party services and we exclude all warranties for it. Using our service does not mean you are granted with 3rd party service as mentioned in our terms. You shall agree to their terms before using 3rd party service."), - "pictureBedTermsTitle": m31, + "pictureBedTermsTitle": m32, "pictureBedTitle": MessageLookupByLibrary.simpleMessage("Image hosting website"), "pictureTagInMessage": MessageLookupByLibrary.simpleMessage("[Pic]"), "policy": MessageLookupByLibrary.simpleMessage("Our policy"), - "pollExpireAt": m32, + "pollExpireAt": m33, "pollNotAllowed": MessageLookupByLibrary.simpleMessage( "You can\'t join in the polls."), "pollTitle": MessageLookupByLibrary.simpleMessage("Poll (single selection)"), - "pollVoterNumber": m33, + "pollVoterNumber": m34, "post": MessageLookupByLibrary.simpleMessage("Post"), "postAuthorLabel": MessageLookupByLibrary.simpleMessage("OP"), "postNumber": MessageLookupByLibrary.simpleMessage("Post number"), - "postPosition": m34, + "postPosition": m35, "preparingPage": MessageLookupByLibrary.simpleMessage("Preparing the page."), "preventAbuseUser": MessageLookupByLibrary.simpleMessage( @@ -834,7 +837,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("The push service is not on."), "pushServiceOnDescription": MessageLookupByLibrary.simpleMessage( "You are now able to get the updated information from supported Discuz."), - "pushServiceSiteNotSupport": m35, + "pushServiceSiteNotSupport": m36, "pushTermsOfService": MessageLookupByLibrary.simpleMessage("Terms of push services"), "pushThreadTitle": MessageLookupByLibrary.simpleMessage("Publish"), @@ -870,8 +873,8 @@ class MessageLookup extends MessageLookupByLibrary { "rememeberPasswordInApp": MessageLookupByLibrary.simpleMessage( "Remember password to device."), "replyPost": MessageLookupByLibrary.simpleMessage("Reply"), - "replyPostTrimMessage": m36, - "reportContentTitle": m37, + "replyPostTrimMessage": m37, + "reportContentTitle": m38, "reportDiscuzApiInformationToAnalytics": MessageLookupByLibrary.simpleMessage("Report availability to us"), "reportDiscuzApiInformationToAnalyticsDescription": @@ -881,7 +884,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Report availability to us"), "reportOtherReasonHint": MessageLookupByLibrary.simpleMessage("Type to report other reason"), - "reportSuccessfully": m38, + "reportSuccessfully": m39, "reportThreadTooltip": MessageLookupByLibrary.simpleMessage("Report the post"), "residentPlace": MessageLookupByLibrary.simpleMessage("Resident place"), @@ -924,8 +927,8 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Input thread id (tid)"), "shortcutUidHint": MessageLookupByLibrary.simpleMessage("Input user id (uid)"), - "signInSuccessTitle": m39, - "signInTitle": m40, + "signInSuccessTitle": m40, + "signInTitle": m41, "signInViaBrowser": MessageLookupByLibrary.simpleMessage("Sign in by web"), "signUp": MessageLookupByLibrary.simpleMessage("Sign up"), @@ -943,7 +946,7 @@ class MessageLookup extends MessageLookupByLibrary { "siteDoesNotSupportPushService": MessageLookupByLibrary.simpleMessage( "The site may not install DHP Service."), "sitePage": MessageLookupByLibrary.simpleMessage("Homepage"), - "smileyLabel": m41, + "smileyLabel": m42, "sortThreadInAscendOrder": MessageLookupByLibrary.simpleMessage("Sort thread in ascent order"), "sortThreadInDescendOrder": MessageLookupByLibrary.simpleMessage( @@ -951,7 +954,7 @@ class MessageLookup extends MessageLookupByLibrary { "spam": MessageLookupByLibrary.simpleMessage("Spam"), "stickyThread": MessageLookupByLibrary.simpleMessage("Pinned thread"), "style": MessageLookupByLibrary.simpleMessage("Style"), - "submitPoll": m42, + "submitPoll": m43, "subscribe": MessageLookupByLibrary.simpleMessage("Subscribe"), "subscribeChannel": MessageLookupByLibrary.simpleMessage("Push subscription"), @@ -959,9 +962,9 @@ class MessageLookup extends MessageLookupByLibrary { "Subscribe to the channels to get updates."), "subscriptionSuccess": MessageLookupByLibrary.simpleMessage( "Subscription change successful."), - "successfullyDeleteViewHistoryContent": m43, - "successfullyDownloadFiles": m44, - "syncSuccessfullyWithServer": m45, + "successfullyDeleteViewHistoryContent": m44, + "successfullyDownloadFiles": m45, + "syncSuccessfullyWithServer": m46, "takeAPicture": MessageLookupByLibrary.simpleMessage("Shot"), "tapToWipeAndRelogin": MessageLookupByLibrary.simpleMessage( "Tap to wipe out and re-login user"), @@ -976,9 +979,9 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Take a bite on beta test"), "threadIsClosed": MessageLookupByLibrary.simpleMessage("Thread is closed."), - "threadReadAccess": m46, - "threadReply": m47, - "threadView": m48, + "threadReadAccess": m47, + "threadReply": m48, + "threadView": m49, "trashAd": MessageLookupByLibrary.simpleMessage("Trash Advertisement"), "trustHostActionText": MessageLookupByLibrary.simpleMessage("Trust this host"), @@ -1065,8 +1068,8 @@ class MessageLookup extends MessageLookupByLibrary { "userCredit": MessageLookupByLibrary.simpleMessage("Credits"), "userExpiredSubtitle": MessageLookupByLibrary.simpleMessage( "The current user is expired, some function may not work."), - "userExpiredTitle": m49, - "userIdTitle": m50, + "userExpiredTitle": m50, + "userIdTitle": m51, "userPost": MessageLookupByLibrary.simpleMessage("Posts"), "userProfile": MessageLookupByLibrary.simpleMessage("User Profile"), "userProfileTitle": @@ -1085,7 +1088,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("View a thread"), "viewThreadTwoPaneText": MessageLookupByLibrary.simpleMessage( "Click thread to view posts inside."), - "viewUserInfo": m51, + "viewUserInfo": m52, "warnedPost": MessageLookupByLibrary.simpleMessage("The post is warned."), "watchPictureInFullScreen": @@ -1096,7 +1099,7 @@ class MessageLookup extends MessageLookupByLibrary { "Welcome to use our Services."), "welcomeTitle": MessageLookupByLibrary.simpleMessage("Welcome"), "wheelColorPickerType": MessageLookupByLibrary.simpleMessage("Wheel"), - "windowsDeviceName": m52, + "windowsDeviceName": m53, "workProcedure": MessageLookupByLibrary.simpleMessage("How does push service work?"), "writeStorageDenied": MessageLookupByLibrary.simpleMessage( diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index 1b0572c..ffe2d78 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -65,71 +65,73 @@ class MessageLookup extends MessageLookupByLibrary { static String m20(device) => "消息由${device}发出。"; - static String m21(readAccess, star) => "阅读权限: ${readAccess}, 等级: ${star}"; + static String m21(language) => "不支持${language}"; - static String m22(hour) => "${hour}小时前"; + static String m22(readAccess, star) => "阅读权限: ${readAccess}, 等级: ${star}"; - static String m23(hour) => "${hour}小时后"; + static String m23(hour) => "${hour}小时前"; - static String m24(uri) => "无法打开此链接 : ${uri}."; + static String m24(hour) => "${hour}小时后"; - static String m25(name) => "${name}的Linux电脑"; + static String m25(uri) => "无法打开此链接 : ${uri}."; - static String m26(name) => "${name}的MacOS设备"; + static String m26(name) => "${name}的Linux电脑"; - static String m27(min) => "${min}分钟前"; + static String m27(name) => "${name}的MacOS设备"; - static String m28(min) => "${min}分钟后"; + static String m28(min) => "${min}分钟前"; - static String m29(discuz) => "${discuz}目前还没有任何订阅消息"; + static String m29(min) => "${min}分钟后"; - static String m30(hour) => "${hour}小时"; + static String m30(discuz) => "${discuz}目前还没有任何订阅消息"; - static String m31(pictureBedName) => "此服务由${pictureBedName}提供"; + static String m31(hour) => "${hour}小时"; - static String m32(time) => "该投票于${time}过期."; + static String m32(pictureBedName) => "此服务由${pictureBedName}提供"; - static String m33(people) => "共有${people}人已投票."; + static String m33(time) => "该投票于${time}过期."; - static String m34(pos) => "第${pos}层"; + static String m34(people) => "共有${people}人已投票."; - static String m35(discuz) => "${discuz}并未启用推送服务"; + static String m35(pos) => "第${pos}层"; - static String m36(pid, ptid, author, fullTimeString, trimMessage) => + static String m36(discuz) => "${discuz}并未启用推送服务"; + + static String m37(pid, ptid, author, fullTimeString, trimMessage) => "[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=${pid}&ptid=${ptid}]${author} 发表于 ${fullTimeString}[/url][/size]\n${trimMessage}[/quote]"; - static String m37(name) => "举报${name}的内容"; + static String m38(name) => "举报${name}的内容"; - static String m38(discuzName) => "成功向${discuzName}发送了举报信息,请等待管理员回应。"; + static String m39(discuzName) => "成功向${discuzName}发送了举报信息,请等待管理员回应。"; - static String m39(username, discuzName) => + static String m40(username, discuzName) => "用户 ${username} 已成功登录到 ${discuzName}。"; - static String m40(discuzName) => "登录至 ${discuzName}"; + static String m41(discuzName) => "登录至 ${discuzName}"; - static String m41(index) => "表情 ${index}"; + static String m42(index) => "表情 ${index}"; - static String m42(checked, allowed) => "投票 (${checked} / ${allowed})"; + static String m43(checked, allowed) => "投票 (${checked} / ${allowed})"; - static String m43(title) => "成功删除历史记录 ${title}."; + static String m44(title) => "成功删除历史记录 ${title}."; - static String m44(filename) => "成功下载文件: ${filename}。"; + static String m45(filename) => "成功下载文件: ${filename}。"; - static String m45(num) => "已同步所有${num}个收藏的帖子"; + static String m46(num) => "已同步所有${num}个收藏的帖子"; - static String m46(num) => "阅读权限 ${num}"; + static String m47(num) => "阅读权限 ${num}"; - static String m47(reply) => "${reply}回复"; + static String m48(reply) => "${reply}回复"; - static String m48(view) => "${view}浏览"; + static String m49(view) => "${view}浏览"; - static String m49(username) => "用户 ${username} 已失效"; + static String m50(username) => "用户 ${username} 已失效"; - static String m50(uid) => "用户编号: ${uid}"; + static String m51(uid) => "用户编号: ${uid}"; - static String m51(user) => "查看${user}详情"; + static String m52(user) => "查看${user}详情"; - static String m52(name) => "${name}的Windows电脑"; + static String m53(name) => "${name}的Windows电脑"; final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { @@ -492,19 +494,20 @@ class MessageLookup extends MessageLookupByLibrary { "fuchsia": MessageLookupByLibrary.simpleMessage("Fuchsia"), "gameComingSoon": MessageLookupByLibrary.simpleMessage("即将发售"), "gameFreeOfCharge": MessageLookupByLibrary.simpleMessage("免费"), + "gameLanguageNotSupported": m21, "goToPushSetting": MessageLookupByLibrary.simpleMessage("开启推送"), "googleAdSubTitle": MessageLookupByLibrary.simpleMessage("由Google提供的广告"), "googleAdTitle": MessageLookupByLibrary.simpleMessage("广告"), - "groupInfoDescription": m21, + "groupInfoDescription": m22, "habit": MessageLookupByLibrary.simpleMessage("爱好"), "hapticFeedbackTitle": MessageLookupByLibrary.simpleMessage("振动反馈"), "homepage": MessageLookupByLibrary.simpleMessage("个人主页"), "hostIsEmpty": MessageLookupByLibrary.simpleMessage("请选择一个已有的论坛。"), "hotThread": MessageLookupByLibrary.simpleMessage("最新热门"), "hour": MessageLookupByLibrary.simpleMessage("时"), - "hourAgo": m22, - "hourLater": m23, + "hourAgo": m23, + "hourLater": m24, "httpBrowseWarn": MessageLookupByLibrary.simpleMessage("不安全的HTTP协议"), "iframeUrlNull": MessageLookupByLibrary.simpleMessage("无法解析嵌入视图的来源。"), "illegalContent": MessageLookupByLibrary.simpleMessage("违法内容"), @@ -537,8 +540,8 @@ class MessageLookup extends MessageLookupByLibrary { "lastVisitTime": MessageLookupByLibrary.simpleMessage("上次访问时间"), "lawInformation": MessageLookupByLibrary.simpleMessage("法律信息"), "legalInformation": MessageLookupByLibrary.simpleMessage("法律信息"), - "linkUnableToOpen": m24, - "linuxDeviceName": m25, + "linkUnableToOpen": m25, + "linuxDeviceName": m26, "loadFailed": MessageLookupByLibrary.simpleMessage("加载失败"), "loadFinish": MessageLookupByLibrary.simpleMessage("加载完成"), "loadMore": MessageLookupByLibrary.simpleMessage("加载"), @@ -557,7 +560,7 @@ class MessageLookup extends MessageLookupByLibrary { "loginByWebTitle": MessageLookupByLibrary.simpleMessage("使用网页登录提醒"), "loginSubtitle": MessageLookupByLibrary.simpleMessage("添加一个新的用户"), "loginTitle": MessageLookupByLibrary.simpleMessage("登录"), - "macOSDeviceName": m26, + "macOSDeviceName": m27, "manageAccount": MessageLookupByLibrary.simpleMessage("管理账号"), "manageAccountTitle": MessageLookupByLibrary.simpleMessage("管理账号"), "manageDiscuz": MessageLookupByLibrary.simpleMessage("管理论坛"), @@ -570,8 +573,8 @@ class MessageLookup extends MessageLookupByLibrary { "me": MessageLookupByLibrary.simpleMessage("我"), "menuIconTooltip": MessageLookupByLibrary.simpleMessage("菜单"), "minute": MessageLookupByLibrary.simpleMessage("分"), - "minuteAgo": m27, - "minuteLater": m28, + "minuteAgo": m28, + "minuteLater": m29, "mobileTemplateNotFound": MessageLookupByLibrary.simpleMessage("此界面更适合使用网页访问"), "more": MessageLookupByLibrary.simpleMessage("更多"), @@ -595,7 +598,7 @@ class MessageLookup extends MessageLookupByLibrary { "noMore": MessageLookupByLibrary.simpleMessage("没有更多数据"), "noSignature": MessageLookupByLibrary.simpleMessage("不使用签名"), "noSmileyFoundInDB": MessageLookupByLibrary.simpleMessage("要不使用一个表情包?"), - "noSubscribeChannelProvided": m29, + "noSubscribeChannelProvided": m30, "notification": MessageLookupByLibrary.simpleMessage("通知"), "nullDiscuzScreenSubtitle": MessageLookupByLibrary.simpleMessage("现在开始添加一个Discuz X论坛以开始使用谈坛。"), @@ -605,7 +608,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("现在就添加一个论坛吗?"), "nullDiscuzTitle": MessageLookupByLibrary.simpleMessage("还没有指定一个论坛"), "ok": MessageLookupByLibrary.simpleMessage("确定"), - "onlineHours": m30, + "onlineHours": m31, "onlineHoursTitle": MessageLookupByLibrary.simpleMessage("在线时间"), "onlyViewAuthor": MessageLookupByLibrary.simpleMessage("只看作者 / 查看全部"), "openFileInExternalAppActionText": @@ -638,19 +641,19 @@ class MessageLookup extends MessageLookupByLibrary { "上述所有服务并非由谈坛(我们,第一方)或者您浏览的论坛,而是由第三方提供。根据我们的使用协议,我们并不担保和授权任何第三方服务,使用我们的服务也并不会自动授权、默许和担保您使用这些第三方服务。因此,您需要在使用服务前,同意他们的使用协议、隐私政策以及其他协议。您同样应当定时查看这些协议以防止政策变更给您带来的不便。最后,有些服务并非在中国展开,您需要注意其在中国的可使用性、可靠性以及相关的法律适用性。"), "pictureBedTermsSubtitle": MessageLookupByLibrary.simpleMessage( "请注意,此服务并非由我们提供。根据我们的服务条款,使用我们的服务并不代表您获得了第三方服务的授权,并且我们并不对第三方服务做出任何承诺或者担保。在使用第三方服务前,您需要同意他们的服务条款以及隐私政策。"), - "pictureBedTermsTitle": m31, + "pictureBedTermsTitle": m32, "pictureBedTitle": MessageLookupByLibrary.simpleMessage("图床"), "pictureTagInMessage": MessageLookupByLibrary.simpleMessage("[图片]"), "policy": MessageLookupByLibrary.simpleMessage("条款"), - "pollExpireAt": m32, + "pollExpireAt": m33, "pollNotAllowed": MessageLookupByLibrary.simpleMessage( "目前您无法参与投票。(显示的投中的选项与真实结果不符合)"), "pollTitle": MessageLookupByLibrary.simpleMessage("投票(目前我们只支持单选)"), - "pollVoterNumber": m33, + "pollVoterNumber": m34, "post": MessageLookupByLibrary.simpleMessage("发帖"), "postAuthorLabel": MessageLookupByLibrary.simpleMessage("楼主"), "postNumber": MessageLookupByLibrary.simpleMessage("回帖数"), - "postPosition": m34, + "postPosition": m35, "preparingPage": MessageLookupByLibrary.simpleMessage("正在准备此界面。"), "preventAbuseUser": MessageLookupByLibrary.simpleMessage("请勿使用此应用发表令人反感的内容或其他滥用行为"), @@ -719,7 +722,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("推送服务并未开启,请开启后再试试?"), "pushServiceOnDescription": MessageLookupByLibrary.simpleMessage("您现在就可以接收来自已授权论坛的推送啦~"), - "pushServiceSiteNotSupport": m35, + "pushServiceSiteNotSupport": m36, "pushTermsOfService": MessageLookupByLibrary.simpleMessage("推送服务条款"), "pushThreadTitle": MessageLookupByLibrary.simpleMessage("发帖"), "pushThreadTitleHint": MessageLookupByLibrary.simpleMessage("帖子标题"), @@ -749,8 +752,8 @@ class MessageLookup extends MessageLookupByLibrary { "rememeberPasswordInApp": MessageLookupByLibrary.simpleMessage("将登陆凭证在此设备中存储。"), "replyPost": MessageLookupByLibrary.simpleMessage("回复"), - "replyPostTrimMessage": m36, - "reportContentTitle": m37, + "replyPostTrimMessage": m37, + "reportContentTitle": m38, "reportDiscuzApiInformationToAnalytics": MessageLookupByLibrary.simpleMessage("向我们报告论坛API可用性"), "reportDiscuzApiInformationToAnalyticsDescription": @@ -759,7 +762,7 @@ class MessageLookup extends MessageLookupByLibrary { "reportDiscuzApiInformationToAnalyticsTitle": MessageLookupByLibrary.simpleMessage("帮助我们优化应用"), "reportOtherReasonHint": MessageLookupByLibrary.simpleMessage("提供举报原因"), - "reportSuccessfully": m38, + "reportSuccessfully": m39, "reportThreadTooltip": MessageLookupByLibrary.simpleMessage("举报不当内容"), "residentPlace": MessageLookupByLibrary.simpleMessage("居住地"), "retry": MessageLookupByLibrary.simpleMessage("重试"), @@ -791,8 +794,8 @@ class MessageLookup extends MessageLookupByLibrary { "shortcutGo": MessageLookupByLibrary.simpleMessage("跳转"), "shortcutTidHint": MessageLookupByLibrary.simpleMessage("输入帖子编号 (tid)"), "shortcutUidHint": MessageLookupByLibrary.simpleMessage("输入用户编号 (uid)"), - "signInSuccessTitle": m39, - "signInTitle": m40, + "signInSuccessTitle": m40, + "signInTitle": m41, "signInViaBrowser": MessageLookupByLibrary.simpleMessage("使用网页登录"), "signUp": MessageLookupByLibrary.simpleMessage("注册"), "signatureHint": MessageLookupByLibrary.simpleMessage("在此键入签名"), @@ -805,7 +808,7 @@ class MessageLookup extends MessageLookupByLibrary { "siteDoesNotSupportPushService": MessageLookupByLibrary.simpleMessage("该论坛未开启推送插件。"), "sitePage": MessageLookupByLibrary.simpleMessage("主页"), - "smileyLabel": m41, + "smileyLabel": m42, "sortThreadInAscendOrder": MessageLookupByLibrary.simpleMessage("从旧到新排列"), "sortThreadInDescendOrder": @@ -813,16 +816,16 @@ class MessageLookup extends MessageLookupByLibrary { "spam": MessageLookupByLibrary.simpleMessage("恶意灌水"), "stickyThread": MessageLookupByLibrary.simpleMessage("置顶帖"), "style": MessageLookupByLibrary.simpleMessage("样式"), - "submitPoll": m42, + "submitPoll": m43, "subscribe": MessageLookupByLibrary.simpleMessage("订阅"), "subscribeChannel": MessageLookupByLibrary.simpleMessage("订阅推送"), "subscribeChannelForMore": MessageLookupByLibrary.simpleMessage("订阅此论坛频道获得实时的最新消息"), "subscriptionSuccess": MessageLookupByLibrary.simpleMessage("成功同步至推送服务器"), - "successfullyDeleteViewHistoryContent": m43, - "successfullyDownloadFiles": m44, - "syncSuccessfullyWithServer": m45, + "successfullyDeleteViewHistoryContent": m44, + "successfullyDownloadFiles": m45, + "syncSuccessfullyWithServer": m46, "takeAPicture": MessageLookupByLibrary.simpleMessage("照相"), "tapToWipeAndRelogin": MessageLookupByLibrary.simpleMessage("点击以移除此用户并重新登陆"), @@ -835,9 +838,9 @@ class MessageLookup extends MessageLookupByLibrary { "testVersionNotificationTitle": MessageLookupByLibrary.simpleMessage("欢迎参与测试版本"), "threadIsClosed": MessageLookupByLibrary.simpleMessage("此贴已关闭发帖。"), - "threadReadAccess": m46, - "threadReply": m47, - "threadView": m48, + "threadReadAccess": m47, + "threadReply": m48, + "threadView": m49, "trashAd": MessageLookupByLibrary.simpleMessage("垃圾广告"), "trustHostActionText": MessageLookupByLibrary.simpleMessage("信任此域名"), "trustHostTitle": MessageLookupByLibrary.simpleMessage("主机域名白名单"), @@ -913,8 +916,8 @@ class MessageLookup extends MessageLookupByLibrary { "userCredit": MessageLookupByLibrary.simpleMessage("积分"), "userExpiredSubtitle": MessageLookupByLibrary.simpleMessage("当前用户授权已过期,你需要重新登录以重新激活此用户。"), - "userExpiredTitle": m49, - "userIdTitle": m50, + "userExpiredTitle": m50, + "userIdTitle": m51, "userPost": MessageLookupByLibrary.simpleMessage("回复"), "userProfile": MessageLookupByLibrary.simpleMessage("用户中心"), "userProfileTitle": MessageLookupByLibrary.simpleMessage("用户信息"), @@ -928,7 +931,7 @@ class MessageLookup extends MessageLookupByLibrary { "viewThreadTitle": MessageLookupByLibrary.simpleMessage("查看帖子"), "viewThreadTwoPaneText": MessageLookupByLibrary.simpleMessage("点击左侧的帖子以查看内容。"), - "viewUserInfo": m51, + "viewUserInfo": m52, "warnedPost": MessageLookupByLibrary.simpleMessage("此贴被警告。"), "watchPictureInFullScreen": MessageLookupByLibrary.simpleMessage("查看大图"), @@ -938,7 +941,7 @@ class MessageLookup extends MessageLookupByLibrary { "谈坛是支持Discuz X论坛的第三方客户端,欢迎使用我们的服务。"), "welcomeTitle": MessageLookupByLibrary.simpleMessage("你好"), "wheelColorPickerType": MessageLookupByLibrary.simpleMessage("轮抽选色"), - "windowsDeviceName": m52, + "windowsDeviceName": m53, "workProcedure": MessageLookupByLibrary.simpleMessage("推送服务是如何工作的?"), "writeStorageDenied": MessageLookupByLibrary.simpleMessage("无法获得写入权限。") }; diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 69188e3..c65e9b1 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -5960,6 +5960,16 @@ class S { args: [], ); } + + /// `Not support {language}` + String gameLanguageNotSupported(Object language) { + return Intl.message( + 'Not support $language', + name: 'gameLanguageNotSupported', + desc: '', + args: [language], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 72c732f..1b2ff10 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -867,5 +867,11 @@ }, "openGameInSteam": "View in Steam", "gameFreeOfCharge": "Free", - "gameComingSoon": "Coming Soon" + "gameComingSoon": "Coming Soon", + "gameLanguageNotSupported": "Not support {language}", + "@gameLanguageNotSupported": { + "placeholders": { + "language": {} + } + } } \ No newline at end of file diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 807e5b6..a004ed9 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -868,6 +868,12 @@ }, "openGameInSteam": "在Steam中打开", "gameFreeOfCharge": "免费", - "gameComingSoon": "即将发售" + "gameComingSoon": "即将发售", + "gameLanguageNotSupported": "不支持{language}", + "@gameLanguageNotSupported": { + "placeholders": { + "language": {} + } + } } \ No newline at end of file diff --git a/lib/page/TestFlightBannerPage.dart b/lib/page/TestFlightBannerPage.dart index 85e1b71..ef3c943 100644 --- a/lib/page/TestFlightBannerPage.dart +++ b/lib/page/TestFlightBannerPage.dart @@ -10,6 +10,7 @@ import 'package:flutter_platform_widgets/flutter_platform_widgets.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:provider/provider.dart'; +import '../provider/ThemeNotifierProvider.dart'; import '../provider/UserPreferenceNotifierProvider.dart'; import '../utility/PostTextFieldUtils.dart'; diff --git a/lib/page/ViewThreadSliverPage.dart b/lib/page/ViewThreadSliverPage.dart index e7f7854..370f6f4 100644 --- a/lib/page/ViewThreadSliverPage.dart +++ b/lib/page/ViewThreadSliverPage.dart @@ -130,7 +130,7 @@ class _ViewThreadSliverState extends State { ButtonState _sendReplyStatus = ButtonState.idle; ViewThreadQuery viewThreadQuery = ViewThreadQuery(); Map> postCommentList = {}; - final FocusNode _focusNode = FocusNode(); + final FocusNode _focusNode = FocusNode(debugLabel: "view_thread_textfield"); // smiley=1, extra=2 or none = 0 int dialogStatus = 0; @@ -176,7 +176,7 @@ class _ViewThreadSliverState extends State { void bindFocusNode() { _focusNode.addListener(() { - //print("In focus node"); + debugDumpFocusTree(); if (_focusNode.hasFocus) { setState(() { dialogStatus = SHOW_NONE_DIALOG; @@ -190,9 +190,10 @@ class _ViewThreadSliverState extends State { _scrollController.addListener(() { // remove focus when + if (_focusNode.hasFocus) { DateTime now = DateTime.now(); - if(now.difference(lastFocusAt).inSeconds > 10){ + if(now.difference(lastFocusAt).inSeconds > 1){ print("Unfocus node due to scroll ${now.difference(lastFocusAt).inSeconds}"); _focusNode.unfocus(); } diff --git a/lib/utility/NetworkUtils.dart b/lib/utility/NetworkUtils.dart index c7d2ff3..97236f4 100644 --- a/lib/utility/NetworkUtils.dart +++ b/lib/utility/NetworkUtils.dart @@ -40,7 +40,7 @@ class NetworkUtils{ static Dio getDio(){ return Dio(BaseOptions( headers: { - 'Accept-Language': LanguageCode.code.code + 'Accept-Language': "zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.6" } )); } diff --git a/lib/widget/DiscuzHtmlWidget.dart b/lib/widget/DiscuzHtmlWidget.dart index d6e1c29..68f06c7 100644 --- a/lib/widget/DiscuzHtmlWidget.dart +++ b/lib/widget/DiscuzHtmlWidget.dart @@ -132,8 +132,9 @@ class DiscuzHtmlWidget extends StatelessWidget { }; } else if(element.className == "reply_wrap"){ return { - "background-color": "#${Theme.of(context).colorScheme.primaryContainer.value.toRadixString(16).substring(2)}", - "padding" : "0.1em", + "border": "0.4rem dashed #${Theme.of(context).colorScheme.primary.value.toRadixString(16).substring(2)}", + "background-color" : "#${Theme.of(context).colorScheme.primaryContainer.value.toRadixString(16).substring(2)}", + "padding" : "0.5em", "margin-bottom": "0.1em" }; } diff --git a/lib/widget/SteamGameWidget.dart b/lib/widget/SteamGameWidget.dart index b6c7853..84af3b4 100644 --- a/lib/widget/SteamGameWidget.dart +++ b/lib/widget/SteamGameWidget.dart @@ -14,6 +14,7 @@ import 'package:flutter_platform_widgets/flutter_platform_widgets.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:html_unescape/html_unescape.dart'; +import 'package:language_code/language_code.dart'; import 'package:provider/provider.dart'; import '../generated/l10n.dart'; @@ -51,6 +52,7 @@ class SteamGameState extends State { void initState() { // TODO: implement initState super.initState(); + loadGameState(); } @@ -68,7 +70,13 @@ class SteamGameState extends State { isLoading = true; }); - client.getSteamGameResultByAppId(appId).then((text) { + String languageCode = LanguageCode.code.englishName + .replaceAll(RegExp(r"\(.*?\)"), "") + .replaceAll(RegExp(r"\s"), "") + .toLowerCase(); + // check the chinese version there + + client.getSteamGameResultByAppId(appId, languageCode).then((text) { Map appIdResultJson = jsonDecode(text); if (appIdResultJson.containsKey(appId)) { Map gameDataJson = @@ -164,7 +172,8 @@ class SteamGameState extends State { width: double.infinity, child: CachedNetworkImage( imageUrl: steamGameDataResult.data.header_image, - width: double.infinity, + //width: double.infinity, + fit: BoxFit.fitWidth, ), ), Padding( @@ -205,7 +214,8 @@ class SteamGameState extends State { SafeArea(child: Container()), Row( children: [ - Expanded(child: Text( + Expanded( + child: Text( maxLines: 1, overflow: TextOverflow.ellipsis, steamGameDataResult.data.name.toUpperCase(), @@ -214,7 +224,6 @@ class SteamGameState extends State { fontWeight: FontWeight.bold, color: Theme.of(context).colorScheme.primary, fontSize: 24, - ), )), PlatformIconButton( @@ -228,27 +237,34 @@ class SteamGameState extends State { ), ], ), - CarouselSlider( - options: - CarouselOptions( - height: 160.0, - aspectRatio: 16 / 9, - autoPlay: true - ), - items: steamGameDataResult.data.screenshots - .map((screenshot) => Container( - margin: EdgeInsets.symmetric(horizontal: 4.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(0.0), - image: DecorationImage( - fit: BoxFit.cover, - image: CachedNetworkImageProvider( - screenshot.path_full), - )), - )) - .toList(), + LayoutBuilder(builder: (context, constraint) { + log("Get constraint maxWidth ${constraint.maxWidth}"); + return CarouselSlider( + options: CarouselOptions( + height: constraint.maxWidth > 960 + ? constraint.maxWidth * 0.4 + : 160, + aspectRatio: constraint.maxWidth > 960 ? 1 : 16 / 9, + viewportFraction: 0.8, + autoPlay: true), + items: steamGameDataResult.data.screenshots + .map((screenshot) => Container( + margin: EdgeInsets.symmetric(horizontal: 4.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.0), + image: DecorationImage( + fit: BoxFit.cover, + image: CachedNetworkImageProvider( + screenshot.path_full), + )), + )) + .toList(), + ); + }), + + SizedBox( + height: 8, ), - SizedBox(height: 8,), // SizedBox( // width: double.infinity, // child: Text( @@ -266,114 +282,175 @@ class SteamGameState extends State { children: [ Expanded( flex: 3, - child: RichText( - text: TextSpan( - children: steamGameDataResult.data.categories - .map((element) => WidgetSpan( - child: Container( - padding: EdgeInsets.all(4), - margin: EdgeInsets.only(right: 8, bottom: 8), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.primaryContainer, - borderRadius: BorderRadius.circular(4.0) - ), - child: Text(element.description, style: TextStyle( - color: Theme.of(context).colorScheme.onPrimaryContainer, - fontSize: 12 - ),), - ))) - .toList()), - ), + child: RichText( + text: TextSpan( + children: steamGameDataResult.data.categories + .map((element) => WidgetSpan( + child: Container( + padding: EdgeInsets.all(4), + margin: EdgeInsets.only( + right: 8, bottom: 8), + decoration: BoxDecoration( + color: Theme.of(context) + .colorScheme + .primaryContainer, + borderRadius: + BorderRadius.circular(4.0)), + child: Text( + element.description, + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onPrimaryContainer, + fontSize: 12), + ), + ))) + .toList()), + ), ), // price - if(steamGameDataResult.data.is_free) + if (steamGameDataResult.data.is_free) Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + // padding: EdgeInsets.all(4.0), + // margin: EdgeInsets.only(bottom: 8.0), + //color: Theme.of(context).colorScheme.primary, + child: Text( + S.of(context).gameFreeOfCharge.toUpperCase(), + style: TextStyle( + //color: Theme.of(context).colorScheme.onPrimary, + fontWeight: FontWeight.normal, + fontSize: 26), + ), + ), + ], + )), + if (!steamGameDataResult.data.is_free && + steamGameDataResult + .data.price_overview.currency.isNotEmpty) + Expanded( + flex: 1, child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - Container( - // padding: EdgeInsets.all(4.0), - // margin: EdgeInsets.only(bottom: 8.0), - //color: Theme.of(context).colorScheme.primary, - child: Text( - S.of(context).gameFreeOfCharge.toUpperCase(), - style: TextStyle( - //color: Theme.of(context).colorScheme.onPrimary, - fontWeight: FontWeight.normal, - fontSize: 26 - ), - ), - ), - ], - ) - ), - if(!steamGameDataResult.data.is_free && steamGameDataResult.data.price_overview.currency.isNotEmpty) - Expanded( - flex: 1, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - if(steamGameDataResult.data.release_date.coming_soon) - comingSoonContainer, - if(steamGameDataResult.data.price_overview.discount_percent != 0) - Container( - padding: EdgeInsets.all(4.0), - margin: EdgeInsets.only(bottom: 8.0), - color: Colors.green, - child: Text( + if (steamGameDataResult + .data.release_date.coming_soon) + comingSoonContainer, + if (steamGameDataResult.data.price_overview + .discount_percent != + 0) + Container( + padding: EdgeInsets.symmetric( + vertical: 2.0, horizontal: 8), + margin: EdgeInsets.only(bottom: 8.0), + color: + Theme.of(context).colorScheme.primary, + child: Text( "-${steamGameDataResult.data.price_overview.discount_percent}%", - style: TextStyle( - fontWeight: FontWeight.w800 + style: TextStyle( + fontWeight: FontWeight.w800, + color: Theme.of(context) + .colorScheme + .onPrimary), ), ), - ), - Text( - steamGameDataResult.data.price_overview.final_formatted, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 26 - ), - ), - if(steamGameDataResult.data.price_overview.discount_percent != 0) Text( - steamGameDataResult.data.price_overview.initial_formatted, + steamGameDataResult + .data.price_overview.final_formatted, + textAlign: TextAlign.end, style: TextStyle( - fontSize: 14, - - decoration: TextDecoration.lineThrough + fontSize: 26, ), ), - supportedPlatformRow, - ], - ) - ), + if (steamGameDataResult.data.price_overview + .discount_percent != + 0) + Text( + steamGameDataResult.data.price_overview + .initial_formatted, + style: TextStyle( + fontSize: 14, + decoration: + TextDecoration.lineThrough), + ), + supportedPlatformRow, + ], + )), ], ), - SizedBox(height: 8,), + SizedBox( + height: 8, + ), + Row( children: [ - Icon(Icons.translate, size: 16,), - SizedBox(width: 8.0,), - Expanded(child: HtmlWidget(steamGameDataResult.data.supported_languages, - textStyle: TextStyle( - color: Theme.of(context).disabledColor, - fontSize: 12 - ),) - ) + Icon( + Icons.translate, + size: 16, + ), + SizedBox( + width: 16.0, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + HtmlWidget( + steamGameDataResult.data.supported_languages, + textStyle: TextStyle( + color: Theme.of(context).disabledColor, + fontSize: 12), + ), + if (!steamGameDataResult.data.supported_languages + .contains(LanguageCode.code.nativeName + .replaceAll(RegExp(r"\(.*?\)"), "") + .replaceAll(RegExp(r"\s"), ""))) + Container( + padding: EdgeInsets.all(4.0), + //margin: EdgeInsets.only(bottom: 8), + //width: double.infinity, + decoration: BoxDecoration( + color: Theme.of(context) + .colorScheme + .errorContainer, + border: Border.all( + style: BorderStyle.none, + color: + Theme.of(context).colorScheme.error, + )), + child: Text( + S.of(context).gameLanguageNotSupported( + LanguageCode.code.nativeName), + textAlign: TextAlign.center, + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onErrorContainer, + fontSize: 12), + ), + ), + ], + )) ], - ) - , - SizedBox(height: 8,), - - + ), + SizedBox( + height: 8, + ), SizedBox( width: double.infinity, child: PlatformElevatedButton( onPressed: () { + // https://store.steampowered.com/app/990080 + String steamUrl = + "https://store.steampowered.com/app/${appId}"; VibrationUtils.vibrateWithClickIfPossible(); - URLUtils.openURL(context, null, url, null, null); + URLUtils.openURL(context, null, steamUrl, null, null); Navigator.of(context).pop(); }, color: Theme.of(context).colorScheme.inverseSurface, @@ -383,27 +460,29 @@ class SteamGameState extends State { color: Theme.of(context).colorScheme.surface, ), children: [ - WidgetSpan( - child: Icon( - FontAwesomeIcons.steam, - size: 18, - color: Theme.of(context).colorScheme.surface, - )), - WidgetSpan( - child: SizedBox( - width: 8.0, - )), - TextSpan( - text: S.of(context).openGameInSteam, - style: TextStyle( - color: + WidgetSpan( + child: Icon( + FontAwesomeIcons.steam, + size: 18, + color: Theme.of(context).colorScheme.surface, + )), + WidgetSpan( + child: SizedBox( + width: 8.0, + )), + TextSpan( + text: S.of(context).openGameInSteam, + style: TextStyle( + color: Theme.of(context).colorScheme.surface, - fontSize: 18), - ) - ])), + fontSize: 18), + ) + ])), ), ), - SizedBox(height: 16,), + SizedBox( + height: 16, + ), // HtmlWidget(steamGameDataResult.data.about_the_game), // Divider(), HtmlWidget(steamGameDataResult.data.detailed_description), @@ -421,48 +500,46 @@ class SteamGameState extends State { } Widget get supportedPlatformRow => Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - if(steamGameDataResult.data.platforms.windows) - Container( - margin: EdgeInsets.only(top: 8.0, left: 6.0), - child: Icon(FontAwesomeIcons.windows, size: 14), - ), - if(steamGameDataResult.data.platforms.mac) - Container( - margin: EdgeInsets.only(top: 8.0,left: 6.0), - child: Icon(FontAwesomeIcons.apple, size: 14), - ), - if(steamGameDataResult.data.platforms.linux) - Container( - margin: EdgeInsets.only(top: 8.0, left: 6.0), - child: Icon(FontAwesomeIcons.linux, size: 14,), - ) - ], - ); - - Widget get comingSoonContainer => Container( - padding: EdgeInsets.all(0), - margin: EdgeInsets.only(bottom: 4.0), - //color: Theme.of(context).colorScheme.primaryContainer, - child: RichText( - text: TextSpan( + mainAxisAlignment: MainAxisAlignment.end, children: [ - //WidgetSpan(child: Icon(PlatformIcons(context).clockSolid, size: 14, color: Theme.of(context).colorScheme.onPrimaryContainer,)), - //WidgetSpan(child: SizedBox(width: 4,)), - TextSpan( - text: steamGameDataResult.data.release_date.date, - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.normal, - fontStyle: FontStyle.normal, - decoration: TextDecoration.underline - ) - ) + if (steamGameDataResult.data.platforms.windows) + Container( + margin: EdgeInsets.only(top: 8.0, left: 6.0), + child: Icon(FontAwesomeIcons.windows, size: 14), + ), + if (steamGameDataResult.data.platforms.mac) + Container( + margin: EdgeInsets.only(top: 8.0, left: 6.0), + child: Icon(FontAwesomeIcons.apple, size: 14), + ), + if (steamGameDataResult.data.platforms.linux) + Container( + margin: EdgeInsets.only(top: 8.0, left: 6.0), + child: Icon( + FontAwesomeIcons.linux, + size: 14, + ), + ) + ], + ); - ] - ), - ), - ); + Widget get comingSoonContainer => Container( + padding: EdgeInsets.all(0), + margin: EdgeInsets.only(bottom: 4.0), + //color: Theme.of(context).colorScheme.primaryContainer, + child: RichText( + text: TextSpan(children: [ + //WidgetSpan(child: Icon(PlatformIcons(context).clockSolid, size: 14, color: Theme.of(context).colorScheme.onPrimaryContainer,)), + //WidgetSpan(child: SizedBox(width: 4,)), + TextSpan( + text: steamGameDataResult.data.release_date.date, + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.normal, + fontStyle: FontStyle.normal, + decoration: TextDecoration.underline)) + ]), + ), + ); }