当前位置:网站首页>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
边栏推荐
猜你喜欢
开关电源设计分享及电源设计技巧图解
Druid SQL和Security在美团点评的实践
简化路径(力扣71)
FTP、ssh远程访问及控制
Esp32 (UART 485 communication) - 485 communication of serial port (3)
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
Class loading process of JVM
Simple use of navigation in jetpack
Using Visual Studio code to develop Arduino
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
随机推荐
The fifth bullet of MySQL learning -- detailed explanation of transaction and its operation characteristics
Sogou cell thesaurus analysis (only extract words and word frequency)
Practice of Druid SQL and security in meituan review
Redis common interview questions
c1000k TCP 连接上限测试1
Installation, use and problem summary of binlog2sql tool
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
Esp32 (UART 485 communication) - 485 communication of serial port (3)
坐标转换WGS-84 转 GCJ-02 和 GCJ-02转WGS-84
中金财富怎么样?在上边开户安全吗
RPM包管理
SSDB foundation 3
ESP32 LVGL8. 1 - msgbox message box (msgbox 28)
MVVM model
Keysight has chosen what equipment to buy for you
Network protocol: SCTP flow control transmission protocol
Yyds dry goods inventory stringprep --- Internet string preparation
2022.04.23(LC_763_划分字母区间)
MySQL学习第五弹——事务及其操作特性详解
Introduction to micro build low code zero Foundation (lesson 3)