Skip to content

Commit

Permalink
Merge pull request #34 from geeker-ai/wrong-style
Browse files Browse the repository at this point in the history
Wrong style
  • Loading branch information
zmhu committed Oct 27, 2023
2 parents d4e64d5 + 0909a9e commit 78f6699
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/components/desktop_main_right_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class DeskTopMainRightComponent extends StatelessWidget {
20);
}

void scrollToBottom() {
scrollController.animateTo(
Future<void> scrollToBottom() {
return scrollController.animateTo(
scrollController.position.minScrollExtent,
duration: const Duration(milliseconds: 500),
curve: Curves.linear,
Expand Down Expand Up @@ -294,7 +294,8 @@ class QuestionInputComponent extends StatelessWidget {
focusedBorder: InputBorder.none,
filled: false,
suffixIcon: IconButton(
onPressed: () {
onPressed: () async {
await scrollToBottom();
controller.submit(sid, onDone: () {
chatListController.updateSessionLastEdit(
chatListController.currentSession);
Expand All @@ -304,7 +305,6 @@ class QuestionInputComponent extends StatelessWidget {
chatListController.currentSession);
chatListController.update();
});
scrollToBottom();
},
icon: const Icon(Icons.send)),
),
Expand All @@ -316,7 +316,8 @@ class QuestionInputComponent extends StatelessWidget {
controller.inputQuestion = value;
// controller.update(['inputQuestion']);
},
onSubmitted: (String value) {
onSubmitted: (String value) async {
await scrollToBottom();
controller.submit(sid, onDone: () {
chatListController
.updateSessionLastEdit(chatListController.currentSession);
Expand All @@ -326,7 +327,6 @@ class QuestionInputComponent extends StatelessWidget {
.updateSessionLastEdit(chatListController.currentSession);
chatListController.update();
});
scrollToBottom();
},
onTap: () {
//
Expand Down
29 changes: 25 additions & 4 deletions lib/pages/chat_message_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class ChatMessagePage extends StatelessWidget {
ChatListController chatListController = Get.find<ChatListController>();
TextEditingController textEditingController = TextEditingController();

void scrollToBottom() {
scrollController.animateTo(scrollController.position.maxScrollExtent,
scrollToBottom() {
return scrollController.animateTo(scrollController.position.minScrollExtent,
duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);
}

Expand Down Expand Up @@ -104,12 +104,33 @@ class ChatMessagePage extends StatelessWidget {
minLines: 1,
maxLines: 3,
textInputAction: TextInputAction.go,
decoration: const InputDecoration(filled: false),
decoration: InputDecoration(
filled: false,
suffixIcon: IconButton(
onPressed: () async {
await scrollToBottom();
controller.submit(sid ?? '',
onDone: () {
chatListController
.updateSessionLastEdit(
chatListController
.currentSession);
chatListController.update();
}, onError: () {
chatListController
.updateSessionLastEdit(
chatListController
.currentSession);
chatListController.update();
});
},
icon: const Icon(Icons.send))),
onChanged: (value) {
controller.inputQuestion = value;
},
onSubmitted: (String value) {
onSubmitted: (String value) async {
// onSubmit();
await scrollToBottom();
controller.submit(sid ?? '', onDone: () {
chatListController.updateSessionLastEdit(
chatListController.currentSession);
Expand Down
2 changes: 1 addition & 1 deletion macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.13.0
COCOAPODS: 1.14.1

0 comments on commit 78f6699

Please sign in to comment.