import 'dart:async';
import 'package:flutter/material.dart';
class Temp3Page extends StatefulWidget {
Temp3Page({Key key}) : super(key: key);
_Temp3Page createState() => _Temp3Page();
}
class _Temp3Page extends State<Temp3Page> {
Timer timer;
@override
void initState() {
super.initState();
timer = Timer(const Duration(milliseconds: 0), () {
try {
showDialog<Null>(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return AlertDialog(
title: Text('标题'),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text('内容'),
],
),
),
actions: <Widget>[
FlatButton(
child: Text('确定'),
onPressed: () {
Navigator.of(context).pop();
},
),
FlatButton(
child: Text('取消'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
} catch (e) {}
});
}
@override
void dispose() {
timer.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Center(child: Text('d框'));
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)