Skip to content

AlexiCoard/flutter_feed

Repository files navigation

flutter_feed

Flutter feed generator - Generate some awesome feeds widgets using Flutter

Installing

Add this in your pubspec.yaml file

dependencies:
  flutter_feed:
    git: git://github.com/alexicoard/flutter_feed.git

Demo App

This repo includes a repo app, if you download it and launch main.dart you will run a "Demo App" with all the feeds examples in the drawer

/!\ Some Feeds require some configuration before you can run them for example the Twitter Feed require a config.yaml file (See below section)

The twitter feed

A feed to get user timeline given by its credentials

Use the available constructor to inject credentials from a config.yaml file following this pattern

twitterFeed:
  consumerKey: foo
  consumerSecret: bar
  accessToken: peanuts
  accessTokenSecret: spaghetti

And instanciate your twitter feed widget

TwitterFeedWidget()

By default, the query value is statuses/user_timeline.json, this will display your timeline (if you use your own credentials) ! So basically, the timeline of the account to which the credentials belong.

If you want, you can override this default value and display, let's say another user feed : for example Chuck Norris. To do this, simply add the named parameter like this

TwitterFeedWidget(
  query: "statuses/user_timeline.json?screen_name=chucknorris"
);

Be carefoul though, some basic credentials might not be enough to display everything.

If you only need to query the data and use you own widget / collector you can simply instantiate a TwitterFeedCollector

Twitter Feed - Overview

The Medium Feed

Based on the same structure, but a lot simpler than the Twitter one... The API doesn't provide as much details as we would like (for example all the user claps or the amount of clap for each post).

Create a MediumFeedWidget like this

MediumFeedWidget(
  query : '/users/{userHash}/publications'
);

Same as Twitter one, the collector and renderer can be created as standalone

Medium Feed - Overview

The Generic Feed

A generic feed you can customize with your own collector and renderer. With this one, you can focus on collecting and displaying your data.

To use the generic feed, you have to implement your data collector and your renderer.

The collector must extends the Abstract class AbstractCollector. The gather() method will be used to collect the data.

The renderer must extends the Abstract class AbstractRenderer. The render() method will be used to generate the feed widget.

If you want an example, have a look at the ExampleCollector and ExampleRenderer in the abstract_collector and abstract_renderer files.

Once all your collector and renderer are done, just call the GenericFeed with

GenericFeed(MyCollector(), MyRenderer())

TODO

  • More feeds : Github ?
  • Package and publish it to allow simple integration

Author

Alexi Coard (alexicoard[at]gmail.com)

Contributing

Feel free to contribute if you want to add more feeds, improve code or fix bugs !

About

Generate feed widgets in flutter ! (Twitter, Medium, Generic...)

Resources

Stars

Watchers

Forks

Packages

No packages published