flutter - Flutter Web:如何链接到网页上的特定行或段落
问题描述
如何获得在 Flutter web.xml 中引用页面特定部分(段落或选项卡)的能力。在传统的 Web url 中,这可以通过div
使用#
. 例如,在链接https://cloud.google.com/customers/featured/paypal#take-the-next-step
中,链接直接指向div
标记为take-the-next-step
有没有办法在 Flutter Web 中做到这一点?
解决方案
You can get the current URL and parse it for the parameter at the end of the URL. You can get the current URL with this code:
import 'dart:html';
var url = window.location.href;
Using the parameter that you have parsed, you can change the position on the page with your ScrollController
(or whatever method you're using to change page position) to the desired place on screen.
推荐阅读
- linux - 如何有一个通用函数来获取 BASH 中的当前目录和文件名?
- python - 检查用户角色的错误在哪里?
- rust - 如何为 Clap Args 使用内部库枚举
- c++ - 是否有在 C++ 中查找所需库的头文件的常见做法?
- assembly - 具有未声明转换的 UASM 不起作用
- node.js - 如何在模式验证功能中访问文档的其他属性值?
- assembly - 将 2 个变量传递给 NASM 32 位程序集中的函数
- python - 如何根据记录条件获取带有记录子集的数据框
- flutter - 如何让用户从 Flutter 应用程序下载/保存文件?
- pine-script - 是否有可能在松树中获得元组的第 n 个元素?