Skip to content

Commit 905148a

Browse files
author
logan
committed
add copylink and save image
1 parent 19f0a72 commit 905148a

File tree

3 files changed

+61
-33
lines changed

3 files changed

+61
-33
lines changed

assets/icon/bg-word.svg

Lines changed: 1 addition & 0 deletions
Loading

lib/pages/chatgpt/chatgpt_page.dart

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,20 @@ class ContentPage extends BaseStlessWidget<ChatGptProvider> {
149149
? CrossAxisAlignment.end
150150
: CrossAxisAlignment.start,
151151
children: [
152-
Text(
153-
messageEntity.isUser ? 'Question:' : 'GPT Answer:',
154-
style:
155-
const TextStyle(fontWeight: FontWeight.bold, color: Colors.white),
152+
Container(
153+
width: 48,
154+
height: 48,
155+
padding: const EdgeInsets.all(4),
156+
decoration: BoxDecoration(
157+
color: messageEntity.isUser
158+
? const Color(0xFF9aa37e)
159+
: GlobalColors.success,
160+
borderRadius: BorderRadius.circular(4)),
161+
alignment: Alignment.center,
162+
child: Text(
163+
messageEntity.isUser ? 'ME' : 'AI',
164+
style: const TextStyle(color: Colors.white, fontSize: 20),
165+
),
156166
),
157167
const SizedBox(
158168
height: 5,
@@ -180,35 +190,52 @@ class ContentPage extends BaseStlessWidget<ChatGptProvider> {
180190
Row(
181191
mainAxisSize: MainAxisSize.min,
182192
children: [
183-
InkWell(
184-
child: AnimatedSwitcher(
185-
duration: const Duration(milliseconds: 200),
186-
child: Icon(
187-
viewModel.hasCopied
188-
? Icons.check
189-
: Icons.copy_rounded,
190-
color: GlobalColors.success,
191-
size: 16,
192-
key: UniqueKey()),
193-
),
194-
onTap: () async {
195-
context
196-
.read<ChatGptProvider>()
197-
.copy(context, messageEntity.content);
198-
},
193+
TextButton.icon(
194+
onPressed: () async {
195+
viewModel.copy(context, messageEntity.content);
196+
},
197+
icon: AnimatedSwitcher(
198+
duration: const Duration(milliseconds: 200),
199+
child: Icon(
200+
viewModel.hasCopied
201+
? Icons.check
202+
: Icons.copy_rounded,
203+
color: GlobalColors.success,
204+
size: 16,
205+
key: UniqueKey()),
206+
),
207+
label: const Text(
208+
'Copy',
209+
style: TextStyle(color: Colors.white),
210+
)),
211+
const SizedBox(
212+
width: 10,
213+
),
214+
TextButton.icon(
215+
onPressed: () async {},
216+
icon: const Icon(
217+
Icons.link,
218+
color: GlobalColors.success,
219+
size: 16,
220+
),
221+
label: const Text(
222+
'Copy Link',
223+
style: TextStyle(color: Colors.white),
224+
)),
225+
const SizedBox(
226+
width: 10,
199227
),
200-
// SizedBox(width: 10,),
201-
// InkWell(
202-
// child: AnimatedSwitcher(
203-
// child: Icon(
204-
// Icons.wordpress,
205-
// key: UniqueKey()),
206-
// duration: Duration(milliseconds: 200),
207-
// ),
208-
// onTap: () async {
209-
//
210-
// },
211-
// ),
228+
TextButton.icon(
229+
onPressed: () async {},
230+
icon: const Icon(
231+
Icons.photo,
232+
color: GlobalColors.success,
233+
size: 16,
234+
),
235+
label: const Text(
236+
'Save Image',
237+
style: TextStyle(color: Colors.white),
238+
))
212239
],
213240
)
214241
],

lib/pages/chatgpt/conversation_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class ConversationViewModel extends BaseProvider {
164164

165165
MessageEntity msg = MessageEntity.fromJson(msgMap);
166166
element.latestMessage = msg;
167-
167+
168168
if(element.title==null||element.title==''||element.title?.trim()==''){
169169

170170
element.title = element.latestMessage?.content;

0 commit comments

Comments
 (0)