在我的Flutter移动应用中,通过加载用户的个人资料图片时NetworkImage(),我得到403状态码作为响应。
在403状态代码或图片URL损坏等情况下,如何显示资产文件夹中的图片,该如何处理?
目前,我已经通过向HTTP GET图片网址发送请求并检查状态码是否为200来处理该问题。如果是200,则使用NetworkImage()或AssetImage()加载图像并使用FutureBuilder()来构建Widget。
虽然这很完美,但我觉得处理这么小的情况会遇到很多麻烦,并且可以通过我不知道的更好方法来完成。
处理此类情况的最佳方法是什么?
我正进入(状态
错误在 '...","tarball":"https://' 附近解析时出现意外的 JSON 输入结尾
当我跑 npm install
下面是我的package.json文件:
{
"name": "gateway",
"version": "0.0.0",
"description": "Description for gateway",
"private": true,
"license": "UNLICENSED",
"cacheDirectories": [
"node_modules"
],
"dependencies": {
"@angular/common": "7.2.4",
"@angular/compiler": "7.2.4",
"@angular/core": "7.2.4",
"@angular/forms": "7.2.4",
"@angular/platform-browser": "7.2.4",
"@angular/platform-browser-dynamic": "7.2.4",
"@angular/router": "7.2.4",
"@fortawesome/angular-fontawesome": "0.3.0",
"@fortawesome/fontawesome-svg-core": "1.2.14",
"@fortawesome/free-solid-svg-icons": "5.7.1",
"@ng-bootstrap/ng-bootstrap": "4.0.2",
"@ngx-translate/core": "11.0.1",
"@ngx-translate/http-loader": "4.0.0",
"bootstrap": "4.2.1",
"core-js": "2.6.4",
"moment": "2.24.0",
"ng-jhipster": "0.9.1",
"ngx-cookie": "2.0.1",
"ngx-infinite-scroll": "7.0.1",
"ngx-webstorage": "2.0.1",
"rxjs": "6.4.0",
"swagger-ui": "2.2.10",
"tslib": "1.9.3",
"zone.js": "0.8.29"
}, …Run Code Online (Sandbox Code Playgroud) 我有一个按钮,点击我调用下面的函数,它在下面创建一个底部。发生的事情是它根据列表数组值构建一个卡片列表。然后我想根据 onTap 手势更新其值的卡片之一。我注意到它检测到手势但没有更新它的值。最重要的是,我有一个全局变量定义为
String _localPNumberSelected="";
Run Code Online (Sandbox Code Playgroud)
在 onTap 我调用 setState
setState(() {
_localPNumberSelected=vList[index]["pNumber"].toString();
});
Run Code Online (Sandbox Code Playgroud)
但这不会更新
children: [
new Text('$_localPNumberSelected'),
],
Run Code Online (Sandbox Code Playgroud)
这是完整的代码。
void _callQuickListModalBottomSheet(context){
Future<void> future = showModalBottomSheet<void>(
context: context,
builder: (BuildContext bc){
return Container(
height: 280,
margin: new EdgeInsets.fromLTRB(200, 0, 10, 0),
child : new Container(
decoration: new BoxDecoration(
color: Color.fromRGBO(36, 46, 66, 1),
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(20),
topRight: const Radius.circular(20)
),
),
child: new Column(
children: <Widget>[
new Container(
margin: new EdgeInsets.fromLTRB(10, 10, 10, 0),
height:45,
child: new …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Angular Material进行拖放,如在列表之间转移项目所示。
我正在尝试示例中显示的完全相同的代码,但在控制台中收到此错误:
未捕获的错误:模板解析错误:没有将“ exportAs”设置为“ cdkDropList”的指令
下面是我的代码,与链接中显示的代码相同,无论如何我都在共享:
TS:
import {Component} from '@angular/core';
import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop';
/**
* @title Drag&Drop connected sorting
*/
@Component({
selector: 'cdk-drag-drop-connected-sorting-example',
templateUrl: 'cdk-drag-drop-connected-sorting-example.html',
styleUrls: ['cdk-drag-drop-connected-sorting-example.css'],
})
export class CdkDragDropConnectedSortingExample {
todo = [
'Get to work',
'Pick up groceries',
'Go home',
'Fall asleep'
];
done = [
'Get up',
'Brush teeth',
'Take a shower',
'Check e-mail',
'Walk dog'
];
drop(event: CdkDragDrop<string[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
} …Run Code Online (Sandbox Code Playgroud) In my intent I am expecting the user to provide his/her email address.
I tried using @sys.email entity to identify the email from training phrases, but it is not identifying the email address.
What could be the issue ? When I searched the web I saw similar question being asked in some Google Groups, but could not find the answer.
EDIT:
Here is a screenshot the intent page showing Training Phrases and Actions and Parameter:
Other than the email's in …