main.dart:
import 'package:Flutter/material.dart';
import 'dart:async';
import 'dart:ui';
import 'app.dart';
void main()=>runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
routes: <String, WidgetBuilder> {
'/app': (_) => AppPage(),
},
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: InkWell(
child: Image.asset('images/7.jpg',fit: BoxFit.fill,),
onTap: (){
Navigator.pushNamed(context, "/app");
},
),
);
}
@override
void initState() {
super.initState();
countDown();
}
// 倒计时
void countDown() {
var _duration = Duration(seconds: 3);
new Future.delayed(_duration, go2HomePage);
}
void go2HomePage() {
Navigator.of(context).pushReplacementNamed('/app');
}
}
app.dart
import 'package:Flutter/material.dart';
class AppPage extends StatefulWidget {
@override
_AppPageState createState() => _AppPageState();
}
class _AppPageState extends State<AppPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.orange.shade100,
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ListTile(
title: Text('hello world'),
subtitle: Text('love you so much the beautiful world'),
),
ListTile(
title: Text('hello world'),
subtitle: Text('love you so much the beautiful world'),
),
ListTile(
title: Text('hello world'),
subtitle: Text('love you so much the beautiful world'),
),
],
),
);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。