From 2f5e8fdd0e7ea4686faa19e57d8f04966a2366a5 Mon Sep 17 00:00:00 2001 From: lollipopkit <10864310+lollipopkit@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:59:17 +0800 Subject: [PATCH] feat: auto hide up/down fab --- README.md | 13 ++++++----- README_zh.md | 5 ++--- lib/view/page/home/chat.dart | 42 ++++++++++++++++++++---------------- lib/view/page/home/home.dart | 4 ++-- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 1fda50d..2343760 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,13 @@ Please refrain from using it in production environments or for critical data. ## 🪄 Features - Restore from [ChatGPT Next Web backup](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web) / [OpenAI exported file](https://chatgpt.com). -- Text / Image / Audio chat. (Web only support text) -- L10n. (简体中文 / English) -- Share chat by picture. -- Render code block / latex formula. +- Text / Image / Audio chat. +- Localization. (简体中文 / English) +- Share chat as image. - Url Scheme, eg: `lk-gptbox://chat/new?msg=hello` -- Mobile & Desktop supports. - Sync with WebDAV / iCloud. +- Mobile & Desktop supports. +- Render code block / latex formula. ## 🏙️ Screenshots @@ -45,8 +45,7 @@ Please refrain from using it in production environments or for critical data. [iOS & macOS](https://apps.apple.com/app/id6476033062) / [Android & Linux & Windows](https://github.com/lollipopkit/flutter_gpt_box/releases) -All deprecated pkgs can be found in [here](https://cdn.lolli.tech/gptbox/?sort=time&order=desc&layout=grid). - +- All deprecated pkgs (< `v1.0.183`) can be found in [here](https://cdn.lolli.tech/gptbox/?sort=time&order=desc&layout=grid). - Due to Chinese government policy and the BEIAN issue. Please download it from other regions of AppStore. - To prevent injection attacks and etc., please don't download from untrusted sources. Since `Linux / Windows` is signed with flutter default certificate, it is recommended to [build it yourself](https://github.com/lollipopkit/flutter_server_box/wiki#compile-yourself). diff --git a/README_zh.md b/README_zh.md index b9abc11..59cf527 100644 --- a/README_zh.md +++ b/README_zh.md @@ -20,7 +20,7 @@ ## 🪄 特性 - 从 [ChatGPT Next Web 备份](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web) / [OpenAI导出文件](https://chatgpt.com) 恢复 -- 文本 / 图片 / 音频聊天(网页版仅支持文本) +- 文本 / 图片 / 音频聊天 - 本地化(简体中文 / English) - 以图片形式分享聊天 - Url Scheme,例如:`lk-gptbox://chat/new?msg=你好` @@ -45,8 +45,7 @@ [iOS & macOS](https://apps.apple.com/app/id6476033062) / [Android & Linux & Windows](https://github.com/lollipopkit/flutter_gpt_box/releases) -所有已弃用的包可以在[这里](https://cdn.lolli.tech/gptbox/?sort=time&order=desc&layout=grid)找到。 - +- 所有已弃用的包 (< `v1.0.183`) 可以在[这里](https://cdn.lolli.tech/gptbox/?sort=time&order=desc&layout=grid)找到。 - 由于中国政策原因,且**目前**无法完成备案。请移步 AppStore 其他区下载。 - 为了防止注入攻击等因素,请勿从不可信来源下载。由于 `Linux / Windows` 使用了默认签名,因此建议[自行构建](https://github.com/lollipopkit/flutter_server_box/wiki/%E4%B8%BB%E9%A1%B5#%E8%87%AA%E7%BC%96%E8%AF%91)。 diff --git a/lib/view/page/home/chat.dart b/lib/view/page/home/chat.dart index bf54a9d..23e0dde 100644 --- a/lib/view/page/home/chat.dart +++ b/lib/view/page/home/chat.dart @@ -26,25 +26,29 @@ class _ChatPageState extends State<_ChatPage> } Widget _buildFAB() { - return ListenableBuilder( - listenable: _chatFabRN, - builder: (_, __) { - final valid = _chatScrollCtrl.positions.length == 1 && - _chatScrollCtrl.position.hasContentDimensions && - _chatScrollCtrl.position.maxScrollExtent > 0; - return AnimatedSwitcher( - transitionBuilder: (child, animation) { - return ScaleTransition( - scale: animation, - child: child, - ); - }, - duration: _durationShort, - switchInCurve: Curves.easeInOut, - switchOutCurve: Curves.easeInOut, - child: valid ? _buildFABBtn() : UIs.placeholder, - ); - }, + return AutoHide( + controller: _chatScrollCtrl, + direction: AxisDirection.right, + child: ListenableBuilder( + listenable: _chatFabRN, + builder: (_, __) { + final valid = _chatScrollCtrl.positions.length == 1 && + _chatScrollCtrl.position.hasContentDimensions && + _chatScrollCtrl.position.maxScrollExtent > 0; + return AnimatedSwitcher( + transitionBuilder: (child, animation) { + return ScaleTransition( + scale: animation, + child: child, + ); + }, + duration: _durationShort, + switchInCurve: Curves.easeInOut, + switchOutCurve: Curves.easeInOut, + child: valid ? _buildFABBtn() : UIs.placeholder, + ); + }, + ), ); } diff --git a/lib/view/page/home/home.dart b/lib/view/page/home/home.dart index 4da6076..584d442 100644 --- a/lib/view/page/home/home.dart +++ b/lib/view/page/home/home.dart @@ -123,8 +123,8 @@ class _HomePageState extends State if (_isWide.value) { return const Row( children: [ - SizedBox(width: 257, child: history), - Expanded(child: chat), + Expanded(flex: 1, child: history), + Expanded(flex: 3, child: chat), ], ); } diff --git a/pubspec.lock b/pubspec.lock index 63c93be..d93ea7f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -423,8 +423,8 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.31" - resolved-ref: f6322c5c2fad5230d1a882e79d52d1a0d246b8f4 + ref: "v1.0.34" + resolved-ref: f6acb6530649e4bb080496368d192dc92687ec85 url: "https://github.com/lppcg/fl_lib" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index 6e2a504..8a9ec9f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,7 +29,7 @@ dependencies: fl_lib: git: url: https://github.com/lppcg/fl_lib - ref: v1.0.31 + ref: v1.0.34 # path: ../fl_lib extended_image: ^8.2.1 app_links: ^6.1.1