Skip to content

Commit

Permalink
add progress graph
Browse files Browse the repository at this point in the history
  • Loading branch information
waozixyz committed Apr 23, 2024
1 parent c871560 commit c6adf23
Show file tree
Hide file tree
Showing 19 changed files with 534 additions and 172 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog
## [1.2.9] - 2024-04-23
## [1.3.0] - 2024-04-23
- Improve layout of exercises
- Update social links
- Add new donation link
- Add indonesian
- Add progress graph

## [1.2.8] - 2024-01-26
- Slight improvements in progress view
Expand Down
6 changes: 5 additions & 1 deletion lib/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,9 @@
"error_importing_data": "Fehler beim Importieren der Daten: ",
"import_cancelled": "Import abgebrochen",
"data_exported_success": "Daten erfolgreich exportiert als ",
"error_exporting_data": "Fehler beim Exportieren der Daten: "
"error_exporting_data": "Fehler beim Exportieren der Daten: ",


"sessions": "Sitzungen",
"graph": "Grafik"
}
6 changes: 5 additions & 1 deletion lib/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
"error_importing_data": "Error importing data: ",
"import_cancelled": "Import cancelled",
"data_exported_success": "Data exported successfully as ",
"error_exporting_data": "Error exporting data: "
"error_exporting_data": "Error exporting data: ",


"sessions": "Sessions",
"graph": "Graph"
}

6 changes: 5 additions & 1 deletion lib/i18n/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@
"error_importing_data": "Error al importar datos: ",
"import_cancelled": "Importación cancelada",
"data_exported_success": "Datos exportados con éxito como ",
"error_exporting_data": "Error al exportar datos: "
"error_exporting_data": "Error al exportar datos: ",


"sessions": "Sesiones",
"graph": "Gráfica"
}
95 changes: 95 additions & 0 deletions lib/i18n/id_ID.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"language_selection_title": "Pemilihan Bahasa",
"language_instruction": "Pilih bahasa pilihan Anda dan tekan lanjut.",

"guide_welcome_title": "Tutorial",
"guide_welcome_description": "Teknik pernapasan yang mudah namun efektif ini menjanjikan kedamaian batin yang mendalam, menawarkan tempat perlindungan dari kesibukan hidup.",
"safety_instruction": "Untuk memastikan keselamatan Anda, praktikkan baik dalam posisi berbaring atau duduk dengan nyaman.",

"guide_method_title": "Metode",
"guide_method_intro": "Ikuti hanya 4 langkah:",
"guide_method_steps": "1. Tarik nafas dan hembuskan secara ritmis selama 30 napas.\n2. Hembuskan dan tahan napas Anda.\n3. Tarik napas dalam-dalam dan tahan selama 15 detik.\n4. Hembuskan dan ulangi langkah 1\n\nLakukan 3-10 putaran dari proses ini.",
"guide_method_personalize": "Halaman berikutnya akan memungkinkan Anda untuk mempersonalisasi pengalaman Anda.",

"guide_step1_title": "Langkah 1: Tarik & Hembus",
"guide_step1_description": "Isi paru-paru Anda dengan nafas penuh, dimulai dari perut, lalu dada Anda.\n\nBiarkan napas mengalir keluar secara alami tanpa tekanan.\n\nUlangi ini selama sekitar 20-40 napas dengan kecepatan yang stabil.",
"breathing_circle": "Lingkaran Pernapasan",

"guide_step2_title": "Langkah 2: Hembuskan & Tahan",
"guide_step2_description": "Hembuskan secara normal dan tahan napas Anda.\nWaktu tahan Anda akan bertambah dengan latihan lebih lanjut dan dengan setiap putaran.\n\nLingkaran di tengah menunjukkan berapa lama Anda menahan napas dan panjang waktu terakhir menahan napas.\n\nLepaskan ketika Anda merasakan dorongan untuk bernapas, hindari menghembuskan terlalu banyak. Tubuh Anda memberi sinyal kapan waktunya untuk bernapas.",

"guide_step3_title": "Langkah 3: Tarik & Tahan",
"guide_step3_description": "Tarik napas sepenuhnya dan tahan selama 15 detik.\nSetelah itu, hembuskan, menyelesaikan putaran pertama.\n\nDengan setiap putaran Anda dapat menahan napas lebih lama dan lebih dalam.",

"back_button": "Kembali",
"continue_button": "Lanjutkan",
"skip_button": "Lewati",
"next_button": "Berikutnya",
"finish_button": "Selesai",
"save_button": "Simpan",
"cancel_button": "Batal",
"close_button": "Tutup",
"start_button": "Mulai",
"stop_button": "Berhenti",

"progress_title": "Tampilan Progres",
"start_journey": "Mulai Perjalanan Anda!",
"progress_records_info": "Catatan kemajuan Anda akan muncul di sini.",
"begin_session_button": "Mulai Sesi",
"rounds_label": "Putaran",
"round_label": "Putaran",
"edit_round": "Edit Putaran",
"select_date": "Pilih Tanggal",
"select_time": "Pilih Waktu",
"minutes_label": "Menit",
"seconds_label": "Detik",

"get_ready": "Siap",
"finish_hold": "Selesai Menahan",
"in_breath": "Tarik",
"out_breath": "Hembus",
"recovery": "Pemulihan",

"results_title": "Hasil",
"rounds_completed": "Putaran Selesai: ",
"no_data": "Tidak ada data",
"save_progress": "Simpan Kemajuan",

"tempo_label": "Tempo",
"volume_label": "Volume",
"breaths_label": "Napas",

"stop_session": "Hentikan Sesi",
"stop_session_confirm": "Apakah Anda yakin ingin mengakhiri sesi?",
"stop_session_button": "Hentikan Sesi",
"continue_session_button": "Lanjutkan Sesi",

"settings_title": "Pengaturan",
"show_tutorial_button": "Tampilkan Tutorial",
"breathing_circle_button": "Lingkaran Pernapasan",
"keep_screen_on_label": "Tetapkan Layar Hidup Selama Latihan",
"language_title": "Bahasa",
"data_management_title": "Manajemen Data",
"export_data_button": "Ekspor Data",
"import_data_button": "Impor Data",
"reset_data_button": "Atur Ulang Data",
"connect_support_title": "Koneksikan & Dukungan",
"app_version_text": "Versi Aplikasi",
"new_version_available": "Versi baru tersedia",
"update_button": "Perbarui",
"privacy_policy": "Kebijakan Privasi",

"confirm_reset": "Konfirmasi Atur Ulang",
"reset_data_warning": "Apakah Anda yakin ingin mengatur ulang semua data? Tindakan ini tidak dapat dibatalkan.",
"cancel": "Batal",
"reset_data": "Atur Ulang Data",
"data_imported_success": "Data berhasil diimpor!",
"error_importing_data": "Kesalahan dalam mengimpor data: ",
"import_cancelled": "Impor dibatalkan",
"data_exported_success": "Data berhasil diekspor sebagai ",
"error_exporting_data": "Kesalahan dalam mengekspor data: ",

"sessions": "Sesi",
"graph": "Grafik"
}

6 changes: 5 additions & 1 deletion lib/i18n/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
"error_importing_data": "Errore durante l'importazione dei dati:",
"import_cancelled": "Importazione annullata",
"data_exported_success": "Dati esportati correttamente come ",
"error_exporting_data": "Errore durante l'esportazione dei dati: "
"error_exporting_data": "Errore durante l'esportazione dei dati: ",


"sessions": "Sessioni",
"graph": "Grafico"
}

25 changes: 13 additions & 12 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'router/router.dart';
import 'utils/platform_checker.dart';

const String title = 'Inner Breeze';
final GlobalKey<_AppState> appKey = GlobalKey();
final GlobalKey<AppState> appKey = GlobalKey();

void run() {
runApp(
Expand Down Expand Up @@ -38,12 +38,10 @@ void main() async {
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();

run();

run();
});
}
else {
} else {
run();
}
}
Expand All @@ -66,12 +64,12 @@ class App extends StatefulWidget {
const App({super.key});

@override
State<App> createState() => _AppState();
State<App> createState() => AppState();
}

class _AppState extends State<App> {
class AppState extends State<App> {
Locale _currentLocale;
_AppState() : _currentLocale = Locale('en');
AppState() : _currentLocale = Locale('en');

@override
void initState() {
Expand All @@ -81,6 +79,7 @@ class _AppState extends State<App> {
_preloadAssets(context);
}
}

Future<void> initializeLocale() async {
final userProvider = Provider.of<UserProvider>(context, listen: false);
String languageCode = await userProvider.getLanguagePreference();
Expand All @@ -99,7 +98,9 @@ class _AppState extends State<App> {
];

// Construct full paths for image assets
final imageAssetPaths = imageAssetFilenames.map((filename) => 'assets/images/$filename').toList();
final imageAssetPaths = imageAssetFilenames
.map((filename) => 'assets/images/$filename')
.toList();

for (final assetPath in imageAssetPaths) {
if (imageExtensions.any((ext) => assetPath.endsWith(ext))) {
Expand All @@ -125,7 +126,8 @@ class _AppState extends State<App> {
Locale('en', 'US'),
Locale('de', 'DE'),
Locale('es', 'ES'),
Locale('it', 'IT')
Locale('it', 'IT'),
Locale('id', 'ID')
],
locale: _currentLocale,
title: title,
Expand All @@ -142,5 +144,4 @@ class _AppState extends State<App> {
},
);
}

}
}
11 changes: 8 additions & 3 deletions lib/models/session.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Session {
final String id;
final String id;
Map<int, Duration> rounds;

Session({required this.id, required this.rounds});
Expand All @@ -14,7 +14,8 @@ class Session {
Map<String, dynamic> toJson() {
return {
'id': id,
'rounds': rounds.map((key, value) => MapEntry(key.toString(), value.inMilliseconds)),
'rounds': rounds
.map((key, value) => MapEntry(key.toString(), value.inMilliseconds)),
};
}

Expand All @@ -30,6 +31,10 @@ class Session {
);
}

// Utility method to get the DateTime from the id
DateTime get dateTime => DateTime.parse(id);

int totalDurationInSeconds() {
return rounds.values
.fold(0, (int total, Duration d) => total + d.inSeconds);
}
}
6 changes: 4 additions & 2 deletions lib/screens/exercise/exercise_step1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ class _ExerciseStep1State extends State<ExerciseStep1> {
onPressed: skipCountdown,
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
foregroundColor:
Theme.of(context).primaryTextTheme.button?.color,
foregroundColor: Theme.of(context)
.primaryTextTheme
.labelLarge
?.color,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0),
),
Expand Down
6 changes: 4 additions & 2 deletions lib/screens/exercise/exercise_step2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ class _ExerciseStep2State extends State<ExerciseStep2> {
onPressed: _navigateToNextExercise,
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
foregroundColor:
Theme.of(context).primaryTextTheme.button?.color,
foregroundColor: Theme.of(context)
.primaryTextTheme
.labelLarge
?.color,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0),
),
Expand Down
6 changes: 4 additions & 2 deletions lib/screens/exercise/exercise_step3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ class _ExerciseStep3State extends State<ExerciseStep3> {
},
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
foregroundColor:
Theme.of(context).primaryTextTheme.button?.color,
foregroundColor: Theme.of(context)
.primaryTextTheme
.labelLarge
?.color,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0),
),
Expand Down
Loading

0 comments on commit c6adf23

Please sign in to comment.