Code Monkey home page Code Monkey logo

travel_treasury's Introduction

Travel Treasury

Download The Live App

alt text

This repository contains all the code written throughout the 1ManStartup YouTube tutorials for building a travel budget app using Flutter

View the channel on YouTube

How To Use This Resource

Each episode where code is created or modified will have an associated branch in this repo. The code in each episode's branch will contain the completed code from that episode and the branch will remain in that state.

The master branch will contain the most recent version of code, and be considered the "production" version. This means the master branch will always be the most up to date.

Any questions should be asked in the comments of the relevant video on YouTube.

Setup Firebase Database

After Episode 15 you will need to configure your own Firebase project. Most importantly you will need to generate and include your own google-services.json file for Android and GoogleServices-Info.plist file for iOS. Full instructions on how to configure Firebase for this project can be found in Episode 15 on YouTube

travel_treasury's People

Contributors

davefaliskie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

travel_treasury's Issues

Error with code.

The code for the app is too old, not updated with the latest flutter version and plugins. After updating there is too many errors. Please fix it.

Apple signin Issue

Hello, have been following your apple sign in config tutorial on youtube for my flutter app, all doe the config does invoke apple sign in IdCredentials, am not getting any data and more over, it doesn't navigator to the next page as it supposed to. Below the code

Future<void> _ensureLoggedIn(BuildContext context) async {
  print('[_ensureLoggedIn] START');

  GoogleSignInAccount user = googleSignIn.currentUser;
  if (user == null) {
    print('[_ensureLoggedIn] user == null');
    print('[_ensureLoggedIn] [signInSilently] START');
    user = await googleSignIn.signInSilently();
    print('[_ensureLoggedIn] [signInSilently] DONE');
  }

  if (user == null) {
    print('[_ensureLoggedIn] user == null');
    print('[_ensureLoggedIn] [signIn] START');
    await googleSignIn.signIn().then((_) {
      tryCreateUserRecord(context);
    });
    print('[_ensureLoggedIn] [signIn] DONE');
  }

  if (await auth.currentUser() == null) {

    print('[_ensureLoggedIn] auth.currentUser() == null');
    print('[_ensureLoggedIn] [googleSignIn.currentUser.authentication] START');


    GoogleSignInAuthentication credentials = await googleSignIn.currentUser.authentication;
    final GoogleSignInAccount googleUser = await googleSignIn.signIn();
    final GoogleSignInAuthentication googleAuth = await googleUser.authentication;

print('[_ensureLoggedIn] [googleSignIn.currentUser.authentication] DONE');
    print('[_ensureLoggedIn] [signInWithGoogle] START');
  final AuthCredential credential = GoogleAuthProvider.getCredential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );
 return(await auth.signInWithCredential(credential)).user.uid;
  }
print('[_ensureLoggedIn] DONE');
}
Future<void> _silentLogin(BuildContext context) async {
  GoogleSignInAccount user = googleSignIn.currentUser;
if (user == null) {
    user = await googleSignIn.signInSilently();
    await tryCreateUserRecord(context);
  }
 if (await auth.currentUser() == null && user != null) {
    final GoogleSignInAccount googleUser = await googleSignIn.signIn();
    final GoogleSignInAuthentication googleAuth = await googleUser
        .authentication;
   final AuthCredential credential = GoogleAuthProvider.getCredential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );
    await auth.signInWithCredential(credential);
  }
}

// APPLE
Future<void> signInWithApple(BuildContext context) async {
  final AuthorizationResult result = await AppleSignIn.performRequests([
    AppleIdRequest(requestedScopes: [Scope.email, Scope.fullName])
  ]);
switch (result.status) {
    case AuthorizationStatus.authorized:
 // Store user ID
      await FlutterSecureStorage()
          .write(key: "userId", value: result.credential.user);
       final AppleIdCredential _auth = result.credential;
      final OAuthProvider oAuthProvider = new OAuthProvider(providerId: "apple.com");
     final AuthCredential credential = oAuthProvider.getCredential(
        idToken: String.fromCharCodes(_auth.identityToken),
        accessToken: String.fromCharCodes(_auth.authorizationCode),
      );
 await auth.signInWithCredential(credential);
// update the user information
      if (_auth.fullName != null) {
        auth.currentUser().then( (value) async {
          UserUpdateInfo user = UserUpdateInfo();
          user.displayName = "${_auth.fullName.givenName} ${_auth.fullName.familyName}";
          await value.updateProfile(user);
        });
      }

      break;
 case AuthorizationStatus.error:
      print("Sign In Failed ${result.error.localizedDescription}");
      break;
case AuthorizationStatus.cancelled:
      print("User Cancelled");
      break;
  }
}
tryCreateUserRecord(BuildContext context) async {
  GoogleSignInAccount user = googleSignIn.currentUser;
  if (user == null) {
    return null;
  }
  DocumentSnapshot userRecord = await ref.document(user.id).get();
  if (userRecord.data == null) {
    // no user record exists, time to create
 String userName = await Navigator.push( context,
      // We'll create the SelectionScreen in the next step!
      MaterialPageRoute(
          builder: (context) => Center(
                child: Scaffold(
                    appBar: AppBar(
                      leading: Container(),
                      title: Text('Fill out missing data',
                          style: TextStyle(
                              color: Colors.black,
                              fontWeight: FontWeight.bold)),
                      backgroundColor: Colors.white,
                    ),
                    body: ListView(
                      children: <Widget>[
                         Container(
                          child: CreateAccount(),
                        ),
                      ],
                    )),
              )),
 );
 if (userName != null || userName.length != 0){
      ref.document(user.id).setData({
        "id": user.id,
        "username": userName,
        "photoUrl": user.photoUrl,
        "email": user.email,
        "displayName": user.displayName,
      });
    }
  }
 currentUserModel = User.fromDocument(userRecord);
}
 and separate container for 
AppleSignInButton(
               type: ButtonType.signIn,
                cornerRadius: 6.0,
                 onPressed: () async {
                await signInWithApple( context );
                Navigator.push (context ,MaterialPageRoute(
                    builder: (_) =>
                        HomePage()));
              },

Please am on a roadblock now, any help or any light something on the codes would be appreciated.
Thanks

Error on ButtonStyle AppleSignInButton

Im getting error on sign_up_view here is the log

lib/views/sign_up_view.dart:463:16: Error: 'ButtonStyle' is imported from both 'package:apple_sign_in/apple_sign_in_button.dart' and 'package:flutter/src/material/button_style.dart'.
        style: ButtonStyle.black,
               ^^^^^^^^^^^
lib/views/sign_up_view.dart:458:14: Error: 'AppleSignInButton' is imported from both 'package:apple_sign_in/apple_sign_in_button.dart' and 'package:flutter_auth_buttons/src/apple.dart'.
      return AppleSignInButton(
             ^^^^^^^^^^^^^^^^^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.