Feature Timeline: translate text with link to GitHub

This commit is contained in:
Vishesh Handa
2020-09-05 11:38:22 +02:00
parent 7a5964289a
commit 1e8131549d
2 changed files with 28 additions and 18 deletions

View File

@ -333,6 +333,7 @@ feature_timeline:
title: Feature Timeline
progress: In Progress
plan: Planned
issues: GitJournal's development is tracked on Github. Please consider voting on the issues you consider important.
purchase_screen:
title: Pro Version

View File

@ -159,32 +159,41 @@ class _DevelopmentText extends StatelessWidget {
Widget build(BuildContext context) {
var style = Theme.of(context).textTheme.bodyText2;
var str = tr('feature_timeline.issues');
var i = str.toLowerCase().indexOf('github');
if (i == -1) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: RichText(text: TextSpan(children: [gitHubLink(str)])),
);
}
var before = str.substring(0, i);
var after = str.substring(i + 6);
return Padding(
padding: const EdgeInsets.all(16.0),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: "GitJournal's development is tracked on ",
style: style,
TextSpan(text: before, style: style),
gitHubLink('GitHub'),
TextSpan(text: after, style: style),
],
),
TextSpan(
text: 'GitHub',
),
);
}
TextSpan gitHubLink(String text) {
return TextSpan(
text: text,
style: const TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer()
..onTap = () {
launch(githubUrl);
logEvent(Event.FeatureTimelineGithubClicked);
},
),
TextSpan(
text:
" Please consider voting on the issues you consider important.",
style: style,
),
],
),
),
);
}
}