Skip to content

Commit

Permalink
v1.0.8+13 - adding translations
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Dec 22, 2023
1 parent f2ad5f1 commit 5b1c2d9
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 54 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ I would like to implement the following:
- remove unused tiles from the cache to decrease memory usage
- display updates
- add a 360-degree view on the bottom and let the user scroll fast using it
- add translations
- increase OpenStreetMap fonts
- add translations for more than just the intro screen
- more progress-info needs:
- show precision on GPS-lock
- when downloading map, show that it's decompressing instead of
Expand Down Expand Up @@ -64,12 +65,16 @@ The following data is collected by version 1.0.0:

## CHANGELOG

- 2023-12-20 - v1.0.8+13
- add an "info" button to replay intro and "Buy me a coffee"
- add French and German translation

- 2023-11-17 - v1.0.7+12
- Fix bug where the direction of the view is always initialized to 240˚

- 2023-11-15 - v1.0.6+11
- Apple-store complaint fixed: when the GPS doesn't give a fix in a reasonable time, show
a list of pre-defined positions to jump to
- Apple-store complaint fixed: when the GPS doesn't give a fix in a reasonable time,
show the Matterhorn

- 2023-11-13 - v1.0.5+10
- BUG: when first started up, the panorama cannot be scrolled
Expand Down
10 changes: 8 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleLocalizations</key>
<array>
<string>de</string>
<string>fr</string>
<string>en</string>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.travel</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
Expand Down Expand Up @@ -33,8 +41,6 @@
Your location data remains on your device and is not stored externally.
We do not share your exact location with any third parties.
</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
3 changes: 3 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
23 changes: 17 additions & 6 deletions lib/app_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import 'package:latlong2/latlong.dart';
import 'map_widget/map_params.dart';
import 'map_widget/map_widget.dart';
import 'panorama_widget/panorama_widget.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class AppWidget extends StatefulWidget {
const AppWidget({super.key, required this.title});
const AppWidget(this.sink, {super.key});

final String title;
final Sink<void> sink;

@override
State<AppWidget> createState() => _AppWidgetState();
Expand All @@ -28,6 +29,7 @@ class _AppWidgetState extends State<AppWidget> {
final toPanorama = StreamController<MapParams>.broadcast();
final fromPanorama = StreamController<MapParams>.broadcast();
final toMain = StreamController<MainMsg>();
AppLocalizations? i18n;

@override
void initState() {
Expand Down Expand Up @@ -65,9 +67,19 @@ class _AppWidgetState extends State<AppWidget> {

@override
Widget build(BuildContext context) {
i18n ??= AppLocalizations.of(context);
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
title: Text(i18n!.title),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.info),
tooltip: 'Show Intro',
onPressed: () {
widget.sink.add(null);
},
),
],
),
body: Center(
child: Column(
Expand Down Expand Up @@ -122,7 +134,7 @@ class _AppWidgetState extends State<AppWidget> {
var position = await _determinePosition();
newPosition = LatLng(position.latitude, position.longitude);
textStr += "\nLocked on GPS";
} catch(e){
} catch (e) {
textStr += "\nCouldn't find GPS - showing Matterhorn";
newPosition = const LatLng(46.011714, 7.791969);
toPanorama.add(MapParams.sendViewDirection(240));
Expand Down Expand Up @@ -290,6 +302,5 @@ Future<Position> _determinePosition() async {
// When we reach here, permissions are granted and we can
// continue accessing the position of the device.
return await Geolocator.getCurrentPosition(
timeLimit: const Duration(seconds: 10)
);
timeLimit: const Duration(seconds: 10));
}
59 changes: 26 additions & 33 deletions lib/intro_widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:intro_slider/intro_slider.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class IntroWidget extends StatefulWidget {
const IntroWidget(this.sink, {super.key});
Expand All @@ -12,58 +13,48 @@ class IntroWidget extends StatefulWidget {

class _IntroWidget extends State<IntroWidget> {
List<ContentConfig> listContentConfig = [];
AppLocalizations? i18n;

@override
void initState() {
super.initState();
}

void initListContent() {
if (listContentConfig.isNotEmpty) {
return;
}

listContentConfig.add(
const ContentConfig(
title: "Draw Panoramas",
description:
"Draw wonderful panoramas of the mountains and hills around your. "
"Or visit other places to see what panorama you saw the day before, "
"or what you can expect on that trip next week!",
ContentConfig(
title: i18n?.intro_1_title,
description: i18n?.intro_1_text,
pathImage: "assets/intro/mont_blanc_1.png",
backgroundColor: Color(0xffaaaa55),
backgroundColor: const Color(0xffaaaa55),
),
);
listContentConfig.add(
const ContentConfig(
title: "Pan around",
description:
"You can pan the panorama view to see a different part of the horizon. "
"On the map the view of the horizon will be updated. "
"This allows you to evaluate the distance to the hills and mountains "
"around you.",
ContentConfig(
title: i18n?.intro_2_title,
description: i18n?.intro_2_text,
pathImage: "assets/intro/mont_blanc_2.png",
backgroundColor: Color(0xff99aa55),
backgroundColor: const Color(0xff99aa55),
),
);
listContentConfig.add(
const ContentConfig(
title: "Put on the Binoculars",
description:
"If you want to know more about a given spot in the panorama, you can "
"simply tap on it and a magnified view will pop up. "
"The display will show the heading, distance, and height of the "
"chosen point in the panorama. "
"Of course you can still pan around.",
ContentConfig(
title: i18n?.intro_3_title,
description: i18n?.intro_3_text,
pathImage: "assets/intro/mont_blanc_3.png",
backgroundColor: Color(0xff77aa55),
backgroundColor: const Color(0xff77aa55),
),
);
listContentConfig.add(
const ContentConfig(
title: "Loading the Maps",
description:
"The first time you view a panorama in a new geographical zone, the app "
"will download the elevation-maps. "
"This takes some time, so please be patient. "
"Once the maps are loaded, they will be stored for faster "
"viewing pleasure.",
ContentConfig(
title: i18n?.intro_4_title,
description: i18n?.intro_4_text,
pathImage: "assets/intro/loading_map.png",
backgroundColor: Color(0xff55aa55),
backgroundColor: const Color(0xff55aa55),
),
);
}
Expand All @@ -74,6 +65,8 @@ class _IntroWidget extends State<IntroWidget> {

@override
Widget build(BuildContext context) {
i18n ??= AppLocalizations.of(context);
initListContent();
return IntroSlider(
key: UniqueKey(),
listContentConfig: listContentConfig,
Expand Down
13 changes: 13 additions & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": "Interaktiver Panoramablick auf die Berge",
"intro_1_title": "Panoramen erstellen",
"intro_1_text": "Erstellen Sie wundervolle Panoramaaufnahmen der Berge und Hügel in Ihrer Umgebung. Oder besuchen Sie andere Orte, um das Panorama zu sehen, das Sie am Vortag gesehen haben. Sie können sogar überprüfen, was Sie auf Ihrer Reise nächste Woche erwarten können!",
"intro_2_title": "Panorama schwenken",
"intro_2_text": "Sie können die Panoramaansicht schwenken, um einen anderen Teil des Horizonts zu sehen. Auf der Karte wird die Sicht auf den Horizont aktualisiert. Dies ermöglicht es Ihnen, die Entfernung zu den Hügeln und Bergen um Sie herum zu beurteilen.",
"intro_3_title": "Zum Fernglas greifen",
"intro_3_text": "Wenn Sie mehr über einen bestimmten Punkt im Panorama erfahren möchten, können Sie einfach darauf tippen und eine vergrößerte Ansicht wird angezeigt. Das Display zeigt Azimut, Entfernung und Höhe des gewählten Punktes im Panorama. Selbstverständlich können Sie sich weiterhin umsehen.",
"intro_4_title": "Karten laden",
"intro_4_text": "Beim ersten Betrachten eines Panoramas in einem neuen geografischen Gebiet lädt die App die Höhenkarten herunter. Dies dauert einige Zeit, also seien Sie geduldig. Sobald die Karten geladen sind, werden sie für eine schnellere Wiedergabe gespeichert.",

"zzz": "Das Ende"
}
13 changes: 13 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": "Interactive Mountain Panorama",
"intro_1_title": "Draw Panoramas",
"intro_1_text": "Draw wonderful panoramas of the mountains and hills around your location. Or visit other places to see what panorama you saw the day before. You can even check what you can expect on that trip next week!",
"intro_2_title": "Pan around",
"intro_2_text": "You can pan the panorama view to see a different part of the horizon. On the map the view of the horizon will be updated. This allows you to evaluate the distance to the hills and mountains around you.",
"intro_3_title": "Put on the Binoculars",
"intro_3_text": "If you want to know more about a given spot in the panorama, you can simply tap on it and a magnified view will pop up. The display will show the heading, distance, and height of the chosen point in the panorama. Of course you can still pan around.",
"intro_4_title": "Loading the Maps",
"intro_4_text": "The first time you view a panorama in a new geographical zone, the app will download the elevation-maps. This takes some time, so please be patient. Once the maps are loaded, they will be stored for faster viewing pleasure.",

"zzz": "The end"
}
13 changes: 13 additions & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": "Panorama interactif des montagnes",
"intro_1_title": "Dessiner des panoramas",
"intro_1_text": "Dessinez de magnifiques panoramas des montagnes et collines autour de votre position. Ou visitez d'autres endroits pour voir le panorama que vous avez vu la veille. Vous pouvez même vérifier ce à quoi vous pouvez vous attendre pour ce voyage la semaine prochaine!",
"intro_2_title": "Panorama panoramique",
"intro_2_text": "Vous pouvez déplacer la vue panoramique pour voir une autre partie de l'horizon. Sur la carte, la vue de l'horizon sera mise à jour. Cela vous permet d'évaluer la distance aux collines et montagnes autour de vous.",
"intro_3_title": "Mettre les jumelles",
"intro_3_text": "Si vous souhaitez en savoir plus sur un point donné du panorama, vous pouvez simplement appuyer dessus et une vue agrandie apparaîtra. L'affichage affichera la tête, la distance et la hauteur du point choisi dans le panorama. Bien sûr, vous pouvez toujours vous déplacer.",
"intro_4_title": "Chargement des cartes",
"intro_4_text": "La première fois que vous visualisez un panorama dans une nouvelle zone géographique, l'application téléchargera les cartes d'élévation. Cela prend du temps, alors soyez patient. Une fois les cartes chargées, elles seront stockées pour un plaisir visuel plus rapide.",

"zzz": "La fin"
}
23 changes: 17 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:peak_tap/app_widget.dart';
import 'package:peak_tap/intro_widget.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

void main() {
runApp(const PeakTap());
Expand All @@ -15,20 +17,29 @@ class PeakTap extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'), // English
Locale('fr'), // French
Locale('de'), // German
],
debugShowCheckedModeBanner: false,
title: 'PeakTap',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MainPage(title: 'Interactive Mountain Panorama'),
home: const MainPage(),
);
}
}

class MainPage extends StatefulWidget {
const MainPage({super.key, required this.title});

final String title;
const MainPage({super.key});

@override
State<MainPage> createState() => _MainPage();
Expand All @@ -44,7 +55,7 @@ class _MainPage extends State<MainPage> {

showAppChannel.stream.listen((event) {
setState(() {
showApp = true;
showApp = !showApp;
SharedPreferences.getInstance()
.then((value) => {value.setBool("showApp", true)});
});
Expand All @@ -58,7 +69,7 @@ class _MainPage extends State<MainPage> {
@override
Widget build(BuildContext context) {
if (showApp) {
return AppWidget(title: widget.title);
return AppWidget(showAppChannel.sink);
} else {
return IntroWidget(showAppChannel.sink);
}
Expand Down
11 changes: 8 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_map:
dependency: "direct main"
description:
Expand Down Expand Up @@ -241,13 +246,13 @@ packages:
source: hosted
version: "4.1.3"
intl:
dependency: transitive
dependency: "direct main"
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6
url: "https://pub.dev"
source: hosted
version: "0.18.1"
version: "0.18.0"
intro_slider:
dependency: "direct main"
description:
Expand Down
7 changes: 6 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.7+12
version: 1.0.8+13

environment:
sdk: '>=3.0.0'
Expand Down Expand Up @@ -49,6 +49,9 @@ dependencies:
shared_preferences: ^2.2.1
intro_slider: ^4.2.1
vector_math: ^2.1.4
flutter_localizations:
sdk: flutter
intl: any

dev_dependencies:
flutter_test:
Expand All @@ -74,6 +77,8 @@ flutter_launcher_icons:

# The following section is specific to Flutter packages.
flutter:
# This is for i18n
generate: true

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
Expand Down

0 comments on commit 5b1c2d9

Please sign in to comment.