import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class SplashPage extends StatefulWidget { SplashPage({Key? key, required this.title}) : super(key: key); final String title; @override _SplashPageState createState() => _SplashPageState(); } class _SplashPageState extends State with SingleTickerProviderStateMixin { int index = 1; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return MaterialApp(home: WillPopScope( onWillPop: () async { return false; }, child: Scaffold( backgroundColor: Colors.red, body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("$index"), InkWell( onTap: () { setState(() { index += 1; }); }, child: const Text("点击事件"), ) ], )))); } }