This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(DemoApp()); | |
} | |
class DemoApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(DemoApp()); | |
} | |
class DemoApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; | |
import 'package:your_app_package/services/localization/app_translations_delegate.dart'; | |
import 'package:your_app_package/screens/home_page.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatefulWidget { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:ui'; | |
class Application { | |
static final Application _application = Application._internal(); | |
factory Application() { | |
return _application; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import '../localization/app_translations.dart'; | |
class AppTranslationsDelegate extends LocalizationsDelegate<AppTranslations> { | |
final Locale newLocale; | |
const AppTranslationsDelegate({this.newLocale}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_localizations/flutter_localizations.dart'; | |
import 'package:your_app_package/services/localization/app_translations_delegate.dart'; | |
import 'package:your_app_package/screens/home_page.dart'; | |
import 'application.dart'; | |
void main() { | |
runApp(MyApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:your_app_package/application.dart'; | |
import 'package:your_app_package/services/localization/app_translations.dart'; | |
import 'package:flutter/material.dart'; | |
class LanguageSelectorPage extends StatefulWidget { | |
@override | |
_LanguageSelectorPageState createState() => _LanguageSelectorPageState(); | |
} | |
class _LanguageSelectorPageState extends State<LanguageSelectorPage> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "Flutter Ecommerce App", | |
debugShowCheckedModeBanner: false, | |
home: new SplashScreen(), | |
routes: widget.routes, | |
localizationsDelegates: [ | |
_localeOverrideDelegate, | |
const AppTranslationsDelegate(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
bool isSupported(Locale locale) { | |
return application.supportedLanguagesCodes.contains(locale.languageCode); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart' show rootBundle; | |
class AppTranslations { | |
Locale locale; | |
static Map<dynamic, dynamic> _localisedValues; |