Friday, 30 August 2019

A flutter OAuth package for Slack with Firebase Authentication integration

flutter_slack_oauth_firebase
  • Extension for our flutter_slack_oauth library which adds support for Firebase Authentication and Cloud Firestore.

    Usage

    • To use this plugin, add flutter_slack_oauth_firebase as a dependency in your pubspec.yaml file.
  • This package depends on Firebase Auth, so be sure to follow those steps. Unlike the documentation for that package, the Google Sign-in plugin for Firebase Auth is NOTrequired!
  • Deploy the Firebase Functions project in the firebase folder, which is the "backend" logic that will handle the OAuth flow. You can follow the steps as specified in the Instagram Oauth Firebase Functions sample.

After succesful login

  • The resulting access token for Slack is stored in Firebase Firestore in the slackAccessToken collection under a document with the Slack UID as document id.
  • User info returned from the Slack login is stored in Firebase Firestore in the userscollection under a document with the Slack UID as document id.
  • You can easily find the Slack UID for the current user after login:
FirebaseUser user = await _auth.currentUser();
print(user.uid);

Dart

Full Example

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slack_oauth_firebase/flutter_slack_oauth_firebase.dart';

void main() {
  final FirebaseAuth _auth = FirebaseAuth.instance;

  runApp(new MaterialApp(
    home: new Scaffold(
      appBar: new AppBar(
        title: new Text("Slack OAuth Example"),
      ),
      body: new Builder(
        builder: (BuildContext context) {
          return new Center(
            child: new FirebaseSlackButton(
              clientId: "XXX_CLIENT_ID_XXX",
              clientSecret: "XXX_CLIENT_SECRET_XXX",
              redirectUrl:
              "https://XXX-FIREBASE-PROJECT-XXX.firebaseapp.com/completed.html",
              firebaseUrl:
              "https://XXX-FIREBASE-PROJECT-XXX.firebaseapp.com/index.html",
              onSuccess: () async {
                // get Firebase User:
                FirebaseUser user = await _auth.currentUser();

                Scaffold.of(context).showSnackBar(new SnackBar(
                  content: new Text('Logged in with Slack ID ' + user.uid),
                ));
              },
              onFailure: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Slack Login Failed'),
                    ));
              },
              onCancelledByUser: () {
                Scaffold.of(context).showSnackBar(new SnackBar(
                      content: new Text('Slack Login Cancelled by user'),
                    ));
              },
            ),
          );
        },
      ),
    ),
  ));
}

Dart

GitHub

A flutter OAuth package for Slack with Firebase Authentication integration. — Read More
Latest commit to the master branch on 8-21-2019
Download as zip

Wednesday, 21 August 2019

Social Network with Flutter and Firebase


Flutter Social

Complete mobile social media app like Twitter, Instagram or Facebook ! Using Flutter and FireStore.


GitHub

Social Network with Flutter and Firebase — Read More
Latest commit to the master branch on 8-21-2019
Download as zip

A library to draw fantastic charts in Flutter


FL Chart

A powerful Flutter chart library, currently supporting Line Chart, Bar Chart and Pie Chart.

Chart Types

LINECHARTBARCHARTPIECHART
Read MoreRead MoreRead More

Let's get started

1 - Depend on it

Add it to your package's pubspec.yaml file
dependencies:
  fl_chart: ^0.2.0
Kotlin

2 - Install it

Install packages from the command line
flutter packages get
Kotlin

3 - Learn it like a charm

Read the docs from here

4 - Follow the roadmap

you can follow the roadmap from here, and (let me know your suggestions)

GitHub

A powerful Flutter chart library, currently supporting Line Chart, Bar Chart and Pie Chart. — Read More
Latest commit to the master branch on 8-20-2019
Download as zip

A flutter calendar package to allow users to scroll through given dates either


scrolling_day_calendar

A flutter calendar package to allow users to scroll through given dates either by swiping left and right or pressing the arrows. The active date is displayed as a heading and the tasks for that date are displayed underneath. This package can be used on Android and IOS

How it works

  • Pass in the widgets method
    You simply need to pass in a start date, an end date, the active date and widgets to display per day.
  • SetState method
    You simply need to pass in a start date, an end date, the active date and a call-back function,
    the package will then allow the user to swipe between the dates using PageView,
    on each page change the call-back you have set will be called to allow you to update the page content for the given date.

Screenshots



Usage

To use the plugin:
dependencies:
  flutter:
    sdk: flutter

  scrolling_day_calendar: 2.0.1

YAML
  • import the package
import 'package:scrolling_day_calendar/scrolling_day_calendar.dart';

Dart

How to use the Widget pass-in method - recommended for better experience

DateTime selectedDate = DateTime.now();
DateTime startDate = DateTime.now().subtract(Duration(days: 10));
DateTime endDate = DateTime.now().add(Duration(days: 10));
Map<String, Widget> widgets = Map();
String widgetKeyFormat = "yyyy-MM-dd";

body: ScrollingDayCalendar(
          startDate: startDate,
          endDate: endDate,
          selectedDate: selectedDate,
          dateStyle: TextStyle(
            fontWeight: FontWeight.bold,
            color: Colors.white,
          ),
          displayDateFormat: "dd, MMM yyyy",
          dateBackgroundColor: Colors.grey,
          forwardIcon: Icons.arrow_forward,
          backwardIcon: Icons.arrow_back,
          pageChangeDuration: Duration(
            milliseconds: 700,
          ),
          widgets: widgets,
          widgetKeyFormat: widgetKeyFormat,
          noItemsWidget: Center(
            child: Text("No items have been added for this date"), // add buttons etc here to add new items for date
          ),
        ),
Dart

How to use the SetState method

// set the initial page value
Widget _pageItems = Text("Inital value");
DateTime selectedDate = DateTime.now();
DateTime startDate = DateTime.now().subtract(Duration(days: 10));
DateTime endDate = DateTime.now().add(Duration(days: 10));
String widgetKeyFormat = "yyyy-MM-dd";

// add to body of a Scaffold
body: ScrollingDayCalendar(
          startDate: startDate,
          endDate: endDate,
          selectedDate: selectedDate,
          onDateChange: (direction, DateTime selectedDate) {
            setState(() {
              pageItems = _widgetBuilder(selectedDate);
            });
          },
          dateStyle: TextStyle(
            fontWeight: FontWeight.bold,
            color: Colors.white,
          ),
          pageItems: pageItems,
          displayDateFormat: "dd/MM/yyyy",
          dateBackgroundColor: Colors.grey,
          forwardIcon: Icons.arrow_forward,
          backwardIcon: Icons.arrow_back,
          pageChangeDuration: Duration(
            milliseconds: 400,
          ),
          noItemsWidget: Center(
            child: Text("No items have been added for this date"), // add buttons etc here to add new items for date
          ),
        ),
Dart

GitHub

Flutter package to create a day date scroller — Read More
Latest commit to the master branch on 8-20-2019
Download as zip