Skip to content

Instantly share code, notes, and snippets.

View sirateek's full-sized avatar
👋

Siratee K. sirateek

👋
View GitHub Profile
final GoogleSignIn googleSignIn = GoogleSignIn();
final FirebaseAuth _auth = FirebaseAuth.instance;
Future<FirebaseUser> signInWithGoogle() async {
final GoogleSignInAccount googleUser = await googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth = await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
idToken: googleAuth.idToken, accessToken: googleAuth.accessToken);
AuthResult authResult = await _auth.signInWithCredential(credential);
{
"type": "flex",
"altText": "Hello",
"contents": {
"type": "bubble",
"hero": {
"type": "image",
"url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/01_1_cafe.png",
"size": "full",
"aspectRatio": "20:13",
Future<bool> signInWithEmail(BuildContext context,
{@required String email, @required String password}) {
return _auth
.signInWithEmailAndPassword(email: email, password: password)
.then((result) {
print("Welcome " + result.user.uid);
Navigator.pop(context);
Navigator.pushReplacement(
context,
MaterialPageRoute(
Future<bool> registerWithEmail(
{@required email, @required password, @required repassword}) {
final FirebaseAuth _auth = FirebaseAuth.instance;
return _auth
.createUserWithEmailAndPassword(email: email, password: password)
.then((data) {
print("Registation Success");
print(data.user.uid);
return true;
}).catchError((e) {
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function welcome(agent) {
agent.add(`Welcome to my agent!`);
}
function fallback(agent) {
String pddescription = "Please wait...";
@override
void initState() {
super.initState();
Firestore.instance.collection("catalog").document(widget.pdname).get().then((value) {
setState(() {
pddescription = value.data["description"];
});
});
{
"line": {
"type": "flex",
"altText": "LIFF",
"contents": {
"type": "carousel",
"contents": [
{
"type": "bubble",
"hero": {
StreamBuilder(
stream: Firestore.instance.collection("catalog").snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: Column(
children: <Widget>[
CircularProgressIndicator(),
Text("Loading . . . "),
],
{
"type": "bubble",
"size": "giga",
"header": {
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "box",
"layout": "vertical",
{
"type": "bubble",
"size": "giga",
"header": {
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "image",
"url": "https://www.shareicon.net/data/128x128/2016/09/02/824400_airport_512x512.png",