ente/lib/ui/notification/update/change_log_page.dart
2023-02-02 11:17:32 +05:30

158 lines
5.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:photos/services/update_service.dart';
import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/components/button_widget.dart';
import 'package:photos/ui/components/divider_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/components/title_bar_title_widget.dart';
import 'package:photos/ui/notification/update/change_log_entry.dart';
class ChangeLogPage extends StatefulWidget {
const ChangeLogPage({
Key? key,
}) : super(key: key);
@override
State<ChangeLogPage> createState() => _ChangeLogPageState();
}
class _ChangeLogPageState extends State<ChangeLogPage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
final enteColorScheme = getEnteColorScheme(context);
return Scaffold(
appBar: null,
body: Container(
color: enteColorScheme.backgroundElevated,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
height: 36,
),
Container(
alignment: Alignment.centerLeft,
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: TitleBarTitleWidget(
title: "What's new",
),
),
),
const SizedBox(
height: 24,
),
Expanded(child: _getChangeLog()),
const DividerWidget(
dividerType: DividerType.solid,
),
SafeArea(
child: Padding(
padding: const EdgeInsets.only(
left: 16.0,
right: 16,
top: 16,
bottom: 8,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ButtonWidget(
buttonType: ButtonType.trailingIconPrimary,
buttonSize: ButtonSize.large,
labelText: "Continue",
icon: Icons.arrow_forward_outlined,
onTap: () async {
await UpdateService.instance.hideChangeLog();
if (mounted && Navigator.of(context).canPop()) {
Navigator.of(context).pop();
}
},
),
const SizedBox(
height: 8,
),
ButtonWidget(
buttonType: ButtonType.trailingIconSecondary,
buttonSize: ButtonSize.large,
labelText: "Rate the app",
icon: Icons.favorite_rounded,
iconColor: enteColorScheme.primary500,
onTap: () async {
await UpdateService.instance.launchReviewUrl();
},
),
const SizedBox(height: 8),
],
),
),
),
],
),
),
);
}
Widget _getChangeLog() {
final scrollController = ScrollController();
final List<ChangeLogEntry> items = [];
items.add(
ChangeLogEntry(
"Collaborative albums ✨",
"Much awaited, they're here now - create albums where multiple ente "
"users can add photos!\n\nWhen sharing an album, you can specify if"
" you want to add someone as a viewer or a collaborator. Collaborators can add photos "
"to the shared album.\n\nAlbums can have both collaborators and viewers, and as many as "
"you like. Storage is only counted once, for the person who uploaded the photo."
"\n\nHead over to the sharing options for an album to start adding collaborators.",
),
);
items.add(
ChangeLogEntry(
"Uncategorized",
"You can now keep photos that do not belong to a specific album."
"\n\nThis will simplify deletion and make it safer since now ente "
"will have a place to put photos that don't belong to any album "
"instead of always deleting them.\n\nThis will also allow you to "
"choose between keeping vs deleting photos present in the album, "
"when deleting an album.\n\nUncategorized photos can be seen from "
"the bottom of the albums tab.",
),
);
items.add(
ChangeLogEntry(
'''Cleaner album picker''',
"Among other improvements, the list of albums that is shown when adding "
"or moving photos gets a facelift, and an issue causing the photo "
"zoom to be reset after loading the full resolution photo has been fixed.",
isFeature: false,
),
);
return Container(
padding: const EdgeInsets.only(left: 16),
child: Scrollbar(
controller: scrollController,
thumbVisibility: true,
thickness: 2.0,
child: ListView.builder(
physics: const BouncingScrollPhysics(),
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(right: 16.0),
child: ChangeLogEntryWidget(entry: items[index]),
);
},
itemCount: items.length,
),
),
);
}
}