当前位置:网站首页>The flyer realizes page Jump through routing routes
The flyer realizes page Jump through routing routes
2022-04-23 19:10:00 【Little brother】
1. Page Jump , First, build a route to manage the jump page Routers.dart
import 'package:flutter_app/Login.dart';
import 'package:flutter_app/main.dart';
// Define jump page usage
class Routers {
static String root = ""; // The following page must be defined as this style
static String login = "/Login";
static final routers = {
root: (context) => Splash(),
login: (context) => Login(),
};
}
Here I have prepared two pages ,Splash and Login , What I have to do is from Splash The page jumps to Login page .
2. Here we mainly look at the before jump Splash What is done on the page .
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_app/Utils/Routers.dart';
void main() =>runApp( Splash());
class Splash extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: "/",
routes: Routers.routers,// Route jump uses
// home: HomePage()
);
}
}
@override
void initState() {
super.initState();
startTime();
}
void startTime() {
// Time delay 5000 Execution in milliseconds
Future.delayed(const Duration(milliseconds: 5000), () {
// Delayed code
Navigator.of(context).pushReplacementNamed('/Login');// Page to jump to
});
}
}
notes : First, reference the routing tool class import 'package:flutter_app/Utils/Routers.dart';
The initialization route here initialRoute: "/" and Home It can't be used at the same time , Will conflict and report errors .
I made a delayed automatic jump function of the page , Used here 2 Function code in :
① Delay processing method :
// Time delay 5000 Execution in milliseconds
Future.delayed(const Duration(milliseconds: 5000), () {
// Delayed code
});
② Page Jump method :
Navigator.of(context).pushReplacementNamed('/Login');// Page to jump to
Here, the page jump function is realized , Daily records .
版权声明
本文为[Little brother]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210601422422.html
边栏推荐
- Esp01s with Arduino development environment
- PyGame tank battle
- std::stoi stol stoul stoll stof stod
- Druid SQL和Security在美团点评的实践
- Go language GUI framework Fyne Chinese garbled or not displayed
- mysql_linux版本的下載及安裝詳解
- [记录]TypeError: this.getOptions is not a function
- Introduction to ROS learning notes (II)
- 开关电源设计分享及电源设计技巧图解
- 2022.04.23(LC_714_买卖股票的最佳时机含手续费)
猜你喜欢

c#:泛型反射

OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!
![[报告] Microsoft :Application of deep learning methods in speech enhancement](/img/29/2d2addd826359fdb0920e06ebedd29.png)
[报告] Microsoft :Application of deep learning methods in speech enhancement

JVM的类加载过程

Introduction to ROS learning notes (II)

Oracle配置st_geometry

MVVM model
![[记录]TypeError: this.getOptions is not a function](/img/c9/0d92891b6beec3d6085bd3da516f00.png)
[记录]TypeError: this.getOptions is not a function

Practice of Druid SQL and security in meituan review

ArcMap连接 arcgis server
随机推荐
2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
Solve the problem of invalid listview Click
Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.
SSDB foundation 3
mysql_linux版本的下載及安裝詳解
redis优化系列(三)解决主从配置后的常见问题
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
开关电源设计分享及电源设计技巧图解
Esp32 drive encoder -- siq-02fvs3 (vscade + IDF)
Client interns of a large factory share their experience face to face
Modify the font size of hint in editext
An 8266 crash
Regular expressions for judging positive integers
Getting started with vcpkg
Introduction to micro build low code zero Foundation (lesson 3)
Coolweather is revised and connected to the wind weather interface to realize the broken line diagram of temperature
Yyds dry goods inventory stringprep --- Internet string preparation
MySQL restores or rolls back data through binlog
MVVM model
On the forced conversion of C language pointer