You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.0 KiB
85 lines
2.0 KiB
import 'dart:async';
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// 常规布局
|
|
class One extends StatefulWidget {
|
|
@override
|
|
State<StatefulWidget> createState() {
|
|
return _OneState();
|
|
}
|
|
}
|
|
|
|
class _OneState extends State<One> {
|
|
int _count = 0;
|
|
Timer _timer;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
Timer.periodic(Duration(milliseconds: 1000), (t) {
|
|
setState(() {
|
|
_count++;
|
|
});
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
if (_timer != null && _timer.isActive) {
|
|
_timer.cancel();
|
|
}
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("性能测试1"),
|
|
),
|
|
body: Column(
|
|
children: <Widget>[
|
|
Container(
|
|
margin: EdgeInsets.fromLTRB(10, 10, 10, 5),
|
|
height: 100,
|
|
color: Colors.amberAccent,
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.fromLTRB(10, 10, 10, 5),
|
|
height: 100,
|
|
color: Colors.blue,
|
|
),
|
|
Container(
|
|
height: 100,
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
itemCount: 12,
|
|
itemBuilder: (context, index) {
|
|
return Container(
|
|
width: 70,
|
|
height: 70,
|
|
child: Image.asset(
|
|
"assets/2.png",
|
|
width: 50,
|
|
height: 50,
|
|
));
|
|
}),
|
|
),
|
|
Container(
|
|
height: 100,
|
|
margin: EdgeInsets.fromLTRB(10, 10, 10, 5),
|
|
color: Colors.yellow,
|
|
child: Center(
|
|
child: Text(
|
|
_count.toString(),
|
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|