Tuesday, 2 July 2019

A Flutter implementation of Adaptive Cards

flutter tutorial,flutter,flutter tutorial for beginners,flutter app,flutter tutorials,flutter sdk,tutorial,flutter course,learn flutter,flutter tutorial ios,flutter firebase tutorial,flutter widgets,flutter app development tutorial,flutter ios,flutter dart,flutter android,google flutter,flutter sdk tutorial,flutter tutorial app,google flutter tutorial,flutter sqflite tutorial,flutter tutorial deutsch,flutter tutorial android


Adaptive Cards for Flutter

A Flutter implementation of Adaptive Cards.

Installing

Put this into your pubspec.yaml
dependencies:
  flutter_adaptive_cards:
    git:
      url: https://github.com/neohelden/Flutter-AdaptiveCards
Yml

Using

Using Adaptive Cards in Flutter coudn't be simpler: All you need is the AdaptiveCard widget.
There are several constructors which handle data loading 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.
An 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,
);
Dart

Running the tests

Simply type
flutter test
Sh
and to update the golden files run
flutter test --update-goldens test/sample_golden_test.dart
Sh
This updates the golden files for the sample cards.


GitHub

Latest commit to the master branch on 6-17-2019
Download as zip