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 'dart:io'; | |
import 'dart:async'; | |
import 'package:flutter/services.dart'; | |
import 'package:image_gallery/image_gallery.dart'; | |
void main() => runApp( | |
new 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 Flutter | |
import UIKit | |
import Photos | |
public class SwiftFlutterGallaryPlugin: NSObject, FlutterPlugin { | |
public static func register(with registrar: FlutterPluginRegistrar) { | |
let channel = FlutterMethodChannel(name: "image_gallery", binaryMessenger: registrar.messenger()) | |
let instance = SwiftFlutterGallaryPlugin() | |
registrar.addMethodCallDelegate(instance, channel: channel) | |
} |
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
package adhoc.successive.com.fluttergallaryplugin; | |
import android.Manifest; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.app.Application; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.database.Cursor; | |
import android.net.Uri; |
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
dependencies: | |
flutter: | |
sdk: flutter | |
flutter_localizations: | |
sdk: flutter |
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
void _updateLocale(String lang, String country) async { | |
var prefs = await SharedPreferences.getInstance(); | |
prefs.setString('languageCode', lang); | |
prefs.setString('countryCode', country); | |
MyApp.setLocale(context, Locale(lang, country)); | |
} |
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
localizationsDelegates: [ | |
AppLocalizationsDelegate(), | |
GlobalMaterialLocalizations.delegate, | |
GlobalWidgetsLocalizations.delegate, | |
], | |
supportedLocales: [ | |
const Locale('en', ''), // English | |
const Locale('hi', ''), // Hindi | |
], | |
locale: locale, |
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
_fetchLocale() async { | |
var prefs = await SharedPreferences.getInstance(); | |
if (prefs.getString('languageCode') == null) { | |
return null; | |
} | |
print('_fetchLocale():' + | |
(prefs.getString('languageCode') +':' + prefs.getString('countryCode'))); | |
return Locale( |
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
static void setLocale(BuildContext context, Locale newLocale) async { | |
_MyAppState state = context.ancestorStateOfType(TypeMatcher<_MyAppState>()); | |
state.setState(() { | |
state.locale = 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 'dart:async'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/foundation.dart' show SynchronousFuture; | |
class AppLocalizations { | |
AppLocalizations(this.locale); | |
final Locale locale; |
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
class HomeScreen extends StatefulWidget { | |
@override | |
_HomeScreenState createState() => _HomeScreenState(); | |
} | |
class _HomeScreenState extends State<HomeScreen> | |
with SingleTickerProviderStateMixin { | |
AnimationController _animationController; | |
OlderNewer