当前位置:网站首页>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
边栏推荐
- Eight bit binary multiplier VHDL
- Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
- Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation
- binlog2sql 工具安装使用及问题汇总
- Customize the non slidable viewpage and how to use it
- SSDB Foundation
- MySQL restores or rolls back data through binlog
- Advanced transfer learning
- 2022.04.23(LC_714_买卖股票的最佳时机含手续费)
- SSDB基础3
猜你喜欢
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
Android Development: the client obtains the latest value in the database in real time and displays it on the interface
该买什么设备,Keysight 给你挑好了
简化路径(力扣71)
From technical system to business insight, the closing chapter of the practice of small and medium-sized R & D team structure
MVVM model
7、 DOM (Part 2) - chapter after class exercises and answers
Some records used by VS2010
Openharmony open source developer growth plan, looking for new open source forces that change the world!
[record] typeerror: this getOptions is not a function
随机推荐
SSDB foundation 3
Codeforces Round #784 (Div. 4)
Introduction to micro build low code zero Foundation (lesson 3)
Android Development: the client obtains the latest value in the database in real time and displays it on the interface
mysql_linux版本的下載及安裝詳解
openlayers 5.0 当地图容器大小改变时,重新加载地图
mysql通过binlog恢复或回滚数据
Accessing private members using templates
Yyds dry goods inventory stringprep --- Internet string preparation
2022.04.23(LC_763_划分字母区间)
js获取本机ip地址
MVVM model
[报告] Microsoft :Application of deep learning methods in speech enhancement
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
MySQL statement
该买什么设备,Keysight 给你挑好了
SQL Server database in clause and exists clause conversion
Wechat video extraction and receiving file path
RPM包管理
MySQL学习第五弹——事务及其操作特性详解