优化搜索框样式,优化任务列表,环境变量等相关页面使用体验

This commit is contained in:
jyuesong
2022-06-07 18:28:38 +08:00
parent c7824c920b
commit 9759caf9b8
64 changed files with 1030 additions and 520 deletions

View File

@@ -10,8 +10,7 @@ class InTimeLogPage extends StatefulWidget {
final String cronId;
final bool needTimer;
const InTimeLogPage(this.cronId, this.needTimer, {Key? key})
: super(key: key);
const InTimeLogPage(this.cronId, this.needTimer, {Key? key}) : super(key: key);
@override
_InTimeLogPageState createState() => _InTimeLogPageState();
@@ -25,28 +24,28 @@ class _InTimeLogPageState extends State<InTimeLogPage> {
@override
void initState() {
super.initState();
if (widget.needTimer) {
_timer = Timer.periodic(
const Duration(seconds: 2),
(timer) {
getLogData();
},
);
} else {
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
_timer = Timer.periodic(
const Duration(seconds: 2),
(timer) {
getLogData();
});
}
},
);
}
bool isRequest = false;
bool canRequest = true;
getLogData() async {
if (!canRequest) return;
if (isRequest) return;
isRequest = true;
HttpResponse<String> response = await Api.inTimeLog(widget.cronId);
if (response.success) {
content = response.bean;
setState(() {});
}
isRequest = false;
}
@override