This file contains hidden or 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; |
This file contains hidden or 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
{ | |
"tab_home": "Home", | |
"tab_categories": "Categories", | |
"tab_profile": "Profile", | |
"tab_notifications": "Notifications", | |
"tab_bag": "Bag", | |
"title_select_language": "Select Language" | |
} |
This file contains hidden or 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
actions: <Widget>[ | |
IconButton( | |
icon: Icon( | |
Icons.settings, | |
color: Colors.black, | |
), | |
onPressed: () { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (context) { |
This file contains hidden or 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'; | |
class LanguageSelectorPage extends StatefulWidget { | |
@override | |
_LanguageSelectorPageState createState() => _LanguageSelectorPageState(); | |
} | |
class _LanguageSelectorPageState extends State<LanguageSelectorPage> { | |
final List<String> languagesList = ["English", "Spanish"]; |
This file contains hidden or 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
Container( | |
height: 200.0, | |
width: 200.0, | |
decoration: BoxDecoration( | |
shape: BoxShape.circle, | |
image: DecorationImage( | |
fit: BoxFit.fill, | |
image: NetworkImage( | |
profileData['picture']['data']['url'], | |
), |
This file contains hidden or 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
case FacebookLoginStatus.loggedIn: | |
print("LoggedIn"); | |
var graphResponse = await http.get( | |
'https://graph.facebook.com/v2.12/me?fields=name,first_name,last_name,email&access_token=${facebookLoginResult | |
.accessToken.token}'); | |
var profile = json.decode(graphResponse.body); | |
print(profile.toString()); | |
This file contains hidden or 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
bool isLoggedIn = false; | |
void onLoginStatusChanged(bool isLoggedIn) { | |
setState(() { | |
this.isLoggedIn = isLoggedIn; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { |
This file contains hidden or 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 initiateFacebookLogin() async { | |
var facebookLogin = FacebookLogin(); | |
var facebookLoginResult = | |
await facebookLogin.logInWithReadPermissions(['email']); | |
switch (facebookLoginResult.status) { | |
case FacebookLoginStatus.error: | |
print("Error"); | |
onLoginStatusChanged(false); | |
break; | |
case FacebookLoginStatus.cancelledByUser: |
This file contains hidden or 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_facebook_login/flutter_facebook_login.dart'; |
This file contains hidden or 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
Future parseProductsFromResponse(int categoryId, int pageIndex) async { | |
if (pageIndex == 1) { | |
_isLoading = true; | |
} | |
notifyListeners(); | |
currentProductCount = 0; | |
var dataFromResponse = await _getProductsByCategory(categoryId, pageIndex); |