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
Future<void> _onRegisterButtonClick() async {
showProgressBar(context, "Requesting OTP...");
this._phoneNo = _countryCode + _numberController.text;
final PhoneVerificationCompleted verificationCompleted =
(FirebaseUser user) {
_navigateToHome();
};
final PhoneVerificationFailed verificationFailed =
final FirebaseAuth _auth = FirebaseAuth.instance;
class FlutterPhoneAuth extends StatefulWidget {
@override
_FlutterPhoneAuthState createState() => _FlutterPhoneAuthState();
}
class _FlutterPhoneAuthState extends State<FlutterPhoneAuth> {
String _phoneNo;
String _verificationId;
@override
void dispose() {
_numberController?.dispose();
_otpController?.dispose();
super.dispose();
}
@xsahil03x
xsahil03x / pubspec.yaml
Last active March 24, 2019 19:32
Flutter Firebase : Phone Authentication
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.8.2
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> {
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,
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 makeItemList(JweleryKartBloc bloc) => StreamBuilder(
stream: bloc.menOffers,
builder: (BuildContext context, AsyncSnapshot<List<OfferBrief>> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
return GridView.builder(
shrinkWrap: true,