/// Flutter code sample for IgnorePointer
// 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.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: _title,
home: MyStatefulWidget(),
);
}
}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MySta
flutter 交互之IgnorePointer
最新推荐文章于 2024-05-26 22:38:23 发布
这篇博客展示了如何在Flutter中使用IgnorePointer widget来控制子组件是否可以被触碰。通过设置ignoring属性为true或false,可以实现对Column内按钮的触摸事件启用或禁用。当ignoring为false时,Column内的元素可以响应点击;反之,则无法响应。

最低0.47元/天 解锁文章
1328

被折叠的 条评论
为什么被折叠?



