我正在尝试在“列”窗口小部件内扩展窗口小部件,但无法使其扩展。
当给父窗口部件恒定的高度时,布局将按预期呈现。但是,由于我删除了恒定高度的布局,并没有达到我想要的Listview的预期,因此我不应该为将用作Listview项的小部件提供恒定的高度。
下面是我的布局代码。
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: 'layout test',
home: Layout_test_class(),
));
}
class Layout_test_class extends StatelessWidget {
Widget cell() {
return Container(
color: Colors.yellow,
// height: 200, after un commenting this will work. but i want to make it without this
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: Container(
color: Colors.green,
child: Text('apple z'),
),
),
Container(
color: Colors.red,
child:Text('apple 2'),
)
],
), …
Run Code Online (Sandbox Code Playgroud) 我拥有帐户的管理员角色,并且能够在 App Store Connect 网站中查看团队,但使用同一帐户无法在developer.apple.com 上查看相同的内容。不明白这里出了什么问题。
更新:从developer.apple.com添加用户,重定向到appstore连接。这意味着现在developer.apple.com用户和app store connect用户之间没有区别。
我已经用网络图像创建了一个列表视图,当我尝试滚动列表视图时,它的滚动不平滑,感觉就像在抽动一样。对于缓存,我使用了cached_network_image:any,该库本身运行良好,但listview滚动不顺畅。
我知道我们可以使用Future小部件来实现此目的,但是不知道如何在将来返回缓存的图像。
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
void main() {
runApp(
MaterialApp(
title: 'List view with network images',
home: ListViewController(),
)
);
}
class ListViewController extends StatelessWidget {
var imagesArray = [
"http://iastro.shangcarts.com/pub/media/notice/File-1550484786.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1550218043.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1550217808.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1550111913.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1550108862.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1550024618.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1550022739.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1549935759.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1549935073.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1549850545.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1549849978.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1549008412.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1548985261.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1548821873.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1548731040.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1548641672.jpeg",
"http://iastro.shangcarts.com/pub/media/notice/File-1548410089.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547774905.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547701178.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547625318.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547624883.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547619153.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547606341.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547606200.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547603338.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547602464.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547454842.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547192524.jpg",
"http://iastro.shangcarts.com/pub/media/notice/File-1547191374.jpg"
];
Widget _imageCell(String imageUrl) {
return ListTile(
leading: CachedNetworkImage(imageUrl: imageUrl, placeholder: CircularProgressIndicator(), errorWidget: Icon(Icons.error),),
);
}
@override
Widget build(BuildContext context) …
Run Code Online (Sandbox Code Playgroud) 在尝试将任何字符串分配给类级变量时,我总是变为nil.
以下是我的控制台输出:
// test = nil
// Demo.test = nil
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
Demo.test = "app"
print("Demo.test = \(Demo.test)")
}
}
class Demo {
class var test: String? {
set {
UserDefaults.standard.set(test, forKey: "test")
print("test = \(test)")
}
get {
return UserDefaults.standard.string(forKey: "test")
}
}
}
Run Code Online (Sandbox Code Playgroud)