逻辑
使用Timer的构造方法
实现效果

实现过程
使用flutter 首先要引入全局文件/库
import 'package:flutter/material.dart';
使用Timer 可以看Timer官网 需要引入'dart:async'

import 'dart:async';
使用main函数进入组件
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
home: Scaffold(
appBar: AppBar(
title: Text('计时器'),
),
body: TimerTest( title: ''),
),
);
}
}
定义组件TimerTest
class TimerTest extends StatefulWidget {
TimerTest({Key? key, r

&spm=1001.2101.3001.5002&articleId=124750975&d=1&t=3&u=332f5a5ea9e94bf9852144a2e6f594fd)
864

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



