change_log_page.dart 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import "dart:async";
  2. import 'package:flutter/material.dart';
  3. import "package:photos/generated/l10n.dart";
  4. import 'package:photos/services/update_service.dart';
  5. import 'package:photos/theme/ente_theme.dart';
  6. import 'package:photos/ui/components/buttons/button_widget.dart';
  7. import 'package:photos/ui/components/divider_widget.dart';
  8. import 'package:photos/ui/components/models/button_type.dart';
  9. import 'package:photos/ui/components/title_bar_title_widget.dart';
  10. import 'package:photos/ui/notification/update/change_log_entry.dart';
  11. import "package:url_launcher/url_launcher_string.dart";
  12. class ChangeLogPage extends StatefulWidget {
  13. const ChangeLogPage({
  14. Key? key,
  15. }) : super(key: key);
  16. @override
  17. State<ChangeLogPage> createState() => _ChangeLogPageState();
  18. }
  19. class _ChangeLogPageState extends State<ChangeLogPage> {
  20. @override
  21. void initState() {
  22. super.initState();
  23. }
  24. @override
  25. Widget build(BuildContext context) {
  26. final enteColorScheme = getEnteColorScheme(context);
  27. return Scaffold(
  28. appBar: null,
  29. body: Container(
  30. color: enteColorScheme.backgroundElevated,
  31. child: Column(
  32. mainAxisAlignment: MainAxisAlignment.center,
  33. children: [
  34. const SizedBox(
  35. height: 36,
  36. ),
  37. Container(
  38. alignment: Alignment.centerLeft,
  39. child: const Padding(
  40. padding: EdgeInsets.symmetric(horizontal: 16.0),
  41. child: TitleBarTitleWidget(
  42. title: "What's new",
  43. ),
  44. ),
  45. ),
  46. const SizedBox(
  47. height: 24,
  48. ),
  49. Expanded(child: _getChangeLog()),
  50. const DividerWidget(
  51. dividerType: DividerType.solid,
  52. ),
  53. SafeArea(
  54. child: Padding(
  55. padding: const EdgeInsets.only(
  56. left: 16.0,
  57. right: 16,
  58. top: 16,
  59. bottom: 8,
  60. ),
  61. child: Column(
  62. crossAxisAlignment: CrossAxisAlignment.start,
  63. children: [
  64. ButtonWidget(
  65. buttonType: ButtonType.trailingIconPrimary,
  66. buttonSize: ButtonSize.large,
  67. labelText: S.of(context).continueLabel,
  68. icon: Icons.arrow_forward_outlined,
  69. onTap: () async {
  70. await UpdateService.instance.hideChangeLog();
  71. if (mounted && Navigator.of(context).canPop()) {
  72. Navigator.of(context).pop();
  73. }
  74. },
  75. ),
  76. const SizedBox(
  77. height: 8,
  78. ),
  79. ButtonWidget(
  80. buttonType: ButtonType.trailingIconSecondary,
  81. buttonSize: ButtonSize.large,
  82. labelText: S.of(context).joinDiscord,
  83. icon: Icons.discord_outlined,
  84. iconColor: enteColorScheme.primary500,
  85. onTap: () async {
  86. unawaited(
  87. launchUrlString(
  88. "https://discord.com/invite/z2YVKkycX3",
  89. mode: LaunchMode.externalApplication,
  90. ),
  91. );
  92. },
  93. ),
  94. // ButtonWidget(
  95. // buttonType: ButtonType.trailingIconSecondary,
  96. // buttonSize: ButtonSize.large,
  97. // labelText: S.of(context).rateTheApp,
  98. // icon: Icons.favorite_rounded,
  99. // iconColor: enteColorScheme.primary500,
  100. // onTap: () async {
  101. // await UpdateService.instance.launchReviewUrl();
  102. // },
  103. // ),
  104. const SizedBox(height: 8),
  105. ],
  106. ),
  107. ),
  108. ),
  109. ],
  110. ),
  111. ),
  112. );
  113. }
  114. Widget _getChangeLog() {
  115. final scrollController = ScrollController();
  116. final List<ChangeLogEntry> items = [];
  117. items.addAll([
  118. ChangeLogEntry(
  119. "Map View ✨",
  120. 'You can now view the location where a photo was clicked.\n'
  121. '\nOpen a photo and tap the Info button to view its place on the map!',
  122. ),
  123. ChangeLogEntry(
  124. "Bug Fixes",
  125. 'Many a bugs were squashed in this release.\n'
  126. '\nIf you run into any, please write to team@ente.io, or let us know on Discord! 🙏',
  127. ),
  128. ]);
  129. return Container(
  130. padding: const EdgeInsets.only(left: 16),
  131. child: Scrollbar(
  132. controller: scrollController,
  133. thumbVisibility: true,
  134. thickness: 2.0,
  135. child: ListView.builder(
  136. physics: const BouncingScrollPhysics(),
  137. itemBuilder: (context, index) {
  138. return Padding(
  139. padding: const EdgeInsets.only(right: 16.0),
  140. child: ChangeLogEntryWidget(entry: items[index]),
  141. );
  142. },
  143. itemCount: items.length,
  144. ),
  145. ),
  146. );
  147. }
  148. }