twitter_cards 0.0.2 copy "twitter_cards: ^0.0.2" to clipboard
twitter_cards: ^0.0.2 copied to clipboard

Platformweb

This library provides the easiest way to integrate Twitter Cards in Flutter web apps.

twitter_cards

The Easiest Way to Integrate Twitter Cards into Your Flutter Web App 🐦


GitHub Sponsor GitHub Sponsor

pub package Dart SDK Version Test Analyzer Issues Pull Requests Stars Contributors Code size Last Commits License Contributor Covenant


1. Guide 🌎 #

This library provides the easiest way to integrate Twitter Cards into your Flutter Web app.

No HTML knowledge is required to set up Twitter Cards with this library. This library safely and flawlessly sets up Twitter Cards in your Flutter web apps without having to write HTML directly.

Show some ❤️ and star the repo to support the project.

1.1. Features 💎 #

✅ Works with Flutter Web.
No HTML knowledge required.
Settings can be changed dynamically at app runtime.
Well documented and well tested.

1.2. Getting Started ⚡ #

1.2.1. Install Library #

With Flutter:

 flutter pub add twitter_cards

Note
Twitter Cards can be applied to HTML-based web content.

1.2.2. Import #

import 'package:twitter_cards/twitter_cards';

1.2.3. Implementation #

Implementation using this library is very simple, just call the method corresponding to each Twitter Card.

For example, if you want to set up Summary Card on any page, you can write so as follows.

import 'package:twitter_cards/twitter_cards';

void main() {
  setupSummaryCard(
    title: 'Small Island Developing States Photo Submission',
    site: '@flickr',
    description: 'View the album on Flickr.',
    imageUrl: 'https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg',
  );
}

1.3. Supported Cards 👀 #

1.3.1. Summary Card #

The Summary Card can be used for many kinds of web content, from blog posts and news articles, to products and restaurants. It is designed to give the reader a preview of the content before clicking through to your website.

1.3.1.1. Method

Method
setupSummaryCard

1.3.1.2. Parameters

Parameter Required Description
title A concise title for the related content.
site The Twitter @username the card should be attributed to.
description A description that concisely summarizes the content as appropriate for presentation within a Tweet. You should not re-use the title as the description or use this field to describe the general services provided by the website.
imageUrl A URL to a unique image representing the content of the page. You should not use a generic image such as your website logo, author photo, or other image that spans multiple pages. Images for this Card support an aspect ratio of 1:1 with minimum dimensions of 144x144 or maximum of 4096x4096 pixels. Images must be less than 5MB in size. The image will be cropped to a square on all platforms. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported.
imageAlt A text description of the image conveying the essential nature of an image to users who are visually impaired. Maximum 420 characters.

1.3.1.3. Example

setupSummaryCard(
  title: 'Small Island Developing States Photo Submission',
  site: '@flickr',
  description: 'View the album on Flickr.',
  imageUrl: 'https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg',
);

1.4. Contribution 🏆 #

If you would like to contribute to twitter_cards, please create an issue or create a Pull Request.

There are many ways to contribute to the OSS. For example, the following subjects can be considered:

  • There are request parameters or response fields that are not implemented.
  • Documentation is outdated or incomplete.
  • Have a better way or idea to achieve the functionality.
  • etc...

You can see more details from resources below:

Or you can create a discussion if you like.

Feel free to join this development, diverse opinions make software better!

We also provide the following libraries related to Twitter!

Library Description Links
twitter_api_v2 The easiest way to using Twitter API v2.0 with Dart and Flutter. Strong support for all v2.0 endpoints. GitHub
Pub.dev
twitter_oauth2_pkce This is the easiest way to obtain a Twitter access token using the OAuth 2.0 PKCE method. GitHub
Pub.dev

1.6. License 🔑 #

All resources of twitter_cards is provided under the BSD-3 license.

Copyright 2022 Kato Shinya. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the conditions.

Note
License notices in the source are strictly validated based on .github/header-checker-lint.yml. Please check header-checker-lint.yml for the permitted standards.

1.7. More Information 🧐 #

twitter_cards was designed and implemented by Kato Shinya (@myConsciousness).

10
likes
140
pub points
13%
popularity

Publisher

unverified uploader

This library provides the easiest way to integrate Twitter Cards in Flutter web apps.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on twitter_cards