当前位置:网站首页>dart learning record - Updating
dart learning record - Updating
2022-08-05 20:54:00 【Qingqiu】
学习目标:
- 1.Dart 入门知识
学习内容:
1.Dart 入门知识
- initialized value 3 种写法?
class TestData {
//一.Add a question mark after the property?
int? sum = 0;
//一.late关键字
late int total= 0;
int data= 0;
//一.Constructor parameter assignment such as:this.data
TestData(this.data);
}
- 继承 StatefulWidget How to implement stateful later?
import 'package:flutter/material.dart';
void main() {
runApp(AlertView());
}
class AlertView extends StatefulWidget {
@override
_AlertViewState createState() => _AlertViewState();
}
class _AlertViewState extends State<AlertView> {
//放在buildinside will be reset,只有放在 build Only outside the method can be stateful
var newDate = DateTime.now();
@override
Widget build(BuildContext context) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('$newDate'),
TextButton(
//After clicking on the date component
onPressed: () async {
final currentDate = DateTime.now();
final selectedDate = await showDatePicker(
context: context,
initialDate: currentDate,
firstDate: currentDate,
lastDate: DateTime(2333));
//执行 setState The above will be re-executed build 方法,如果newDate放在buildinside will be reset
setState(() {
newDate = selectedDate!;
});
},
child: Text('日期选择'))
],
));
}
}
边栏推荐
- 二叉树最近的公共祖先[后序遍历与回溯模型的考察]
- 自动化网络配置
- SwiftUI case: 3D rotating picture player
- 【opencv图像处理】-- 8. 特征点检测:Harris,shi-tomasi,SIFT角点检测,关键点和描述子
- Taishan OFFICE Technical Lecture: When the same borders are adjacent to each other, it is reasonable and unreasonable to merge
- OpenSSL公私钥证书哪些事儿
- The best programming language
- PHP基础笔记-NO.3
- 最好的编程语言
- D碳社区推荐读物:《碳中和与中国未来》:从大国博弈角度解读碳中和
猜你喜欢

TypeError:列表索引必须是整数或片,不是str

面试字节跳动—真实面试题分享

解决web项目导入到idea后,文件的蓝色小点消失了(web文件资源根路径)

自动化网络配置

Guitar Pro 8吉他新版功能特性简介

【opencv图像处理】-- 8. 特征点检测:Harris,shi-tomasi,SIFT角点检测,关键点和描述子

现阶段,你该如何把握元宇宙NFG行业的机遇?

Kettle【实践 06】使用 HTTP client 获取 GPC 全球商品分类代码 JSON 数据处理入库全流程(云资源分享:ktr+数据.sql)

数据分析的必备能力:数据敏感度是什么,应该怎样培养?

623. 在二叉树中增加一行
随机推荐
Win10 开机系统蓝屏代码0xc0000098,ntfs.sys损坏或丢失
day15--Using postman to upload and download files
js校验日期时间的正则表达式
TRON Poloniex is the first in the industry to support ETH upgrade and launch potential forked currency futures
Rust Study Notes: 1.1 Introduction and Installation
BI业务分析思维:现金流量风控分析(三)风险控制
【idea插件】MetricsReloaded使用
Day 15 (Part 1) & uploads and downloads of poetman
自动化网络配置
什么是MySQL表分区?
现阶段,你该如何把握元宇宙NFG行业的机遇?
SwiftUI案例:天气
TCP & UDP
TypeError:List indices must be integers or slices , not str
arm设备上的嵌入式开发编译环境搭建
【opencv图像处理】-- 6.图像轮廓(面积周长)、多边形逼近、外接矩形、查找/绘制轮廓
国内多位架构大牛强烈推荐的大型分布式手册
编写一些简单的脚本
【opencv图像处理】--4. 低、高通滤波,卷积和各种算子
【opencv图像处理】-- 7. 图像金字塔与直方图