|
@@ -1,7 +1,11 @@
|
|
|
+import 'dart:async';
|
|
|
+
|
|
|
import 'package:flutter/material.dart';
|
|
|
-import 'package:flutter_demo/Screens/Welcome/welcome_screen.dart';
|
|
|
+import 'package:flutter/services.dart';
|
|
|
import 'package:flutter_demo/constants.dart';
|
|
|
|
|
|
+import 'Screens/Guide/guide_screen.dart';
|
|
|
+
|
|
|
void main() {
|
|
|
runApp(MyApp());
|
|
|
}
|
|
@@ -9,6 +13,7 @@ void main() {
|
|
|
class MyApp extends StatelessWidget {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
+ // Size size = MediaQuery.of(context).size;
|
|
|
return MaterialApp(
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
title: 'Flutter Demo',
|
|
@@ -16,7 +21,108 @@ class MyApp extends StatelessWidget {
|
|
|
primaryColor: kPrimaryColor,
|
|
|
scaffoldBackgroundColor: Colors.white,
|
|
|
primaryColorLight: kPrimaryLightColor),
|
|
|
- home: WelcomeScreen(),
|
|
|
+ home: Scaffold(
|
|
|
+ body: SplashScreen(),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class SplashScreen extends StatefulWidget {
|
|
|
+ const SplashScreen({Key? key}) : super(key: key);
|
|
|
+
|
|
|
+ @override
|
|
|
+ State<SplashScreen> createState() => _SplashScreenState();
|
|
|
+}
|
|
|
+
|
|
|
+class _SplashScreenState extends State<SplashScreen> {
|
|
|
+ int _countdown = 3;
|
|
|
+ Timer? _countdownTimer;
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ _startRecordTime();
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 定时自动跳转页面
|
|
|
+ void _startRecordTime() {
|
|
|
+ _countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) {
|
|
|
+ setState(() {
|
|
|
+ if (_countdown <= 1) {
|
|
|
+ Navigator.of(context).pop();
|
|
|
+ Navigator.of(context).push(MaterialPageRoute(builder: (context) {
|
|
|
+ return GuideScreen();
|
|
|
+ }));
|
|
|
+ _countdownTimer?.cancel();
|
|
|
+ _countdownTimer = null;
|
|
|
+ } else {
|
|
|
+ _countdown -= 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ super.dispose();
|
|
|
+ if (_countdownTimer != null && _countdownTimer!.isActive) {
|
|
|
+ _countdownTimer!.cancel();
|
|
|
+ _countdownTimer = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ SystemChrome.setEnabledSystemUIOverlays([]);
|
|
|
+ Size size = MediaQuery.of(context).size;
|
|
|
+ return Container(
|
|
|
+ height: size.height,
|
|
|
+ width: double.infinity,
|
|
|
+ color: Color(0xffc3eff2),
|
|
|
+ constraints: BoxConstraints.expand(),
|
|
|
+ child: Stack(
|
|
|
+ alignment: AlignmentDirectional.bottomCenter,
|
|
|
+ children: <Widget>[
|
|
|
+ Positioned(
|
|
|
+ bottom: 60,
|
|
|
+ child: Row(
|
|
|
+ children: <Widget>[
|
|
|
+ Image(
|
|
|
+ image: AssetImage('assets/images/logo.png'),
|
|
|
+ width: 80,
|
|
|
+ height: 80,
|
|
|
+ ),
|
|
|
+ Padding(
|
|
|
+ padding: const EdgeInsets.only(left: 25),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: <Widget>[
|
|
|
+ Text(
|
|
|
+ "享有康康",
|
|
|
+ style: TextStyle(
|
|
|
+ color: Color(0xff42c293),
|
|
|
+ fontSize: 24,
|
|
|
+ fontStyle: FontStyle.italic,
|
|
|
+ fontWeight: FontWeight.w700,
|
|
|
+ decoration: TextDecoration.none,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "为您的家庭保驾护航",
|
|
|
+ style: TextStyle(
|
|
|
+ fontWeight: FontWeight.w600,
|
|
|
+ decoration: TextDecoration.none,
|
|
|
+ fontSize: 15,
|
|
|
+ color: Color(0xff6e6e6e)),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
}
|