Skip to content

Instantly share code, notes, and snippets.

View xsahil03x's full-sized avatar
🤹‍♂️
Working on something awesome

Sahil Kumar xsahil03x

🤹‍♂️
Working on something awesome
View GitHub Profile
Widget makeCollectionItem(Collection collection) => Container(
margin: EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Container(
width: 200.0,
height: 200.0,
child: Image.network(
collection.collectionImageURL,
fit: BoxFit.cover,
Widget makeCollectionList(JweleryKartBloc bloc) => Container(
height: 300.0,
child: Card(
margin: EdgeInsets.all(0.0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero),
child: Column(
children: <Widget>[
Text("Collections"),
StreamBuilder(
stream: bloc.menCollections,
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@xsahil03x
xsahil03x / pubspec.yaml
Last active March 24, 2019 19:32
Flutter Firebase : Phone Authentication
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.8.2
@override
void dispose() {
_numberController?.dispose();
_otpController?.dispose();
super.dispose();
}
class FlutterPhoneAuth extends StatefulWidget {
@override
_FlutterPhoneAuthState createState() => _FlutterPhoneAuthState();
}
class _FlutterPhoneAuthState extends State<FlutterPhoneAuth> {
String _phoneNo;
String _verificationId;
final FirebaseAuth _auth = FirebaseAuth.instance;
Future<void> _onRegisterButtonClick() async {
showProgressBar(context, "Requesting OTP...");
this._phoneNo = _countryCode + _numberController.text;
final PhoneVerificationCompleted verificationCompleted =
(FirebaseUser user) {
_navigateToHome();
};
final PhoneVerificationFailed verificationFailed =
Future<void> _onVerifyButtonClick() async {
showProgressBar(context, "Verifying OTP, Please Wait!");
String otp = _otpController.text.trim();
final AuthCredential credential = PhoneAuthProvider.getCredential(
verificationId: _verificationId,
smsCode: otp,
);
await _auth.signInWithCredential(credential).then((user) {