support_section_widget.dart 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_email_sender/flutter_email_sender.dart';
  3. import 'package:logging/logging.dart';
  4. import 'package:photos/core/configuration.dart';
  5. import 'package:photos/core/constants.dart';
  6. import 'package:photos/ui/settings/settings_section_title.dart';
  7. import 'package:photos/ui/settings/settings_text_item.dart';
  8. import 'package:photos/ui/web_page.dart';
  9. import 'package:photos/utils/email_util.dart';
  10. import 'package:photos/utils/toast_util.dart';
  11. import 'package:url_launcher/url_launcher.dart';
  12. class SupportSectionWidget extends StatelessWidget {
  13. const SupportSectionWidget({Key key}) : super(key: key);
  14. @override
  15. Widget build(BuildContext context) {
  16. return Column(
  17. children: [
  18. SettingsSectionTitle("support"),
  19. Padding(padding: EdgeInsets.all(4)),
  20. GestureDetector(
  21. behavior: HitTestBehavior.translucent,
  22. onTap: () async {
  23. try {
  24. final Email email = Email(
  25. recipients: ['hey@ente.io'],
  26. isHTML: false,
  27. );
  28. await FlutterEmailSender.send(email);
  29. } catch (e) {
  30. Logger("SupportSection").severe(e);
  31. launch("mailto:hey@ente.io");
  32. }
  33. },
  34. child: SettingsTextItem(text: "email", icon: Icons.navigate_next),
  35. ),
  36. Divider(height: 4),
  37. GestureDetector(
  38. behavior: HitTestBehavior.translucent,
  39. onTap: () {
  40. Navigator.of(context).push(
  41. MaterialPageRoute(
  42. builder: (BuildContext context) {
  43. final endpoint = Configuration.instance.getHttpEndpoint() +
  44. "/users/roadmap";
  45. final isLoggedIn = Configuration.instance.getToken() != null;
  46. final url = isLoggedIn
  47. ? endpoint + "?token=" + Configuration.instance.getToken()
  48. : kRoadmapURL;
  49. return WebPage("roadmap", url);
  50. },
  51. ),
  52. );
  53. },
  54. child: SettingsTextItem(text: "roadmap", icon: Icons.navigate_next),
  55. ),
  56. Divider(height: 4),
  57. GestureDetector(
  58. behavior: HitTestBehavior.translucent,
  59. onTap: () {
  60. launch("https://reddit.com/r/enteio");
  61. },
  62. child: SettingsTextItem(text: "community", icon: Icons.navigate_next),
  63. ),
  64. Divider(height: 4),
  65. GestureDetector(
  66. behavior: HitTestBehavior.translucent,
  67. onTap: () async {
  68. await sendLogs(context, "report bug", "bug@ente.io", postShare: () {
  69. showToast("thanks for reporting a bug!");
  70. });
  71. },
  72. child: SettingsTextItem(
  73. text: "report bug 🐞", icon: Icons.navigate_next),
  74. ),
  75. ],
  76. );
  77. }
  78. }