diff --git a/devtools_options.yaml b/devtools_options.yaml deleted file mode 100644 index 7e7e7f6..0000000 --- a/devtools_options.yaml +++ /dev/null @@ -1 +0,0 @@ -extensions: diff --git a/lib/controller.dart b/lib/controller.dart index bca9557..5161ff8 100644 --- a/lib/controller.dart +++ b/lib/controller.dart @@ -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 @@ -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'); } diff --git a/lib/widgets/share_conversation_dialog.dart b/lib/widgets/share_conversation_dialog.dart index 3f86c34..2a26add 100644 --- a/lib/widgets/share_conversation_dialog.dart +++ b/lib/widgets/share_conversation_dialog.dart @@ -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')], + )) ], - ); - } + ), + ) + ], + ); + } } diff --git a/pubspec.lock b/pubspec.lock index 77b08a7..b841505 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 25c3c9a..d4ccc51 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,7 +40,6 @@ dependencies: pasteboard: image: flutter_markdown_latex: - url_launcher: share_plus: dev_dependencies: