From 53b3cac4ca1291814037d54ab93acd22e2dc6b39 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 4 Aug 2024 16:26:05 +0800 Subject: [PATCH] :wheelchair: Show hint when dismissible error --- lib/bootstrapper.dart | 78 +++++++++++++++++++++---------------- lib/translations/en_us.dart | 1 + lib/translations/zh_cn.dart | 1 + pubspec.yaml | 2 +- 4 files changed, 47 insertions(+), 35 deletions(-) diff --git a/lib/bootstrapper.dart b/lib/bootstrapper.dart index cd1be96..3544d9c 100644 --- a/lib/bootstrapper.dart +++ b/lib/bootstrapper.dart @@ -163,24 +163,25 @@ class _BootstrapperShellState extends State { @override Widget build(BuildContext context) { if (_isBusy || _isErrored) { - return Material( - color: Theme.of(context).colorScheme.surface, - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - height: 280, - child: Align( - alignment: Alignment.bottomCenter, - child: ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(16)), - child: Image.asset('assets/logo.png', width: 80, height: 80), + return GestureDetector( + child: Material( + color: Theme.of(context).colorScheme.surface, + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox( + height: 280, + child: Align( + alignment: Alignment.bottomCenter, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(16)), + child: + Image.asset('assets/logo.png', width: 80, height: 80), + ), ), ), - ), - GestureDetector( - child: Column( + Column( children: [ if (_isErrored && !_isDismissable && !_isBusy) const Icon(Icons.cancel, size: 24), @@ -215,6 +216,15 @@ class _BootstrapperShellState extends State { color: _unFocusColor, ), ).paddingOnly(bottom: 4), + if (!_isBusy && _isErrored && _isDismissable) + Text( + 'bsDismissibleErrorHint'.tr, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 13, + color: _unFocusColor, + ), + ).paddingOnly(bottom: 5), Text( '2024 © Solsynth LLC', textAlign: TextAlign.center, @@ -228,25 +238,25 @@ class _BootstrapperShellState extends State { ), ], ), - onTap: () { - if (_isBusy) return; - if (_isDismissable) { - setState(() { - _isBusy = false; - _isErrored = false; - }); - } else { - setState(() { - _isBusy = true; - _isErrored = false; - _periodCursor = 0; - }); - _runPeriods(); - } - }, - ) - ], + ], + ), ), + onTap: () { + if (_isBusy) return; + if (_isDismissable) { + setState(() { + _isBusy = false; + _isErrored = false; + }); + } else { + setState(() { + _isBusy = true; + _isErrored = false; + _periodCursor = 0; + }); + _runPeriods(); + } + }, ); } diff --git a/lib/translations/en_us.dart b/lib/translations/en_us.dart index 4185dd4..242c07c 100644 --- a/lib/translations/en_us.dart +++ b/lib/translations/en_us.dart @@ -333,6 +333,7 @@ const i18nEnglish = { 'bsEstablishingConn': 'Establishing Connection', 'bsPreparingData': 'Preparing User Data', 'bsRegisteringPushNotify': 'Enabling Push Notifications', + 'bsDismissibleErrorHint': 'Click anywhere to ignore this error', 'postShareContent': '@content\n\n@username on the Solar Network\nCheck it out: @link', 'postShareSubject': '@username posted a post on the Solar Network', diff --git a/lib/translations/zh_cn.dart b/lib/translations/zh_cn.dart index 17e8179..3cdfd4e 100644 --- a/lib/translations/zh_cn.dart +++ b/lib/translations/zh_cn.dart @@ -306,6 +306,7 @@ const i18nSimplifiedChinese = { 'bsEstablishingConn': '部署连接中', 'bsPreparingData': '正在准备用户资料', 'bsRegisteringPushNotify': '正在启用推送通知', + 'bsDismissibleErrorHint': '点击任意地方忽略此错误', 'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link', 'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子', 'themeColor': '全局主题色', diff --git a/pubspec.yaml b/pubspec.yaml index 835685a..e9a8efb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: solian description: "The Solar Network App" publish_to: "none" -version: 1.2.1+2 +version: 1.2.1+3 environment: sdk: ">=3.3.4 <4.0.0"