empty_state.dart 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. import "package:flutter/material.dart";
  2. import "package:fluttertoast/fluttertoast.dart";
  3. import "package:photos/core/event_bus.dart";
  4. import "package:photos/events/tab_changed_event.dart";
  5. import "package:photos/generated/l10n.dart";
  6. import "package:photos/theme/ente_theme.dart";
  7. import 'package:photos/ui/collections/collection_action_sheet.dart';
  8. import "package:photos/ui/common/gradient_button.dart";
  9. import 'package:photos/ui/components/buttons/button_widget.dart';
  10. import "package:photos/ui/components/empty_state_item_widget.dart";
  11. import "package:photos/ui/components/models/button_type.dart";
  12. import "package:photos/utils/share_util.dart";
  13. import "package:photos/utils/toast_util.dart";
  14. class SharedEmptyStateWidget extends StatelessWidget {
  15. const SharedEmptyStateWidget({super.key});
  16. @override
  17. Widget build(BuildContext context) {
  18. final textTheme = getEnteTextTheme(context);
  19. return SingleChildScrollView(
  20. child: Padding(
  21. padding: const EdgeInsets.fromLTRB(16, 12, 16, 114),
  22. child: Padding(
  23. padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
  24. child: Column(
  25. mainAxisSize: MainAxisSize.min,
  26. mainAxisAlignment: MainAxisAlignment.center,
  27. children: [
  28. Padding(
  29. padding:
  30. const EdgeInsets.symmetric(horizontal: 4, vertical: 16),
  31. child: Column(
  32. mainAxisSize: MainAxisSize.min,
  33. crossAxisAlignment: CrossAxisAlignment.start,
  34. children: [
  35. Text(
  36. S.of(context).privateSharing,
  37. style: textTheme.h3Bold,
  38. textAlign: TextAlign.start,
  39. ),
  40. const SizedBox(height: 24),
  41. Column(
  42. mainAxisSize: MainAxisSize.min,
  43. children: [
  44. EmptyStateItemWidget(
  45. S.of(context).shareOnlyWithThePeopleYouWant,
  46. ),
  47. const SizedBox(height: 12),
  48. EmptyStateItemWidget(
  49. S.of(context).usePublicLinksForPeopleNotOnEnte,
  50. ),
  51. const SizedBox(height: 12),
  52. EmptyStateItemWidget(
  53. S.of(context).allowPeopleToAddPhotos,
  54. ),
  55. ],
  56. ),
  57. ],
  58. ),
  59. ),
  60. const SizedBox(height: 16),
  61. Padding(
  62. padding: const EdgeInsets.symmetric(vertical: 4),
  63. child: Column(
  64. mainAxisSize: MainAxisSize.min,
  65. children: [
  66. ButtonWidget(
  67. buttonType: ButtonType.trailingIconPrimary,
  68. labelText: S.of(context).shareAnAlbumNow,
  69. icon: Icons.arrow_forward_outlined,
  70. onTap: () async {
  71. showCollectionActionSheet(
  72. context,
  73. actionType: CollectionActionType.shareCollection,
  74. );
  75. },
  76. ),
  77. const SizedBox(height: 6),
  78. ButtonWidget(
  79. buttonType: ButtonType.trailingIconSecondary,
  80. labelText: S.of(context).collectEventPhotos,
  81. icon: Icons.add_photo_alternate_outlined,
  82. onTap: () async {
  83. showCollectionActionSheet(
  84. context,
  85. actionType: CollectionActionType.collectPhotos,
  86. );
  87. },
  88. ),
  89. const SizedBox(height: 6),
  90. ButtonWidget(
  91. buttonType: ButtonType.trailingIconSecondary,
  92. labelText: S.of(context).inviteYourFriends,
  93. icon: Icons.ios_share_outlined,
  94. onTap: () async {
  95. shareText(S.of(context).shareTextRecommendUsingEnte);
  96. },
  97. ),
  98. ],
  99. ),
  100. ),
  101. ],
  102. ),
  103. ),
  104. ),
  105. );
  106. }
  107. }
  108. class OutgoingAlbumEmptyState extends StatelessWidget {
  109. const OutgoingAlbumEmptyState({super.key});
  110. @override
  111. Widget build(BuildContext context) {
  112. return SizedBox(
  113. height: 200,
  114. child: Column(
  115. mainAxisAlignment: MainAxisAlignment.center,
  116. children: [
  117. Text(
  118. S.of(context).shareYourFirstAlbum,
  119. style: Theme.of(context).textTheme.bodySmall,
  120. ),
  121. const Padding(padding: EdgeInsets.only(top: 14)),
  122. SizedBox(
  123. width: 200,
  124. height: 50,
  125. child: GradientButton(
  126. onTap: () async {
  127. await showToast(
  128. context,
  129. S.of(context).shareAlbumHint,
  130. toastLength: Toast.LENGTH_LONG,
  131. );
  132. Bus.instance.fire(
  133. TabChangedEvent(1, TabChangedEventSource.collectionsPage),
  134. );
  135. },
  136. iconData: Icons.person_add,
  137. text: S.of(context).share,
  138. ),
  139. ),
  140. const SizedBox(height: 60),
  141. ],
  142. ),
  143. );
  144. }
  145. }
  146. class IncomingAlbumEmptyState extends StatelessWidget {
  147. const IncomingAlbumEmptyState({super.key});
  148. @override
  149. Widget build(BuildContext context) {
  150. return SizedBox(
  151. height: 220,
  152. child: Column(
  153. mainAxisAlignment: MainAxisAlignment.center,
  154. children: [
  155. Text(
  156. S.of(context).askYourLovedOnesToShare,
  157. style: Theme.of(context).textTheme.bodySmall,
  158. ),
  159. const Padding(padding: EdgeInsets.only(top: 14)),
  160. SizedBox(
  161. width: 200,
  162. height: 50,
  163. child: GradientButton(
  164. onTap: () async {
  165. shareText(S.of(context).shareTextRecommendUsingEnte);
  166. },
  167. iconData: Icons.outgoing_mail,
  168. text: S.of(context).invite,
  169. ),
  170. ),
  171. const SizedBox(height: 60),
  172. ],
  173. ),
  174. );
  175. }
  176. }