ico

Pub

Ico pack,提供一组 Flutter 图标。

安装

pubspec.yamldependencies: 部分,添加以下行

dependencies:
  ico: <latest_version>

用法

import 'package:ico/ico.dart';
class MyWidget extends StatelessWidget {
// Use the Default Icon Widget + Ico class for the IconData
  Widget build(BuildContext context) {
    return Icon(Ico.processor_outline);
  }
}

图标名称

图标名称与 官方网站 上的图标名称相同,但采用小写驼峰命名法。

示例

图标名称 代码 风格
gamepad_filled Ico.gamepad_filled solid
printer_filled Ico.printer_filled filled
microphone_outline Ico.microphone_outline outlined

示例应用

example 目录中的 Flutter 应用中查看所有可用的 Ico

import 'package:flutter/material.dart';
import 'package:ico/ico.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const  MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(title: 'Ico Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key,required this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            // Using Ico the standard way: injecting the IconData into the Icon object
            Icon(Ico.gamepad_filled),
            Icon(Ico.printer_filled),
            Icon(Ico.microphone_outline),
          ],
        ),
      ),
    );
  }
}

GitHub

查看 Github