Flutter圆角图标插件round_icon的使用
Flutter圆角图标插件round_icon的使用

安装
-
添加依赖到
pubspec.yaml
dependencies: round_icon: git: url: https://github.com/teixeirazeus/round_icon
-
运行
pub get
flutter pub get
-
导入包
import 'package:round_icon/round_icon.dart';
使用
RoundIcon
是一个具有圆形背景的图标小部件。你可以设置图标的类型、背景颜色和图标颜色。
import 'package:flutter/material.dart';
import 'package:round_icon/round_icon.dart';
void main() {
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
[@override](/user/override)
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: RoundIcon(
icon: Icons.person, // 设置图标类型
backgroundColor: Colors.grey, // 设置背景颜色
iconColor: Colors.black), // 设置图标颜色
),
),
);
}
}
更多关于Flutter圆角图标插件round_icon的使用的实战教程也可以访问 https://www.itying.com/category-92-b0.html
1 回复