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:google_maps_flutter/google_maps_flutter.dart'; | |
import 'package:http/http.dart' as http; | |
import 'dart:convert'; | |
const apiKey = "AIzaSyBhDflq5iJrXIcKpeq0IzLQPQpOboX91lY"; | |
class GoogleMapsServices{ | |
Future<String> getRouteCoordinates(LatLng l1, LatLng l2)async{ | |
String url = "https://maps.googleapis.com/maps/api/directions/json?origin=${l1.latitude},${l1.longitude}&destination=${l2.latitude},${l2.longitude}&key=$apiKey"; | |
http.Response response = await http.get(url); | |
Map values = jsonDecode(response.body); |
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
Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Image.asset( | |
'assets/main_page.jpg', | |
height: MediaQuery.of(context).size.height * 0.4, | |
width: MediaQuery.of(context).size.width * 0.4, | |
), | |
Row( |
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 facebookLogin() async { | |
final FacebookLoginResult result = | |
await facebookSignIn.logInWithReadPermissions(['email']); | |
switch (result.status) { | |
case FacebookLoginStatus.loggedIn: | |
final FacebookAccessToken accessToken = result.accessToken; | |
break; | |
case FacebookLoginStatus.cancelledByUser: | |
break; | |
case FacebookLoginStatus.error: |
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
showMyData(){ | |
Column( | |
children: <Widget>[ | |
Text(“Logged in as: ${myFacebookData[‘name’]}”), | |
Container( | |
height: 200.0, | |
width: 200.0, | |
decoration: BoxDecoration( | |
shape: BoxShape.circle, |
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'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp(title: 'Flutter Animated Popup', theme: ThemeData(), home: _myApp()); | |
} | |
} |
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: | |
final FacebookAccessToken accessToken = result.accessToken; | |
var response = await http.get( | |
'https://graph.facebook.com/v2.12/me?fields=name,first_name,last_name,email,picture&access_token=${result.accessToken.token}'); | |
var responseData = json.decode(response.body); | |
insertData(responseData['name'],responseData['email'],responseData['picture']['data']['url'],responseData['id'],"Facebook"); | |
break; |
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 insertData(var username, var useremail, var userimage, var userauth, | |
var usersource) async { | |
var url = "YOUR_INSERT_DATA_API"; | |
final response = await http.post(url, body: { | |
"username": username, | |
"useremail": useremail, | |
"userimage": userimage, | |
"userauth": userauth, | |
"usersource": usersource | |
}); |
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 _twitterLogin() async { | |
String newMessage; | |
final TwitterLoginResult result = await twitterLogin.authorize(); | |
switch (result.status) { | |
case TwitterLoginStatus.loggedIn: | |
newMessage = 'Logged in! username: ${result.session.username}'; | |
break; | |
case TwitterLoginStatus.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
Future googleLogin() async { | |
final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); | |
final GoogleSignInAuthentication googleSignInAuthentication = | |
await googleSignInAccount.authentication; | |
final AuthCredential credential = GoogleAuthProvider.getCredential( | |
accessToken: googleSignInAuthentication.accessToken, | |
idToken: googleSignInAuthentication.idToken, | |
); |
OlderNewer