Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

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

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,
);

running the tests

simply type

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.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.