import 'package:mdl/mdl.dart';

main() {
    registerMdl();
    componentFactory().run().then((_) {
    });
}
To use any MDL component, you must include the minified CSS file in the <head> section of the page:
More about theming...
  <div class="demo-preview-block">
      <h2>Wide card with share menu button</h2>
      <style>
          .demo-card-wide.mdl-card {
              width: 512px;
          }
          .demo-card-wide > .mdl-card__title {
              color: #fff;
              height: 176px;
              background: url('demo-images/welcome_card.jpg') center / cover;
          }
          .demo-card-wide > .mdl-card__menu {
              color: #fff;
          }
      </style>
      <div class="mdl-card mdl-shadow--2dp demo-card-wide">
          <div class="mdl-card__title">
              <h2 class="mdl-card__title-text mdl-color-text--white">Welcome</h2>
          </div>
          <div class="mdl-card__supporting-text">
              Lorem ipsum dolor sit amet, consectetur adipiscing elit.
              Mauris sagittis pellentesque lacus eleifend lacinia...
          </div>
          <div class="mdl-card__actions mdl-card--border">
              <a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
                  Get Started
              </a>
          </div>
          <div class="mdl-card__menu">
              <button id="share-demo" class="mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect">
                  <i class="material-icons">share</i>
              </button>
              <ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right mdl-js-ripple-effect" for="share-demo">
                  <button class="mdl-menu__item">Item 1</button>
                  <button class="mdl-menu__item">Item 2</button>
                  <button class="mdl-menu__item" disabled>Item 3</button>
              </ul>
          </div>
      </div>
      <h2>Square card</h2>
      <style>
          .demo-card-square.mdl-card {
              width: 320px;
              height: 320px;
          }
          .demo-card-square > .mdl-card__title {
              color: #fff;
              background:
              url('demo-images/dog.png') bottom right 15% no-repeat #46B6AC;
          }
      </style>
      <div class="mdl-card mdl-shadow--2dp demo-card-square">
          <div class="mdl-card__title mdl-card--expand">
              <h2 class="mdl-card__title-text">Update</h2>
          </div>
          <div class="mdl-card__supporting-text">
              Lorem ipsum dolor sit amet, consectetur adipiscing elit.
              Aenan convallis.
          </div>
          <div class="mdl-card__actions mdl-card--border">
              <a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
                  View Updates
              </a>
          </div>
      </div>
      <h2>Image card</h2>
      <style>
          .demo-card-image.mdl-card {
              width: 256px;
              height: 256px;
              background: url('demo-images/image_card.jpg') center / cover;
          }
          .demo-card-image > .mdl-card__actions {
              height: 52px;
              padding: 16px;
              background: rgba(0, 0, 0, 0.2);
          }
          .demo-card-image__filename {
              color: #fff;
          }
      </style>
      <div class="mdl-card mdl-shadow--2dp demo-card-image">
          <div class="mdl-card__title mdl-card--expand"></div>
          <div class="mdl-card__actions">
              <span class="demo-card-image__filename">Image.jpg</span>
          </div>
      </div>
      <h2>Event card</h2>
      <style>
          .demo-card-event.mdl-card {
              width: 256px;
              height: 256px;
              background: #3E4EB8;
          }
          .demo-card-event > .mdl-card__actions {
              border-color: rgba(255, 255, 255, 0.2);
          }
          .demo-card-event > .mdl-card__title {
              align-items: flex-start;
          }
          .demo-card-event > .mdl-card__title > h4 {
              margin-top: 0;
          }
          .demo-card-event > .mdl-card__actions {
              display: flex;
              box-sizing:border-box;
              align-items: center;
          }
          .demo-card-event > .mdl-card__title,
          .demo-card-event > .mdl-card__actions,
          .demo-card-event > .mdl-card__actions > .mdl-button {
              color: #fff;
          }
      </style>
      <div class="mdl-card mdl-shadow--2dp demo-card-event">
          <div class="mdl-card__title mdl-card--expand">
              <h4 class="mdl-color-text--white">
                  Featured event:<br>
                  May 24, 2016<br>
                  7-11pm
              </h4>
          </div>
          <div class="mdl-card__actions mdl-card--border">
              <a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
                  Add to Calendar
              </a>
              <div class="mdl-layout-spacer"></div>
              <i class="material-icons">event</i>
          </div>
      </div>
    <div class="mdl-card mdl-shadow--2dp">
      <div class="mdl-card__title mdl-color--primary">
         <h2 class="mdl-card__title-text mdl-color-text--accent">Integer lectus lacus, condimentum vitae lectus vitae</h2>
      </div>
      <div class="mdl-card__supporting-text">
        March 24th, 2014
      </div>
      <div class="mdl-card__supporting-text">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sagittis pellentesque lacus eleifend lacinia. Donec ut risus suscipit, convallis diam et, mattis urna. Phasellus sit amet ipsum nisl. Aliquam sed dictum neque. Vestibulum tempus at lacus et volutpat. Mauris molestie vel mauris id scelerisque.
      </div>
      <div class="mdl-card__actions">
         <a href="#" class="mdl-button">Some Action</a>
      </div>
    </div>
    <div class="mdl-card mdl-shadow--4dp">
      <div class="mdl-card__title mdl-color--primary">
         <h2 class="mdl-card__title-text mdl-color-text--accent">Integer lectus lacus, condimentum vitae lectus vitae</h2>
      </div>
      <div class="mdl-card__supporting-text">
        March 24th, 2014
      </div>
      <div class="mdl-card__supporting-text">
        Lorem ipsum dolor sit amet.
      </div>
      <div class="mdl-card__actions">
         <a href="#" class="mdl-button">Some Action</a>
      </div>
      <div class="mdl-card__menu">
        <button id="btn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color-text--white">
          <i class="material-icons">more_vert</i>
        </button>
        <ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right mdl-js-ripple-effect" for="btn">
          <button class="mdl-menu__item">Item 1</button>
          <button class="mdl-menu__item">Item 2</button>
          <button class="mdl-menu__item" disabled>Item 3</button>
        </ul>
      </div>
    </div>
  </div>

Introduction

The Material Design Lite (MDL) card component is a user interface element representing a virtual piece of paper that contains related data — such as a photo, some text, and a link — that are all about a single subject.

Cards are a convenient means of coherently displaying related content that is composed of different types of objects. They are also well-suited for presenting similar objects whose size or supported actions can vary considerably, like photos with captions of variable length. Cards have a constant width and a variable height, depending on their content.

Cards are a fairly new feature in user interfaces, and allow users an access point to more complex and detailed information. Their design and use is an important factor in the overall user experience. See the card component's Material Design specifications page for details.

Basic use

To use any MDL component, you must include the minified CSS and JavaScript files using standard relative-path references in the <head> section of the page, as described in the MDL Introduction.

To include an MDL card component:

 1. Code a <div> element; this is the "outer" container, intended to hold all of the card's content.

<div>
</div>

 2. Inside the div, code one or more "inner" divs, one for each desired content block. A card containing a title, an image, some text, and an action bar would contain four "inner" divs, all siblings.

<div>
  <div>
  ...
  </div>
  <div>
  ...
  </div>
  <div>
  ...
  </div>
  <div>
  ...
  </div>
</div>

 3. Add one or more MDL classes, separated by spaces, to the "outer" div and the "inner" divs (depending on their intended use) using the class attribute.

<div class="mdl-card">
  <div class="mdl-card__title">
  ...
  </div>
  <div class="mdl-card__media">
  ...
  </div>
  <div class="mdl-card__supporting-text">
  ...
  </div>
  <div class="mdl-card__actions">
  ...
  </div>
</div>

 4. Add content to each "inner" div, again depending on its intended use, using standard HTML elements and, optionally, additional MDL classes.

<div class="mdl-card">
  <div class="mdl-card__title">
    <h2 class="mdl-card__title-text">title Text Goes Here</h2>
  </div>
  <div class="mdl-card__media">
    <img src="photo.jpg" width="220" height="140" border="0" alt="" style="padding:20px;">
  </div>
  <div class="mdl-card__supporting-text">
    This text might describe the photo and provide further information, such as where and
    when it was taken.
  </div>
  <div class="mdl-card__actions">
    <a href="(URL or function)">Related Action</a>
  </div>
</div>

The card component is ready for use.

Examples

A card (no shadow) with a title, image, text, and action.

<div class="mdl-card">
  <div class="mdl-card__title">
     <h2 class="mdl-card__title-text">Auckland Sky Tower<br>Auckland, New Zealand</h2>
  </div>
  <div class="mdl-card__media">
    <img src="skytower.jpg" width="173" height="157" border="0" alt=""
     style="padding:10px;">
  </div>
  <div class="mdl-card__supporting-text">
  The Sky Tower is an observation and telecommunications tower located in Auckland,
  New Zealand. It is 328 metres (1,076 ft) tall, making it the tallest man-made structure
  in the Southern Hemisphere.
  </div>
  <div class="mdl-card__actions">
     <a href="http://en.wikipedia.org/wiki/Sky_Tower_%28Auckland%29">Wikipedia entry</a>
  </div>
</div>

Card (level-3 shadow) with an image, caption, and text:

<div class="mdl-card mdl-shadow--4dp">
  <div class="mdl-card__media"><img src="skytower.jpg" width="173" height="157" border="0"
   alt="" style="padding:10px;">
  </div>
  <div class="mdl-card__supporting-text">
    Auckland Sky Tower, taken March 24th, 2014
  </div>
  <div class="mdl-card__supporting-text">
  The Sky Tower is an observation and telecommunications tower located in Auckland,
  New Zealand. It is 328 metres (1,076 ft) tall, making it the tallest man-made structure
  in the Southern Hemisphere.
  </div>
</div>

Configuration options

The MDL CSS classes apply various predefined visual and behavioral enhancements to the card. The table below lists the available classes and their effects.

MDL class Effect Remarks
mdl-card Defines div element as an MDL card container Required on "outer" div
mdl-card--border Adds a border to the card section that it's applied to Used on the "inner" divs
mdl-shadow--2dp through mdl-shadow--16dp Assigns variable shadow depths (2, 3, 4, 6, 8, or 16) to card Optional, goes on "outer" div; if omitted, no shadow is present
mdl-card__title Defines div as a card title container Required on "inner" title div
mdl-card__title-text Assigns appropriate text characteristics to card title Required on head tag (H1 - H6) inside title div
mdl-card__subtitle-text Assigns text characteristics to a card subtitle Optional. Should be a child of the title element.
mdl-card__media Defines div as a card media container Required on "inner" media div
mdl-card__supporting-text Defines div as a card body text container and assigns appropriate text characteristics to body text Required on "inner" body text div; text goes directly inside the div with no intervening containers
mdl-card__actions Defines div as a card actions container and assigns appropriate text characteristics to actions text Required on "inner" actions div; content goes directly inside the div with no intervening containers