Giter VIP home page Giter VIP logo

material_design_icons_flutter's Introduction

Gitpod Ready-to-Code

material_design_icons_flutter

The Material Design Icons Icon pack available as set of Flutter Icons.

Based on Material Design Icons 7.0.96. See a web demo build with this package.

๐Ÿ‘ Like us on pub.dev!

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

  material_design_icons_flutter: 6.0.7096

WARNING: MDI's version is based on their icons quantity, which does not strictly respect semver guide. They do try their best to keep icons in same name between minor releases but name changing may still appear. To not break your application, using a fix version in your pubspec.yaml is highly recommended.

Usage

import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';

class MyWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return new IconButton(
      // Use the MdiIcons class for the IconData
      icon: new Icon(MdiIcons.sword),
      onPressed: () { print('Using the sword'); }
     );
  }
}

Or, if you want to access the icon by a string name, you can use fromString method to create one.

import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';

class MyWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return new IconButton(
      // Use the string name to access icons.
      icon: new Icon(MdiIcons.fromString('sword')),
      onPressed: () { print('Using the sword'); }
     );
  }
}

Note: This is not recomended because to make fromString work we need a map for all icon names. Using this method will not get the benefits of tree-shaking.

On flutter 1.22 and above, using fromString method will also cause a compile error This application cannot tree shake icons fonts, which can be bypass by building with --no-tree-shake-icons.

Name Conversion

Some icons' names are reserved keywords in Dart (and most other languages), so they have been changed.

  • null -> nullIcon
  • switch -> switchIcon
  • sync -> syncIcon
  • factory -> factoryIcon

material_design_icons_flutter's People

Contributors

guyluz11 avatar harsimranmaan avatar itsjimi avatar maskys avatar viliusp avatar ziofat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.