FLUTTER ECOSYSTEM

ziofat/material_design_icons_flutter

Material Design 아이콘(https://materialdesignicons.com/) 아이콘 팩은 플러터 아이콘 세트로 사용할 수 있습니다.

material_design_icons_flutter 프로젝트 이미지
Stars
167
Forks
49
최근 푸시(UTC)
2024. 11. 23.
프로젝트 상태
활성
ziofat GitHub avatar
GITHUB User

ziofat ↗

I define, I assert, I declare, I command.

TencentShenzhen, China
언어DartC++CMakeHTMLSwiftCShellKotlinObjective-C

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 1 개
  • flutter{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

material_design_icons_flutter

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

Based on Material Design Icons 7.4.47. 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: 7.0.7447

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