In progress
A dashboard app that displays daily entries.
- How to use an AdaptiveScaffold adaptive layout for large, medium, and small screens.
- How to use Firebase Cloud Firestore database with Google Sign-In.
- How to use charts to display data.
- (in progress) How to set up routing for a web app
This app is web-first, and isn't guaranteed to run on iOS, Android or desktop platforms.
Normal mode (DDC):
flutter run -d chrome
Skia / CanvasKit mode:
flutter run -d chrome --release --dart-define=FLUTTER_WEB_USE_SKIA=true
flutter pub run grinder generate
Go to console.firebase.google.com and create a new Firebase project.
In the Firebase console, go to "Authentication" and enable Google sign in. Click on "Web SDK Configuration" and copy down your Web client ID.
Uncomment this line in index.html and replace <YOUR WEB CLIENT ID> with the
client ID from Step 2:
<!-- Uncomment and add Firebase client ID here: -->
<!-- <meta name="google-signin-client_id" content="<YOUR WEB CLIENT ID>"> -->In the Firebase console, under "Project overview", click "Add app", select Web,
and replace the contents of web/firebase_init.js.
// web/firebase_init.js
var firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);Create a new Cloud Firestore database and add the following rules to disallow users from reading/writing other users' data:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Make sure the uid of the requesting user matches name of the user
// document. The wildcard expression {userId} makes the userId variable
// available in rules.
match /users/{userId}/{document=**} {
allow read, update, delete: if request.auth.uid == userId;
allow create: if request.auth.uid != null;
}
}
}
Run the app on port 5000:
flutter run -d chrome --web-port=5000If you see CORS errors in your browser's console, go to the Services
section in the Google Cloud console, go to Credentials, and
verify that localhost:5000 is whitelisted.
If you would like to run the app on iOS or Android, make sure you've installed the appropriate configuration files described at firebase.google.com/docs/flutter/setup from step 1, and follow the instructions detailed in the google_sign_in README