我想为我的新应用程序创建一个设计系统.
child: ElevatedButton.icon(
icon: Icon(Icons.power_settings_new),
onPressed: () => context.go('/login'),
label: const Text('Log out'),
),
这是可以的,但在这种情况下,它应该有一个红色的重点.这一目标很容易通过使用forecoundColor属性来实现.通过使用该技术,不需要担心图标的 colored颜色 、文本的 colored颜色 、涟漪效果的 colored颜色 .
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.red,
),
icon: Icon(Icons.power_settings_new),
onPressed: () => context.go('/login'),
label: const Text('Log out'),
),
但是,我不想每次都指定这个 colored颜色 .我更喜欢做这样的东西,我想避免为按钮编写Anny包装器.
child: ElevatedButton.error( // Color accent is red
icon: Icon(Icons.power_settings_new),
onPressed: () => context.go('/login'),
label: const Text('Log out'),
),
这件事有可能发生吗?
Question 2:图标、文本和涟漪效果如何知道它们需要使用前景色来呈现自己?