change_log_page.dart 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/services/update_service.dart';
  3. import 'package:photos/theme/ente_theme.dart';
  4. import 'package:photos/ui/components/button_widget.dart';
  5. import 'package:photos/ui/components/divider_widget.dart';
  6. import 'package:photos/ui/components/models/button_type.dart';
  7. import 'package:photos/ui/components/title_bar_title_widget.dart';
  8. import 'package:photos/ui/notification/update/change_log_entry.dart';
  9. import 'package:url_launcher/url_launcher_string.dart';
  10. class ChangeLogPage extends StatefulWidget {
  11. const ChangeLogPage({
  12. Key? key,
  13. }) : super(key: key);
  14. @override
  15. State<ChangeLogPage> createState() => _ChangeLogPageState();
  16. }
  17. class _ChangeLogPageState extends State<ChangeLogPage> {
  18. @override
  19. void initState() {
  20. super.initState();
  21. }
  22. @override
  23. Widget build(BuildContext context) {
  24. final enteColorScheme = getEnteColorScheme(context);
  25. return Scaffold(
  26. appBar: null,
  27. body: Container(
  28. color: enteColorScheme.backgroundElevated,
  29. child: Column(
  30. mainAxisAlignment: MainAxisAlignment.center,
  31. children: [
  32. const SizedBox(
  33. height: 36,
  34. ),
  35. Container(
  36. alignment: Alignment.centerLeft,
  37. child: const Padding(
  38. padding: EdgeInsets.symmetric(horizontal: 16.0),
  39. child: TitleBarTitleWidget(
  40. title: "What's new",
  41. ),
  42. ),
  43. ),
  44. const SizedBox(
  45. height: 24,
  46. ),
  47. Expanded(child: _getChangeLog()),
  48. const DividerWidget(
  49. dividerType: DividerType.solid,
  50. ),
  51. SafeArea(
  52. child: Padding(
  53. padding: const EdgeInsets.only(
  54. left: 16.0,
  55. right: 16,
  56. top: 16,
  57. bottom: 8,
  58. ),
  59. child: Column(
  60. crossAxisAlignment: CrossAxisAlignment.start,
  61. children: [
  62. ButtonWidget(
  63. buttonType: ButtonType.trailingIconPrimary,
  64. buttonSize: ButtonSize.large,
  65. labelText: "Continue",
  66. icon: Icons.arrow_forward_outlined,
  67. onTap: () async {
  68. await UpdateService.instance.hideChangeLog();
  69. if (mounted && Navigator.of(context).canPop()) {
  70. Navigator.of(context).pop();
  71. }
  72. },
  73. ),
  74. const SizedBox(
  75. height: 8,
  76. ),
  77. ButtonWidget(
  78. buttonType: ButtonType.trailingIconSecondary,
  79. buttonSize: ButtonSize.large,
  80. labelText: "Rate the app",
  81. icon: Icons.favorite_rounded,
  82. iconColor: enteColorScheme.primary500,
  83. onTap: () async {
  84. launchUrlString(
  85. UpdateService.instance.getRateDetails().item2,
  86. );
  87. },
  88. ),
  89. const SizedBox(height: 8),
  90. ],
  91. ),
  92. ),
  93. ),
  94. ],
  95. ),
  96. ),
  97. );
  98. }
  99. Widget _getChangeLog() {
  100. final scrollController = ScrollController();
  101. final List<ChangeLogEntry> items = [];
  102. items.add(
  103. ChangeLogEntry(
  104. "Collect photos from anyone!",
  105. "You can now enable \"Allow adding photos\" under shared link "
  106. "settings to allow anyone with access to the link to also add "
  107. "photos to that shared album.\n\nThis is the perfect fit for "
  108. "occasions where you want to ask all your friends and relatives who attended the event to add the photos they took to an album. You can then prune them there; plus everyone can view them in a single place.",
  109. ),
  110. );
  111. items.add(
  112. ChangeLogEntry(
  113. '''Customize photo grid size''',
  114. "You can now change the number of photos that are shown in a row."
  115. "\n\nSince this was a much requested feature we've released it as "
  116. "an option in Settings > General > Advanced; later we'll also try a gesture for easier access.",
  117. ),
  118. );
  119. items.add(
  120. ChangeLogEntry(
  121. '''Better multi-select, and hide''',
  122. "The item selector gets a new, expanded look with clearly marked "
  123. "actions. We'll use this revamped space to show even more actions"
  124. " you can take on selected photos.\n\nAnd we've already added new "
  125. "actions! You can now select multiple items and hide all of them in one go.",
  126. ),
  127. );
  128. items.add(
  129. ChangeLogEntry(
  130. '''Per album free up space''',
  131. "There is now an option to free up space within each on device album. This provides both a more granular, and faster, way to save storage your phone.",
  132. ),
  133. );
  134. items.add(
  135. ChangeLogEntry(
  136. '''Longer photo descriptions''',
  137. "The previous 280 character limit on photo captions and descriptions has been increased to 5000.",
  138. isFeature: false,
  139. ),
  140. );
  141. return Container(
  142. padding: const EdgeInsets.only(left: 16),
  143. child: Scrollbar(
  144. controller: scrollController,
  145. thumbVisibility: true,
  146. thickness: 2.0,
  147. child: ListView.builder(
  148. physics: const BouncingScrollPhysics(),
  149. itemBuilder: (context, index) {
  150. return Padding(
  151. padding: const EdgeInsets.only(right: 16.0),
  152. child: ChangeLogEntryWidget(entry: items[index]),
  153. );
  154. },
  155. itemCount: items.length,
  156. ),
  157. ),
  158. );
  159. }
  160. }