Skip to content

Commit

Permalink
fix & opt.
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed May 27, 2024
1 parent de48ce6 commit cbe7daa
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 15 deletions.
88 changes: 82 additions & 6 deletions lib/view/page/setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,22 @@ class _SettingPageState extends State<SettingPage> {
actions: [
TextButton(
onPressed: () {
void onSave(String s) {
context.pop();
OpenAICfg.current = OpenAICfg.current.copyWith(model: s);
_cfgRN.build();
}

context.pop();
final ctrl = TextEditingController();
context.showRoundDialog(
title: l10n.custom,
child: Input(
controller: ctrl,
hint: kChatModel,
onSubmitted: (s) {
context.pop();
OpenAICfg.current = OpenAICfg.current.copyWith(model: s);
_cfgRN.build();
},
onSubmitted: (s) => onSave(s),
),
actions: Btns.oks(onTap: context.pop),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
);
},
child: Text(l10n.custom),
Expand Down Expand Up @@ -489,6 +493,30 @@ class _SettingPageState extends State<SettingPage> {
items: modelStrs,
initial: val,
title: l10n.model,
actions: [
TextButton(
onPressed: () {
void onSave(String s) {
context.pop();
OpenAICfg.current = OpenAICfg.current.copyWith(model: s);
_cfgRN.build();
}

context.pop();
final ctrl = TextEditingController();
context.showRoundDialog(
title: l10n.custom,
child: Input(
controller: ctrl,
hint: kChatModel,
onSubmitted: (s) => onSave(s),
),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
);
},
child: Text(l10n.custom),
),
],
);
if (model != null) {
OpenAICfg.current = OpenAICfg.current.copyWith(model: model);
Expand Down Expand Up @@ -526,6 +554,30 @@ class _SettingPageState extends State<SettingPage> {
items: modelStrs,
initial: val,
title: l10n.model,
actions: [
TextButton(
onPressed: () {
void onSave(String s) {
context.pop();
OpenAICfg.current = OpenAICfg.current.copyWith(model: s);
_cfgRN.build();
}

context.pop();
final ctrl = TextEditingController();
context.showRoundDialog(
title: l10n.custom,
child: Input(
controller: ctrl,
hint: kChatModel,
onSubmitted: (s) => onSave(s),
),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
);
},
child: Text(l10n.custom),
),
],
);
if (model != null) {
OpenAICfg.current = OpenAICfg.current.copyWith(model: model);
Expand Down Expand Up @@ -563,6 +615,30 @@ class _SettingPageState extends State<SettingPage> {
items: modelStrs,
initial: val,
title: l10n.model,
actions: [
TextButton(
onPressed: () {
void onSave(String s) {
context.pop();
OpenAICfg.current = OpenAICfg.current.copyWith(model: s);
_cfgRN.build();
}

context.pop();
final ctrl = TextEditingController();
context.showRoundDialog(
title: l10n.custom,
child: Input(
controller: ctrl,
hint: kChatModel,
onSubmitted: (s) => onSave(s),
),
actions: Btns.oks(onTap: () => onSave(ctrl.text)),
);
},
child: Text(l10n.custom),
),
],
);
if (model != null) {
OpenAICfg.current = OpenAICfg.current.copyWith(model: model);
Expand Down
8 changes: 3 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,9 @@ packages:
fl_lib:
dependency: "direct main"
description:
path: "."
ref: main
resolved-ref: "8877ee5b4597e03a9a316eb3d40ae5ffcf957709"
url: "https://github.com/lollipopkit/fl_lib"
source: git
path: "../fl_lib"
relative: true
source: path
version: "0.0.1"
flutter:
dependency: "direct main"
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ dependencies:
image_picker: ^1.0.7
audioplayers: ^6.0.0
fl_lib:
git:
url: https://github.com/lollipopkit/fl_lib
ref: main
# path: ../fl_lib
# git:
# url: https://github.com/lollipopkit/fl_lib
# ref: main
path: ../fl_lib

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit cbe7daa

Please sign in to comment.