Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'login_screen.dart';
import '../services/auth.dart';
class ProfileScreen extends StatefulWidget {
const ProfileScreen({Key? key}) : super(key: key);
@override
import 'package:firebase_setup/screens/register_screen.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../profile/profile_screen.dart';
import '../services/auth.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({Key? key}) : super(key: key);
//1
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../profile/profile_screen.dart';
import '../services/auth.dart';
class RegisterScreen extends StatefulWidget {
const RegisterScreen({Key? key}) : super(key: key);
class User {
final String uid;
final String? email;
User(this.uid, this.email);
}
import 'package:firebase_auth/firebase_auth.dart' as auth;
import '../model/user_model.dart';
class Auth {
//1
final auth.FirebaseAuth _firebaseAuth = auth.FirebaseAuth.instance;
//2
User? _firebaseUser(auth.User? user) {
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(const MyApp());
}
@chummypixels
chummypixels / source.js
Created November 27, 2019 11:37
Complete source code for the demonstration of SectionList use i React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
@chummypixels
chummypixels / styles.js
Created November 27, 2019 11:13
Styling of the SectionList component example
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 22,
},
sectionHeader: {
paddingTop: 2,
paddingBottom: 2,
paddingLeft: 10,
paddingRight: 10,
@chummypixels
chummypixels / renderSectionHeader.js
Last active August 23, 2023 08:50
renderSectionHeader in React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
@chummypixels
chummypixels / renderItem.js
Created November 27, 2019 10:44
renderItem prop required by SectionList component
renderItem={({item}) => <Text style={styles.item}>{item}</Text>}