Flutter:如何删除 CupertinoDatePicker 中的分隔线?
Flutter: How to remove the divider lines in CupertinoDatePicker?
在进行编码演练时,我一直没有找到摆脱分隔线的方法。
我怎样才能做到这一点?有关更多信息,我刚刚通过复制 CupertinoDatePicker class.
创建了一个新的自定义 class
由于您复制了 CupertinoDatePicker
class 只需从 picker.dart 中删除 _buildMagnifierScreen()
方法中的边框 /src/cupertino/
/// Draws the magnifier borders.
Widget _buildMagnifierScreen() {
final Color resolvedBorderColor = CupertinoDynamicColor.resolve(_kHighlighterBorder, context);
return IgnorePointer(
child: Center(
child: Container(
decoration: BoxDecoration(
// remove this attribute
border: Border(
top: BorderSide(width: 0.0, color: resolvedBorderColor),
bottom: BorderSide(width: 0.0, color: resolvedBorderColor),
),
),
constraints: BoxConstraints.expand(
height: widget.itemExtent * widget.magnification,
),
),
),
);
}
在进行编码演练时,我一直没有找到摆脱分隔线的方法。 我怎样才能做到这一点?有关更多信息,我刚刚通过复制 CupertinoDatePicker class.
创建了一个新的自定义 class由于您复制了 CupertinoDatePicker
class 只需从 picker.dart 中删除 _buildMagnifierScreen()
方法中的边框 /src/cupertino/
/// Draws the magnifier borders.
Widget _buildMagnifierScreen() {
final Color resolvedBorderColor = CupertinoDynamicColor.resolve(_kHighlighterBorder, context);
return IgnorePointer(
child: Center(
child: Container(
decoration: BoxDecoration(
// remove this attribute
border: Border(
top: BorderSide(width: 0.0, color: resolvedBorderColor),
bottom: BorderSide(width: 0.0, color: resolvedBorderColor),
),
),
constraints: BoxConstraints.expand(
height: widget.itemExtent * widget.magnification,
),
),
),
);
}