From a60de417a3e0b508b0b15a9651f7078e94f01cee Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 12 Aug 2020 17:36:00 +0200 Subject: [PATCH] Add a Feature Timeline screen --- assets/langs/en.yaml | 8 +- lib/features.dart | 18 +++++ lib/screens/feature_timeline_screen.dart | 97 ++++++++++++++++++++++++ lib/screens/settings_screen.dart | 13 +++- 4 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 lib/screens/feature_timeline_screen.dart diff --git a/assets/langs/en.yaml b/assets/langs/en.yaml index 6a4a0176..85f88a29 100644 --- a/assets/langs/en.yaml +++ b/assets/langs/en.yaml @@ -182,7 +182,7 @@ feature: fileNameCustomize: Customize Note FileName noteMetaDataCustomize: title: Customize Note Metadata - subtitle: Allows GitJorunal to be used with static website generators + subtitle: Allows GitJournal to be used with static website generators autoMergeConflicts: Automation Merge Conflict Resolution noteSorting: Configurable Note Sorting gitPushFreq: Configurable Git Sync Frequency @@ -203,6 +203,12 @@ feature: yamlTagsKey: Customize the YAML tags key disableYamlHeader: Disable YAML Metadata Header customizeHomeScreen: Customize Home Screen + zenMode: Zen Writing Mode emojiSupport: title: Emoji Support subtitle: "Convert :heart: to ❤️" + allNotesView: Add a screen to show "All Notes" + basicSearch: Basic Search + +feature_timeline: + title: Feature Timeline diff --git a/lib/features.dart b/lib/features.dart index 3a4243c0..dd8d4f1d 100644 --- a/lib/features.dart +++ b/lib/features.dart @@ -4,6 +4,7 @@ class Features { static bool perFolderConfig = false; static final all = [ + Feature.basicSearch, Feature.darkMode, Feature.rawEditor, Feature.folderSupport, @@ -17,6 +18,7 @@ class Features { Feature.checkListEditor, Feature.disableYamlHeader, Feature.journalEditor, + Feature.allNotesView, Feature.diffViews, Feature.journalEditorDefaultFolder, Feature.customizeHomeScreen, @@ -43,6 +45,14 @@ class Feature { Feature(this.featureName, this.date, this.title, this.subtitle, this.pro); + static final basicSearch = Feature( + "DarkMode", + DateTime(2019, 09, 15), + tr("feature.basicSearch"), + "", + false, + ); + static final darkMode = Feature( "DarkMode", DateTime(2019, 09, 25), @@ -147,6 +157,14 @@ class Feature { false, ); + static final allNotesView = Feature( + "AllNotesView", + DateTime(2020, 03, 15), + tr("feature.allNotesView"), + "", + false, + ); + static final diffViews = Feature( "DiffViews", DateTime(2020, 04, 01), diff --git a/lib/screens/feature_timeline_screen.dart b/lib/screens/feature_timeline_screen.dart new file mode 100644 index 00000000..bae8633d --- /dev/null +++ b/lib/screens/feature_timeline_screen.dart @@ -0,0 +1,97 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:gitjournal/features.dart'; + +class FeatureTimelineScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(tr('feature_timeline.title')), + ), + body: ListView( + children: [ + for (var feature in Features.all) FeatureTile(feature), + ], + ), + ); + } +} + +class FeatureTile extends StatelessWidget { + final Feature feature; + + FeatureTile(this.feature); + + @override + Widget build(BuildContext context) { + var dateStr = feature.date.toIso8601String().substring(0, 10); + var subtitle = dateStr; + if (feature.subtitle.isNotEmpty) { + subtitle += ' - ' + feature.subtitle; + } + + var theme = Theme.of(context); + var textTheme = theme.textTheme; + var titleTextStyle = textTheme.subtitle1.copyWith(); + var subTitleTextStyle = textTheme.bodyText2.copyWith( + color: textTheme.caption.color, + ); + + return Container( + padding: const EdgeInsets.symmetric( + vertical: 10.0, + horizontal: 16.0, + ), + child: Row( + children: [ + Container( + width: 56.0, + child: feature.pro ? _Sign('PRO') : _Sign("FREE"), + ), + Expanded( + child: Column( + children: [ + Text(feature.title, style: titleTextStyle), + const SizedBox(height: 4.0), + Flexible( + child: Text( + subtitle, + style: subTitleTextStyle, + overflow: TextOverflow.clip, + softWrap: true, + ), + ), + ], + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + ), + ) + ], + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + ), + ); + } +} + +class _Sign extends StatelessWidget { + final String text; + _Sign(this.text); + + @override + Widget build(BuildContext context) { + var theme = Theme.of(context); + var textStyle = theme.textTheme.subtitle2; + if (text == 'PRO') { + if (theme.brightness == Brightness.light) { + textStyle = textStyle.copyWith(color: theme.primaryColor); + } else { + textStyle = textStyle.copyWith(color: theme.accentColor); + } + } + + return Text(text, style: textStyle); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index d0276cd0..a60adebb 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:dynamic_theme/dynamic_theme.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:gitjournal/screens/feature_timeline_screen.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -252,7 +253,17 @@ class SettingsListState extends State { }, ), const SizedBox(height: 16.0), - SettingsHeader(tr('settings.analytics')), + ListTile( + title: Text(tr("feature_timeline.title")), + onTap: () { + var route = MaterialPageRoute( + builder: (context) => FeatureTimelineScreen(), + settings: const RouteSettings(name: '/featureTimeline'), + ); + Navigator.of(context).push(route); + }, + ), + const SizedBox(height: 16.0), SwitchListTile( title: Text(tr('settings.usageStats')), value: settings.collectUsageStatistics,