All Projects → neohelden → Flutter Adaptivecards

neohelden / Flutter Adaptivecards

Licence: mit
AdaptiveCards for Flutter 🐦

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Flutter Adaptivecards

Flutter plugin pdf viewer
A flutter plugin for handling PDF files. Works on both Android & iOS
Stars: ✭ 81 (-30.77%)
Mutual labels:  flutter-plugin
Amap location fluttify
高德地图 定位组件 Flutter插件
Stars: ✭ 97 (-17.09%)
Mutual labels:  flutter-plugin
Nav router
flutter The lightest, easiest and most convenient route management!
Stars: ✭ 101 (-13.68%)
Mutual labels:  flutter-plugin
In app review
A Flutter plugin for showing the In-App Review/System Rating pop up on Android, IOS, and MacOS. It makes it easy for users to rate your app.
Stars: ✭ 85 (-27.35%)
Mutual labels:  flutter-plugin
Svg Cards
A set of playing cards in SVG (now also with a rendering in PNG)
Stars: ✭ 94 (-19.66%)
Mutual labels:  cards
Launch review
A Flutter plugin to assist in leaving user reviews/ratings in the Google Play Store. Supports both Android and iOS.
Stars: ✭ 98 (-16.24%)
Mutual labels:  flutter-plugin
Firebase dart sdk
Unofficial Firebase Flutter SDK. Maintainer: @long1eu
Stars: ✭ 80 (-31.62%)
Mutual labels:  flutter-plugin
Super enum
Create super-powered dart enums similar to sealed classes in Kotlin
Stars: ✭ 114 (-2.56%)
Mutual labels:  flutter-plugin
Octo image
A multifunctional Flutter image widget
Stars: ✭ 97 (-17.09%)
Mutual labels:  flutter-plugin
Contacts
A flutter project with Implementation of a Contacts app in 4 ways (API, Custom, Preferences and Sqflite).
Stars: ✭ 100 (-14.53%)
Mutual labels:  cards
Flutter inappwebview
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
Stars: ✭ 1,259 (+976.07%)
Mutual labels:  flutter-plugin
Foda
You are at FODA source code. Play now for free
Stars: ✭ 92 (-21.37%)
Mutual labels:  cards
Painter
A simple flutter widget to paint with your fingers
Stars: ✭ 99 (-15.38%)
Mutual labels:  flutter-plugin
Json to form
A flutter plugin to use convert Json to Form
Stars: ✭ 82 (-29.91%)
Mutual labels:  flutter-plugin
Flutter local notifications
A Flutter plugin for displaying local notifications on Android, iOS, macOS and Linux
Stars: ✭ 1,724 (+1373.5%)
Mutual labels:  flutter-plugin
Flutter web auth
Flutter plugin for authenticating a user with a web service
Stars: ✭ 81 (-30.77%)
Mutual labels:  flutter-plugin
Flutter Apps Collection
This is a repository of a collection of apps made in flutter
Stars: ✭ 98 (-16.24%)
Mutual labels:  flutter-plugin
Edge detection
This is a flutter plugin to detect edges in a live camera, take the picture of detected edges object, crop it, and save.
Stars: ✭ 116 (-0.85%)
Mutual labels:  flutter-plugin
Drawer Behavior Flutter
Drawer behavior is a library that provide an extra behavior on drawer, such as, move view or scaling view's height while drawer on slide.
Stars: ✭ 110 (-5.98%)
Mutual labels:  flutter-plugin
Screenshot
Flutter Screenshot Library
Stars: ✭ 100 (-14.53%)
Mutual labels:  flutter-plugin

AdaptiveCards for Flutter

Adaptive Cards for Flutter

We decided to build a Flutter implementation of Adaptive Cards because we believe in the future of both technologies. With Flutter, we found an exciting framework for ultra-fast and cross-platform UI development. And with Adaptive Cards, we can combine that with an industry standard for exchanging card content in a structured way. At Neohelden, we're building on both of these technologies with our AI-assistant for business – and you can learn more about why we built this in our blog-post on the release of our Adaptive Cards in Flutter library.

Installing

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_adaptive_cards: ^0.1.2
import 'package:flutter_adaptive_cards/flutter_adaptive_cards.dart';

Using

Using Adaptive Cards in Flutter coudn't be simpler: All you need is the AdaptiveCard widget.

⚠️ Markdown support vs. ColumnSet content alignment

Due to issue #171 of the Flutter Markdown package, the flag supportMarkdown was introduced to all Adaptive Card contractors. The default value of this property is true, to stay compatible with older versions of this package, which didn't support content alignment in ColumnSets. If the value is set to false the content alignment in ColumnSets is working accordingly, but every TextBlock is displayed without Markdown rendering. As soon if the issue is resolved this flag will be removed.

Loading an AdaptiveCard

There are several constructors which handle loading of the AC from different sources. AdaptiveCard.network takes a url to download the payload and display it. AdaptiveCard.asset takes an asset path to load the payload from the local data. AdaptiveCard.memory takes a map (which can be obtained but decoding a string using the json class) and displays it.

HostConfig

The HostConfig can be configured via two parameters of every constructor:

  1. The parameter hostConfigPath takes a static HostConfig which can be stored as a local asset. In this case, the HostConfig has to be added to the pubspec.yaml of the project.
  2. The parameter hostConfig takes a dynamic HostConfig as a String. This can easily be programmaticly and can e.g. be used for switching between a light and a dark theme.

If both parameters are set the hostConfigparameter will be used.

Example

AdaptiveCard.network(
  placeholder: Text("Loading, please wait"),
  url: "www.someUrlThatPoints.To/A.json",
  hostConfigPath: "assets/host_config.json",
  onSubmit: (map) {
    // Send to server or handle locally
  },
  onOpenUrl: (url) {
    // Open url using the browser or handle differently
  },
  // If this is set, a button will appear next to each adaptive card which when clicked shows the payload.
  // NOTE: this will only be shown in debug mode, this attribute does change nothing for realease builds.
  // This is very useful for debugging purposes
  showDebugJson: true,
  // If you have not implemented explicit dark theme, Adaptive Cards will try to approximate its colors to match the dark theme
  // so the contrast and color meaning stays the same.
  // Turn this off, if you want to have full control over the colors when using the dark theme.
  // NOTE: This is currently still under development
  approximateDarkThemeColors: true,
);

Example App

We try to show every possible configuration parameter supported by the AdaptiveCards components in the example app of this repository. If we missed any, please feel free to open an issue.

Running the tests

flutter test

and to update the golden files run

flutter test --update-goldens test/sample_golden_test.dart

This updates the golden files for the sample cards. Depending on your operating system you might have issues with the font rendering. For the CI / CD setup you need to generate the golden files using a Docker container:

# run the following command in the root folder of this project
docker run -it -v `pwd`:/app cirrusci/flutter:dev bash

# and inside the container execute
cd /app
flutter test --update-goldens

# afterwards commit the freshly generated sample files (after checking them)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Norbert Kozsir (@Norbert515) – Initial work, Former Head of Flutter development at Neohelden GmbH
  • Pascal Stech (@Curvel) – Maintainer, Flutter Developer at Neohelden GmbH (NeoSEALs team)
  • Maik Hummel (@Beevelop) – Maintainer, CTO at Neohelden GmbH (Daddy of the NeoSEALs team)

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].