我想退出我的应用程序。我已经实现了一个 WillPopScope,但看起来根本没有调用 onWillPop 函数。我尝试了很多想法,例如将 WillPopScope 与 Scaffold 交换,更改函数的返回值,但看起来它没有按预期工作。
我的代码:
Run Code Online (Sandbox Code Playgroud)Future<bool> _willPopCallback() async { exit(0); // await showDialog or Show add banners or whatever // then return true; // return true if the route to be popped } return Scaffold( appBar: MyAppBar( leading: DrawerAction(), title: Text(AppLocalizations.of(context).textCapitalized('home_page')), onSearch: (searchTerms) => this.search(searchTerms, context), ), body: new WillPopScope( onWillPop: _willPopCallback, // Empty Function. child: //my screen widgets
我不确定这是否是我应该向 flutter 报告的错误,或者我做错了什么。很高兴根据要求提供更多代码。
我试过了:
exit(0);
Navigator.of(context).pop();
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
Run Code Online (Sandbox Code Playgroud)
提前致谢!
如果我有:
<div class="test" data-name="Paul" >
Run Code Online (Sandbox Code Playgroud)
和
var name = "Paul";
Run Code Online (Sandbox Code Playgroud)
我可以document.querySelector用来做这样的事情吗?
document.querySelector("[data-name=name]");
Run Code Online (Sandbox Code Playgroud)
这不起作用.我需要做什么?
我正在将 .NET Framework 应用程序移植到 .NET Core。我已经通过 NuGet System.ServiceModel.Web 添加,但它似乎不起作用。我需要“WebGet”的替代方案:
[ServiceContract]
public interface IChannelsApi
{
[WebGet(UriTemplate = "", ResponseFormat = WebMessageFormat.Json), OperationContract]
List<Channel> GetChannels();
[WebGet(UriTemplate = "{name}", ResponseFormat = WebMessageFormat.Json), OperationContract]
Channel GetChannel(string name);
}
Run Code Online (Sandbox Code Playgroud)
我必须做什么?
如果我有那个字符串:`
document.querySelectorAll("[data-name=" + CSS.escape(variable) + "]","[class='nameclass']");
Run Code Online (Sandbox Code Playgroud)
它采用具有第一个属性的所有元素和具有第二个属性的所有元素.
我如何只采取每个属性的元素?