🚀 AdoptAWidget: IgnorePointer (#70185)

*  Add IgnorePointer Widget dartpad

* 🐛 Fix grammatical issues in docs of IgnorePointer

*  Remove trailing spaces
This commit is contained in:
Yazeed AlKhalaf 2020-11-23 20:45:37 +03:00 committed by GitHub
parent 5fbbd73a76
commit bcdee0ac74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6609,8 +6609,6 @@ class RepaintBoundary extends SingleChildRenderObjectWidget {
/// A widget that is invisible during hit testing.
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=qV9pqHWxYgI}
///
/// When [ignoring] is true, this widget (and its subtree) is invisible
/// to hit testing. It still consumes space during layout and paints its child
/// as usual. It just cannot be the target of located events, because it returns
@ -6620,6 +6618,61 @@ class RepaintBoundary extends SingleChildRenderObjectWidget {
/// the semantics layer (and thus e.g. accessibility tools). If
/// [ignoringSemantics] is null, it uses the value of [ignoring].
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=qV9pqHWxYgI}
///
/// {@tool dartpad --template=stateful_widget_material}
/// The following sample has an [IgnorePointer] widget wrapping the `Column`
/// which contains a button.
/// When [ignoring] is set to `true` anything inside the `Column` can
/// not be tapped. When [ignoring] is set to `false` anything
/// inside the `Column` can be tapped.
///
/// ```dart
/// bool ignoring = false;
/// void setIgnoring(bool newValue) {
/// setState(() {
/// ignoring = newValue;
/// });
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return Scaffold(
/// appBar: AppBar(
/// centerTitle: true,
/// title: ElevatedButton(
/// onPressed: () {
/// setIgnoring(!ignoring);
/// },
/// child: Text(
/// ignoring ? 'Set ignoring to false' : 'Set ignoring to true',
/// ),
/// ),
/// ),
/// body: Center(
/// child: IgnorePointer(
/// ignoring: ignoring,
/// child: Column(
/// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
/// children: <Widget>[
/// Text(
/// 'Ignoring: $ignoring',
/// ),
/// ElevatedButton(
/// onPressed: () {},
/// child: Text(
/// 'Click me!',
/// ),
/// ),
/// ],
/// ),
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [AbsorbPointer], which also prevents its children from receiving pointer