我有一个具有以下属性的 ElevatedButton:我在此处附加了一张照片:https: //i.stack.imgur.com/oH3pO.png
ElevatedButton(
clipBehavior: Clip.none,
style: ElevatedButton.styleFrom(
padding: EdgeInsets.zero,
minimumSize: Size(0, 0),
elevation: 0,
),
Run Code Online (Sandbox Code Playgroud)
我修改了周围的填充,但它的最小填充 (_InputPadding) 仍然为 48 像素 x 48 像素。我该如何解决这个问题?
awa*_*aik 18
这些填充是因为tapTargetSize属性。要删除它们,请添加tapTargetSize: MaterialTapTargetSize.shrinkWrap,到按钮样式。
例如:
ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: size,
padding: const EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
Run Code Online (Sandbox Code Playgroud)
来自源代码的附加信息。
/// MaterialTapTargetSize
///
/// Expands the minimum tap target size to 48px by 48px.
///
/// This is the default value of [ThemeData.materialTapTargetSize] and the
/// recommended size to conform to Android accessibility scanner
/// recommendations.
padded,
/// Shrinks the tap target size to the minimum provided by the Material
/// specification.
shrinkWrap,
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15589 次 |
| 最近记录: |