flutter_fb_news

Flutter plugin for displaying Facebook page feed with photos and videos

platform pub donate

Getting Started

You should ensure that you add the flutter_fb_news as a dependency in your flutter project.

dependencies:
  flutter_fb_news: '^1.1.3-dev.2'

You should then run flutter packages get in your terminal so as to get the package.

Using

import 'package:flutter_fb_news/flutter_fb_news.dart';

Center(
    child: FbNews(
        accesToken:"xyz",
        pageId: "123567890",
        limit: 25,
        config: FbNewsConfig(
            subtitle = "from Facebook",
            waiting: Column(
                children: [
                    CircularProgressIndicator(),
                    SizedBox(
                        height: 10,
                    )
                ],
            ),
            noDataOrError: Card(
                color: Colors.red,
                child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                        Text(
                            snapshot.error.toString(),
                            style: TextStyle(
                                color: Colors.white,
                            ),
                        )
                    ],
                ),
            ),
            fields: [
                FbNewsFields.header,
                FbNewsFields.attachmentsPhotos,
                FbNewsFields.attachmentsVideos,
                FbNewsFields.message,
                FbNewsFields.footer,
            ],
            borderColor: Colors.black,
            showBorder = true,
            backgroundColor: Colors.white,
            textColor: Colors.black,
            linkColor: Colors.blue,
        ),
    ),
),

Demo

Demo

Parameters

ParameterTypeRequiredDescription
pageIdStringyesis required to identify the Facebook page, for example (253146702201895)
accesTokenStringyesis required to authorize for the Facebook Api Docu to get the authToken https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens
limitintnoLimits the number of elements that are loaded Default: 20
configFbNewsConfignoCustomize the appearance of the posts

FbNewsConfig Params

ParameterTypeRequiredDescription
subtitleStringnoSubtitle in the every feeditem Default: "von Facebook"
waitingWidgetnoThe waiting widget is displayed when the data is loaded
noDataOrErrorWidgetnoThe noDataOrErrorwidget is displayed if the response contains no data or an error
fieldsListnoSelect which fields to display
borderColorColornoSet the Color of the border
showBorderBooleannoToogle the display of the border
backgroundColorColornoSet the Color of the background
textColorColornoSet the Color of the text
linkColorColornoSet the Color of a link

FbNewsFieldName

The possible filds are

  • FbNewsFields.header
  • FbNewsFields.attachmentsPhotos
  • FbNewsFields.attachmentsVideos
  • FbNewsFields.message
  • FbNewsFields.footer

Libraries

fb_news_attachments_photo
fb_news_attachments_photos
fb_news_attachments_video
fb_news_attachments_videos
fb_news_feed
fb_news_header
fb_news_message
fb_news_service
flutter_fb_news
flutter_fb_news_config