Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,7 @@ class _FeedbackFormState extends State<FeedbackForm> {
const SizedBox(height: Constants.defaultPadding),
],
),
Button(
onTap: () => sendFeedback(),
text: _drivingRating + _jeepRating == 0
? "Rate Driver or PUV"
: "Send Feedback for ${_drivingRating != 0 && _jeepRating != 0 ? "Driver and PUV" : _jeepRating != 0 ? "PUV" : "Driver"}",
),
Button(onTap: () => sendFeedback(), text: "Submit"),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class _ReportFormState extends State<ReportForm> {
),
Button(
onTap: () => sendReport(),
text: "Send Report",
text: "Submit",
),
],
),
Expand Down
37 changes: 32 additions & 5 deletions transitrack_web/lib/components/right_panel/selected_jeep_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,15 @@ class _SelectedJeepInfoBoxState extends State<SelectedJeepInfoBox> {
final shareUrl = '${Uri.base.origin}/#/share?share_id=${docRef.id}';
currentShareDocId = docRef.id;

await Clipboard.setData(ClipboardData(text: shareUrl));

if (context.mounted) {
message('Copied Live Location Link');
try {
await Clipboard.setData(ClipboardData(text: shareUrl));
if (context.mounted) {
message('Link copied');
}
} catch (e) {
if (context.mounted) {
messageWithUrl('Copy and share this link', shareUrl);
}
}
} else {
// Stop sharing by updating Firestore
Expand All @@ -242,7 +247,7 @@ class _SelectedJeepInfoBoxState extends State<SelectedJeepInfoBox> {
}

currentShareDocId = null;
message('Stopped Sharing Live Location');
message('Sharing stopped');
}
}

Expand Down Expand Up @@ -291,6 +296,28 @@ class _SelectedJeepInfoBoxState extends State<SelectedJeepInfoBox> {
});
}

void messageWithUrl(String title, String url) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: Constants.bgColor,
title: Center(
child: Text(
title,
style: const TextStyle(color: Colors.white),
textAlign: TextAlign.center,
),
),
content: SelectableText(
url,
style: const TextStyle(color: Colors.white70),
),
);
},
);
}

@override
Widget build(BuildContext context) {
return Column(
Expand Down
2 changes: 1 addition & 1 deletion transitrack_web/lib/pages/share_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class _SharePageState extends State<SharePage> {
drivers = [];
routeChoice = -1;
});
errorMessage("The live share has ended.");
errorMessage("Live sharing ended");
// Navigate back to home after delay
Future.delayed(const Duration(seconds: 2), () {
if (mounted) {
Expand Down