区块链技术博客
www.b2bchain.cn

Flutter 连点n下触发事件求职学习资料

本文介绍了Flutter 连点n下触发事件求职学习资料,有助于帮助完成毕业设计以及求职,是一篇很好的资料。

对技术面试,学习经验等有一些体会,在此分享。

“`
import ‘package:flutter/widgets.dart’;

class MultiClickWidget extends StatefulWidget {
final Widget child;
final int triggerClickCount;
final int clickIntervalMs;
final void Function() onTriggerClick;
final void Function(int count) onBeforeTriggerClick;

const MultiClickWidget({
Key key,
@required this.triggerClickCount,
@required this.onTriggerClick,
this.child,
this.onBeforeTriggerClick,
this.clickIntervalMs = 666,
}) : super(key: key);

@override
_MultiClickWidgetState createState() => _MultiClickWidgetState();
}

class _MultiClickWidgetState extends State {
int _lastClickTime = 0;

int _clickCount = 0;

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (widget.triggerClickCount <= 1) {
widget.onTriggerClick();

“`
import ‘package:flutter/widgets.dart’;

class MultiClickWidget extends StatefulWidget {
final Widget child;
final int triggerClickCount;
final int clickIntervalMs;
final void Function() onTriggerClick;
final void Function(int count) onBeforeTriggerClick;

const MultiClickWidget({
Key key,
@required this.triggerClickCount,
@required this.onTriggerClick,
this.child,
this.onBeforeTriggerClick,
this.clickIntervalMs = 666,
}) : super(key: key);

@override
_MultiClickWidgetState createState() => _MultiClickWidgetState();
}

class _MultiClickWidgetState extends State {
int _lastClickTime = 0;

int _clickCount = 0;

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (widget.triggerClickCount <= 1) {
widget.onTriggerClick();

“`
import ‘package:flutter/widgets.dart’;

class MultiClickWidget extends StatefulWidget {
final Widget child;
final int triggerClickCount;
final int clickIntervalMs;
final void Function() onTriggerClick;
final void Function(int count) onBeforeTriggerClick;

const MultiClickWidget({
Key key,
@required this.triggerClickCount,
@required this.onTriggerClick,
this.child,
this.onBeforeTriggerClick,
this.clickIntervalMs = 666,
}) : super(key: key);

@override
_MultiClickWidgetState createState() => _MultiClickWidgetState();
}

class _MultiClickWidgetState extends State {
int _lastClickTime = 0;

int _clickCount = 0;

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (widget.triggerClickCount <= 1) {
widget.onTriggerClick();

部分转自互联网,侵权删除联系

赞(0) 打赏
部分文章转自网络,侵权联系删除b2bchain区块链学习技术社区 » Flutter 连点n下触发事件求职学习资料
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

b2b链

联系我们联系我们