Skip to content

Instantly share code, notes, and snippets.

Rohan Taneja rohan20

View GitHub Profile
@rohan20
rohan20 / flutter_google_maps_bottom_sheet.dart
Last active May 29, 2020
Flutter Google Maps Bottom Sheet
View flutter_google_maps_bottom_sheet.dart
import 'package:flutter/material.dart';
class GoogleMapsClonePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
CustomGoogleMap(),
CustomHeader(),
@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;
You can’t perform that action at this time.