你可以使用dart的badges库,它正在对IconButton
小部件产生这种效果,它带有有用的参数,如badgeColor
和badgeTextColor
。您可以使用以下步骤将其添加到项目中:
在你的pubspec.yaml
文件中添加:
badges: ^0.0.6 //latest version as of the time of writing the answer
然后运行flutter packages get
命令,之后可以使用以下行导入它:
import 'package:badges/badges.dart';