Skip to content

Commit

Permalink
feat: auto hide up/down fab
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Jun 6, 2024
1 parent 72b9283 commit 2f5e8fd
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 34 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).

Expand Down
5 changes: 2 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=你好`
Expand All @@ -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)

Expand Down
42 changes: 23 additions & 19 deletions lib/view/page/home/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
},
),
);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/view/page/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class _HomePageState extends State<HomePage>
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),
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f5e8fd

Please sign in to comment.