当前位置:网站首页>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
边栏推荐
- 開關電源設計分享及電源設計技巧圖解
- Fundamentals of machine learning theory -- some terms about machine learning
- 12个例子夯实promise基础
- 高层次人才一站式服务平台开发 人才综合服务平台系统
- Keysight has chosen what equipment to buy for you
- Click the input box to pop up the keyboard layout and move up
- arcgis js api dojoConfig配置
- Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
- Getting started with vcpkg
- Feature selection feature_ selection--SelectKBest
猜你喜欢
FTP、ssh远程访问及控制
From technical system to business insight, the closing chapter of the practice of small and medium-sized R & D team structure
Esp01s with Arduino development environment
开关电源设计分享及电源设计技巧图解
浅谈c语言指针的强制转换
binlog2sql 工具安装使用及问题汇总
Introduction to ROS learning notes (II)
Esp32 drive encoder -- siq-02fvs3 (vscade + IDF)
Introduction to ROS learning notes (I)
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
随机推荐
12个例子夯实promise基础
Tencent map and high logo removal method
Openlayers 5.0 loading ArcGIS Server slice service
【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
Keysight has chosen what equipment to buy for you
ESP32 LVGL8. 1 - msgbox message box (msgbox 28)
2022.04.23(LC_714_买卖股票的最佳时机含手续费)
Wechat video extraction and receiving file path
Click the input box to pop up the keyboard layout and move up
SSDB Foundation
Druid SQL和Security在美团点评的实践
Using bafayun to control the computer
Eight bit binary multiplier VHDL
Modify the font size of hint in editext
openlayers draw矩形
openlayers 5.0 当地图容器大小改变时,重新加载地图
Circuit on-line simulation
js上传文件时控制文件类型和大小
PyGame tank battle
RPM package management