Flutter图标库插件iconforest_amazingneoicons的使用
Flutter图标库插件iconforest_amazingneoicons的使用
Amazing Neo图标(112个图标)

示例代码
import 'package:flutter/material.dart';
import 'package:iconforest_amazingneoicons/amazingneoicons.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// 这个小部件是你的应用程序的根。
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
// 使用AmazingNeoIcons类来引用图标
Icon(AmazingNeoIcons.airplane),
],
),
),
);
}
}
说明
-
首先,确保在
pubspec.yaml
文件中添加了依赖项:dependencies: flutter: sdk: flutter iconforest_amazingneoicons: ^版本号
-
导入所需的包:
import 'package:iconforest_amazingneoicons/amazingneoicons.dart';
更多关于Flutter图标库插件iconforest_amazingneoicons的使用的实战教程也可以访问 https://www.itying.com/category-92-b0.html
1 回复