Skip to content

Commit

Permalink
fixed localization updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aruhant committed Feb 8, 2024
1 parent 74e34c7 commit b989c74
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
5 changes: 3 additions & 2 deletions app/lib/game/game_engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,10 @@ class _GameEngineState extends State<GameEngine> {
child: IconButton(
icon: const Icon(Icons.close),
onPressed: () {
Navigator.of(context).pushReplacement(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) => const TitleScreen()));
builder: (context) => const TitleScreen()),
(route) => false);
}),
),
),
Expand Down
5 changes: 3 additions & 2 deletions app/lib/game/platform_game_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ class PlatformGameController extends GameComponent {
child: Text('play_again'.tr()),
),
TextButton(
onPressed: () => Navigator.of(context).pushReplacement(
onPressed: () => Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) => const TitleScreen())),
builder: (context) => const TitleScreen()),
(route) => false),
child: Text('next_level'.tr()),
),
],
Expand Down
10 changes: 10 additions & 0 deletions app/lib/title_screen/language_picker.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:ramayana/title_screen/title_screen.dart';

class LanguagePicker extends StatelessWidget {
const LanguagePicker({Key? key}) : super(key: key);
Expand All @@ -17,6 +18,15 @@ class LanguagePicker extends StatelessWidget {
child: const Text('Language/भाषा')),
onSelected: (Locale language) {
context.setLocale(language);
Navigator.pushAndRemoveUntil(
context,
PageRouteBuilder(
pageBuilder: (context, animation1, animation2) =>
const TitleScreen(),
transitionDuration: Duration.zero,
),
(route) => false,
);
},
itemBuilder: (BuildContext context) {
return <PopupMenuEntry<Locale>>[
Expand Down
10 changes: 6 additions & 4 deletions app/lib/title_screen/title_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ class _TitleScreenState extends State<TitleScreen> {
builder: (context) => LevelIntro(
level: 'credits',
onFinished: (context) =>
Navigator.pushReplacement(
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) =>
TitleScreen()))))),
TitleScreen()),
(route) => false)))),
child: Text(
'credits'.tr(),
style: TextStyle(color: Colors.black87),
Expand Down Expand Up @@ -107,11 +108,12 @@ class _TitleScreenState extends State<TitleScreen> {
builder: (context) => LevelIntro(
level: 'lanka_dahan',
onFinished: (context) =>
Navigator.pushReplacement(
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => GameEngine(
level: 'lanka_dahan')))))),
level: 'lanka_dahan')),
(route) => false)))),
// const GameEngine(level: 'lanka_dahan'))),
child: Text('start_game'.tr())),
],
Expand Down

0 comments on commit b989c74

Please sign in to comment.