Skip to content

Instantly share code, notes, and snippets.

😄
Working with Flutter in b/w Android gradle builds

Rohan Taneja rohan20

😄
Working with Flutter in b/w Android gradle builds
Block or report user

Report or block rohan20

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rohan20
rohan20 / main.dart
Created Sep 3, 2018
flutter-localizations
View main.dart
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Flutter Ecommerce App",
debugShowCheckedModeBanner: false,
home: new SplashScreen(),
routes: widget.routes,
localizationsDelegates: [
_localeOverrideDelegate,
const AppTranslationsDelegate(),
View app_translations_delegate.dart
@override
bool isSupported(Locale locale) {
return application.supportedLanguagesCodes.contains(locale.languageCode);
}
View language_selector_page.dart
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> {
@rohan20
rohan20 / home_page.dart
Last active Sep 4, 2018
flutter-localizations
View home_page.dart
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());
}
View specific_translations_delegate.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:your_app_package/services/localization/app_translations.dart';
class SpecificTranslationsDelegate extends LocalizationsDelegate<AppTranslations> {
final Locale overriddenLocale;
const SpecificTranslationsDelegate(this.overriddenLocale);
@rohan20
rohan20 / application.dart
Last active Oct 7, 2018
flutter-localizations
View application.dart
import 'dart:ui';
class Application {
static final Application _application = Application._internal();
factory Application() {
return _application;
}
@rohan20
rohan20 / main.dart
Last active Nov 10, 2018
flutter-localizations
View main.dart
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 {
View app_translations_delegate.dart
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});
@rohan20
rohan20 / app_translations.dart
Last active Sep 3, 2018
flutter-localizations
View app_translations.dart
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;
@rohan20
rohan20 / localization_en.json
Last active Sep 3, 2018
flutter-localization
View localization_en.json
{
"tab_home": "Home",
"tab_categories": "Categories",
"tab_profile": "Profile",
"tab_notifications": "Notifications",
"tab_bag": "Bag",
"title_select_language": "Select Language"
}
You can’t perform that action at this time.