mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
Add a Feature Timeline screen
This commit is contained in:
@ -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
|
||||
|
@ -4,6 +4,7 @@ class Features {
|
||||
static bool perFolderConfig = false;
|
||||
|
||||
static final all = <Feature>[
|
||||
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),
|
||||
|
97
lib/screens/feature_timeline_screen.dart
Normal file
97
lib/screens/feature_timeline_screen.dart
Normal file
@ -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: <Widget>[
|
||||
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);
|
||||
}
|
||||
}
|
@ -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<SettingsList> {
|
||||
},
|
||||
),
|
||||
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,
|
||||
|
Reference in New Issue
Block a user