Skip to content

Commit

Permalink
opt.: input field
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Jul 22, 2024
1 parent d46f3a8 commit be12da7
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 11 deletions.
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 266;
CURRENT_PROJECT_VERSION = 267;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down Expand Up @@ -512,7 +512,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 266;
CURRENT_PROJECT_VERSION = 267;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -537,7 +537,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 266;
CURRENT_PROJECT_VERSION = 267;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down
2 changes: 1 addition & 1 deletion lib/data/res/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

class Build {
static const String name = "GPTBox";
static const int build = 266;
static const int build = 267;
}
9 changes: 9 additions & 0 deletions lib/view/page/home/bottom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ final class _ChatSettingsState extends State<_ChatSettings> {
settings.value = settings.value.copyWith(
ignoreContextConstraint: !val.ignoreContextConstraint,
);
if (settings.value.headTailMode &&
settings.value.ignoreContextConstraint) {
settings.value = settings.value.copyWith(headTailMode: false);
}
_save();
},
);
Expand Down Expand Up @@ -340,6 +344,11 @@ final class _ChatSettingsState extends State<_ChatSettings> {
onChanged: (_) {
settings.value =
settings.value.copyWith(headTailMode: !val.headTailMode);
if (settings.value.headTailMode &&
settings.value.ignoreContextConstraint) {
settings.value =
settings.value.copyWith(ignoreContextConstraint: false);
}
_save();
},
);
Expand Down
1 change: 0 additions & 1 deletion lib/view/page/home/ctrl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ void _onTapEditMsg(BuildContext context, ChatHistoryItem chatItem) async {
minLines: 1,
autoCorrect: true,
autoFocus: true,
suggestion: true,
action: TextInputAction.send,
onSubmitted: (p0) {
chatItem.content.clear();
Expand Down
17 changes: 15 additions & 2 deletions lib/view/page/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ final class _ProfilePageState extends State<ProfilePage> {
final ctrl = TextEditingController(text: cfg.name);
context.showRoundDialog(
title: l10n.edit,
child: Input(controller: ctrl, label: l10n.name),
child: Input(
controller: ctrl,
label: l10n.name,
autoFocus: true,
),
actions: Btns.oks(
onTap: () {
final name = ctrl.text;
Expand Down Expand Up @@ -190,7 +194,11 @@ final class _ProfilePageState extends State<ProfilePage> {
final ctrl = TextEditingController();
final ok = await context.showRoundDialog(
title: l10n.add,
child: Input(controller: ctrl, label: l10n.name),
child: Input(
controller: ctrl,
label: l10n.name,
autoFocus: true,
),
actions: Btns.oks(onTap: () => context.pop(true)),
);
if (ok != true) return;
Expand Down Expand Up @@ -240,6 +248,7 @@ final class _ProfilePageState extends State<ProfilePage> {
controller: ctrl,
hint: 'sk-xxx',
maxLines: 3,
autoFocus: true,
),
actions: Btns.oks(
onTap: () => context.pop(ctrl.text),
Expand Down Expand Up @@ -270,6 +279,7 @@ final class _ProfilePageState extends State<ProfilePage> {
controller: ctrl,
hint: 'https://api.openai.com',
maxLines: 3,
autoFocus: true,
),
actions: Btns.oks(
onTap: () => context.pop(ctrl.text),
Expand Down Expand Up @@ -351,6 +361,7 @@ final class _ProfilePageState extends State<ProfilePage> {
child: Input(
controller: ctrl,
hint: kChatModel,
autoFocus: true,
onSubmitted: (s) => onSave(s),
),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
Expand Down Expand Up @@ -454,6 +465,7 @@ final class _ProfilePageState extends State<ProfilePage> {
child: Input(
controller: ctrl,
maxLines: 3,
autoFocus: true,
),
actions: Btns.oks(onTap: () => context.pop(ctrl.text)),
);
Expand All @@ -480,6 +492,7 @@ final class _ProfilePageState extends State<ProfilePage> {
child: Input(
controller: ctrl,
hint: '7',
autoFocus: true,
type: TextInputType.number,
),
actions: Btns.oks(
Expand Down
2 changes: 2 additions & 0 deletions lib/view/page/setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class _SettingPageState extends State<SettingPage> {
controller: ctrl,
hint: '#8b2252',
icon: Icons.colorize,
autoFocus: true,
),
ColorPicker(
color: primaryColor,
Expand Down Expand Up @@ -405,6 +406,7 @@ class _SettingPageState extends State<SettingPage> {
controller: ctrl,
type: TextInputType.name,
maxLength: 7,
autoFocus: true,
onSubmitted: (s) => onSave(s),
),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
Expand Down
1 change: 1 addition & 0 deletions lib/view/page/tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class _ToolPageState extends State<ToolPage> {
child: Input(
controller: ctrl,
maxLines: 3,
autoFocus: true,
onSubmitted: onSave,
),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "v1.0.78"
resolved-ref: "552c4095eb6074bed55724d2a04be0596e2d2ea7"
ref: "v1.0.79"
resolved-ref: f1bc7dd5ec2af84813b33a9e2149e117dfea3cd0
url: "https://github.com/lppcg/fl_lib"
source: git
version: "0.0.1"
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: gpt_box
description: "A third-party GPT Client for OpenAI API."
publish_to: 'none'
version: 1.0.266+266
version: 1.0.267+267

environment:
sdk: '>=3.3.0 <4.0.0'
Expand Down Expand Up @@ -36,7 +36,7 @@ dependencies:
fl_lib:
git:
url: https://github.com/lppcg/fl_lib
ref: v1.0.78
ref: v1.0.79

dependency_overrides:
# fl_lib:
Expand Down

0 comments on commit be12da7

Please sign in to comment.