-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: alternative implentation to share conversation
- Loading branch information
Showing
5 changed files
with
296 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extensions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,146 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:sydney_webui/utils/copy.dart'; | ||
import 'package:flutter/services.dart'; | ||
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({Key? key, required this.sharegptUrl}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return AlertDialog( | ||
title: const Text("ShareGPT URL"), | ||
content: SelectableText(shareGptUrl), | ||
actions: [ | ||
IconButton( | ||
icon: const Icon(Icons.copy_rounded), | ||
onPressed: () => copyContent(shareGptUrl), | ||
tooltip: "Copy URL", | ||
), | ||
IconButton( | ||
icon: const Icon(Icons.open_in_browser_rounded), | ||
onPressed: () => openUrl(shareGptUrl), | ||
tooltip: "Open URL", | ||
) | ||
], | ||
); | ||
} | ||
@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') | ||
// ], | ||
// ) | ||
// ) | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.