Code Monkey home page Code Monkey logo

sgham / tweet_ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from schibsted/tweet_ui

0.0 0.0 0.0 49.01 MB

Flutter package to display tweets from a Twitter API JSON (v1 or v2) on Android and iOS. Support for Tweets with 1-4 photos, Video, GIFs, hashtags, mentions, symbols, urls, quoted Tweets and retweets.

Home Page: https://pub.dev/packages/tweet_ui

License: MIT License

Ruby 0.96% Objective-C 0.02% Kotlin 0.09% Dart 98.67% Swift 0.26%

tweet_ui's Introduction

tweet_ui

Flutter Tweet UI - Flutter package that is inspired by twitter-kit-android. Works on iOS and Android.

Getting Started

To use this package add it to the pubspec.yaml file:

tweet_ui: <latest_version>

import it:

import 'package:tweet_ui/tweet_ui.dart';

If you want to show tweets with videos: check the better_player installation site

Video/GIF Tweets don't work on iOS simulators (video_player ios instructions)

finally, create a TweetView from a JSON:

API V1.1

TweetView.fromTweetV1(
    TweetV1Response.fromRawJson(
        jsonFromTwitterAPI
        // {"created_at": "Mon Nov 12 13:00:38 +0000 2018", "id": 1061967001177018368, ...
    )
);

API V2

TweetView.fromTweetV2(
    TweetV2Response.fromRawJson(
        jsonFromTwitterAPI
        // {"data": ["created_at": "2020-09-18T18:36:15.000Z", "id": "1061967001177018368", ...
        // or
        // {"data": {"created_at": "2020-09-18T18:36:15.000Z", "id": "1061967001177018368", ...
    )
);

or a CompactTweetView,

API V1.1

CompactTweetView.fromTweetV1(
    TweetV1Response.fromRawJson(
        jsonFromTwitterAPI
        // {"created_at": "Mon Nov 12 13:00:38 +0000 2018", "id": 1061967001177018368, ...
    )
);

API V2

CompactTweetView.fromTweetV2(
    TweetV2Response.fromRawJson(
        jsonFromTwitterAPI
        // {"data": ["created_at": "2020-09-18T18:36:15.000Z", "id": "1061967001177018368", ...
        // or
        // {"data": {"created_at": "2020-09-18T18:36:15.000Z", "id": "1061967001177018368", ...
    )
);

or a EmbeddedTweetView.

API V1.1

EmbeddedTweetView.fromTweetV1(
    TweetV1Response.fromRawJson(
        jsonFromTwitterAPI
        // {"created_at": "Mon Nov 12 13:00:38 +0000 2018", "id": 1061967001177018368, ...
    )
  darkMode: true,
)

API V2

EmbeddedTweetView.fromTweetV2(
    TweetV2Response.fromRawJson(
      jsonFromTwitterAPI
      // {"data": ["created_at": "2020-09-18T18:36:15.000Z", "id": "1061967001177018368", ...
      // or
      // {"data": {"created_at": "2020-09-18T18:36:15.000Z", "id": "1061967001177018368", ...
    )
    darkMode: true,
)

There is also a special QuoteTweetView that is embedded in a TweetView or a CompactTweetView or a EmbeddedTweetView. This depends if a Tweet has a quoted_status value in the JSON.

What tweet view should I create?

TweetView and CompactTweetView are more customisable, but EmbeddedTweetView looks more modern. Check the screenshots below.

Twitter API V2 know problems

In current version of twitter API (V2 as of 14.02.2022) it is not possible to get video url in tweet response. See the following links for more info:

All other video fields (like size or duration) are available in the response. This means that videos will not work for now.

Need more information? Check our wiki pages!

Colors & styling

Custom callbacks

Custom date format

Video player options

Example of supported view and media types:

Standard tweet views

Media type TweetView CompactTweetView EmbeddedTweetView
1 photo img img img
2 photos img img img
3 photos img img img
4 photos img img img
video img img img
GIF img img img

Quoted tweet views

Media type TweetView CompactTweetView EmbeddedTweetView
1 photo img img img
2 photos img img img
3 photos img img img
4 photos img img img
video img img img
GIF img img img

Sample tweets use real-life tweet ids but for example purposes, their content was changed.


tweet_ui's People

Contributors

wszeborowskimateusz avatar nicktt19 avatar kawa89 avatar robertmrobo avatar ercadev avatar ndahlquist avatar erickok avatar ivanjpg avatar jamesblasco avatar dasmikko avatar escamoteur avatar tristan-vrt avatar

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.