flutter_adaptive_cards 0.0.1

AdaptiveCards for Flutter

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.

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, Head of Flutter development @Neohelden

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

About this project #

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.

License #

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

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

example/README.md

example #

Example of Adaptive Cards.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_adaptive_cards: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_adaptive_cards/flutter_adaptive_cards.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

We analyzed this package on Sep 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/elements/input.dart. (-1 points)

Analysis of lib/src/elements/input.dart reported 2 hints:

line 3 col 8: Unused import: 'package:flutter_adaptive_cards/flutter_adaptive_cards.dart'.

line 4 col 8: Unused import: 'package:flutter_adaptive_cards/src/elements/basics.dart'.

Fix lib/src/flutter_adaptive_cards.dart. (-1 points)

Analysis of lib/src/flutter_adaptive_cards.dart reported 2 hints:

line 6 col 8: Unused import: 'package:uuid/uuid.dart'.

line 10 col 8: Unused import: 'package:flutter_adaptive_cards/src/elements/input.dart'.

Format lib/src/action_handler.dart.

Run flutter format to format lib/src/action_handler.dart.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/basic_markdown.dart (Run flutter format to format lib/src/basic_markdown.dart.)
  • lib/src/elements/actions.dart (Run flutter format to format lib/src/elements/actions.dart.)
  • lib/src/elements/additional.dart (Run flutter format to format lib/src/elements/additional.dart.)
  • lib/src/elements/base.dart (Run flutter format to format lib/src/elements/base.dart.)
  • lib/src/elements/basics.dart (Run flutter format to format lib/src/elements/basics.dart.)
  • lib/src/registry.dart (Run flutter format to format lib/src/registry.dart.)
  • lib/src/utils.dart (Run flutter format to format lib/src/utils.dart.)

Maintenance issues and suggestions

Prefer published dependencies. (-100 points)

The source code in a git repository is mutable and could disappear.

Support latest dependencies. (-40 points)

The version constraint in pubspec.yaml does not support the latest published versions for 4 dependencies (http, intl, provider, uuid).

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: chewie.

The package description is too short. (-17 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
chewie 0.9.8
flutter 0.0.0
flutter_markdown ^0.2.0 0.2.0
http ^0.11.3+16 0.11.3+17 0.12.0+2
intl ^0.15.7 0.15.8 0.16.0
provider ^2.0.1 2.0.1+1 3.1.0
tinycolor ^1.0.2 1.0.2
uuid ^1.0.3 1.0.3 2.0.2
Transitive dependencies
args 1.5.2
async 2.3.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.3
http_parser 3.1.3
markdown 2.0.3
meta 1.1.7
open_iconic_flutter 0.3.0
path 1.6.4
pigment 1.0.3
screen 0.0.5
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
video_player 0.10.2+1
Dev dependencies
flutter_test
mockito ^4.0.0
test ^1.5.1