Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ous50 committed Jan 9, 2024
1 parent cd0760f commit 07e5d6c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 172 deletions.
1 change: 0 additions & 1 deletion devtools_options.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions lib/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:sydney_webui/models/message.dart';
import 'package:sydney_webui/services/sharegpt_service.dart';
import 'package:sydney_webui/services/sydney_service.dart';
import 'package:sydney_webui/widgets/share_conversation_dialog.dart';
import 'package:sydney_webui/utils/url.dart';

class Controller extends GetxController {
// Constants
Expand Down Expand Up @@ -301,7 +300,9 @@ class Controller extends GetxController {
try {
final id = await shareGptService.uploadConversation(messages);
final url = 'https://shareg.pt/$id';
Get.dialog(ShareConversationDialog(sharegptUrl: url,));
await Get.dialog(ShareConversationDialog(
sharegptUrl: url,
));
} catch (e) {
Get.snackbar('Error occurred', 'Failed to share conversation: $e');
}
Expand Down
179 changes: 43 additions & 136 deletions lib/widgets/share_conversation_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,143 +4,50 @@ import 'package:sydney_webui/utils/url.dart';
import 'package:share_plus/share_plus.dart';

class ShareConversationDialog extends StatelessWidget {
final String sharegptUrl;
final String sharegptUrl;

const ShareConversationDialog({Key? key, required this.sharegptUrl}) : super(key: key);
const ShareConversationDialog({super.key, required this.sharegptUrl});

@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text('Share Conversation'),
content: Text(sharegptUrl),
actions: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
ElevatedButton(
onPressed: () {
Clipboard.setData(ClipboardData(text: sharegptUrl));
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.copy),
Text('Copy')
],
)
),
SizedBox(width: 8),
ElevatedButton(
onPressed: () {
openUrl(sharegptUrl);
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.open_in_browser),
Text('Open')
],
)
),
SizedBox(width: 8),
ElevatedButton(
onPressed: () {
Share.share(sharegptUrl);
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.share),
Text('Share')
],
)
)
],
),
)
// SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: Row(
// children: [
// ElevatedButton(
// onPressed: () {
// Clipboard.setData(ClipboardData(text: sharegptUrl));
// },
// child: const Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.copy),
// Text('Copy')
// ],
// )
// ),
// // SizedBox(height: 8),
// ElevatedButton(
// onPressed: () {
// openUrl(sharegptUrl);
// },
// child: const Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.open_in_browser),
// Text('Open')
// ],
// )
// ),
// // SizedBox(height: 8),
// ElevatedButton(
// onPressed: () {
// Share.share(sharegptUrl);
// },
// child: const Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.share),
// Text('Share')
// ],
// )
// )

// ElevatedButton(
// onPressed: () {
// Clipboard.setData(ClipboardData(text: sharegptUrl));
// },
// child: const Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.copy),
// Text('Copy')
// ],
// )
// ),
// // SizedBox(height: 8),
// ElevatedButton(
// onPressed: () {
// openUrl(sharegptUrl);
// },
// child: const Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.open_in_browser),
// Text('Open')
// ],
// )
// ),
// // SizedBox(height: 8),
// ElevatedButton(
// onPressed: () {
// Share.share(sharegptUrl);
// },
// child: const Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.share),
// Text('Share')
// ],
// )
// )
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Share Conversation'),
content: Text(sharegptUrl),
actions: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
ElevatedButton(
onPressed: () {
Clipboard.setData(ClipboardData(text: sharegptUrl));
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [Icon(Icons.copy_rounded), Text('Copy')],
)),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () {
openUrl(sharegptUrl);
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [Icon(Icons.open_in_browser), Text('Open')],
)),
const SizedBox(width: 8),
ElevatedButton(
onPressed: () {
Share.share(sharegptUrl);
},
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [Icon(Icons.share_rounded), Text('Share')],
))
],
);
}
),
)
],
);
}
}
32 changes: 0 additions & 32 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -509,30 +509,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96
url: "https://pub.dev"
source: hosted
version: "6.2.3"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f"
url: "https://pub.dev"
source: hosted
version: "6.2.2"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: cdb7b6da34483f9b2c9f8b2b29bc468fa7271d92e2021607ca0c4d3bcb04cdd4
url: "https://pub.dev"
source: hosted
version: "6.2.3"
url_launcher_linux:
dependency: transitive
description:
Expand All @@ -541,14 +517,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
url: "https://pub.dev"
source: hosted
version: "3.1.0"
url_launcher_platform_interface:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dependencies:
pasteboard:
image:
flutter_markdown_latex:
url_launcher:
share_plus:

dev_dependencies:
Expand Down

0 comments on commit 07e5d6c

Please sign in to comment.