@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
new Text("Some text"),
ListView()
],
);
}
Widget ListView() {
return ListView(
padding: EdgeInsets.symmetric(vertical: 8.0),
children: Item(),
);
}
List<Item> Item() {
return list
.map((item) => Item(text: item))
.toList();
}
class Item extends ListTile {
Item({String text, GestureTapCallback onTap})
: super(subtitle: Column(children: <Widget>[
Text(text),
]));
}
Run Code Online (Sandbox Code Playgroud)
屏幕上出现一个空白区域,控制台显示:
垂直视口被赋予无限高度.视口在滚动方向上展开以填充其容器.
我已经检查了有关如何通过命令找到当前Swift版本的问题swift --version
,但是如何将我的Swift版本从3.1升级到3.2?(因为Xcode 9只支持Swift 4.0和Swift 3.2)
要在Xcode 8和Xcode 9中成功构建,最好将Swift从3.1升级到3.2.但是怎么样?
我的目标是确保在Xcode 8和Xcode 9中都能成功构建,因此使用Xcode 8发布是可以的,并且尝试Xcode 9的功能也可以.因此,在Xcode 9.0官方版发布之前,我不会将代码升级到swift 4.0.
经过我的测试,我无法通过Xcode 8.3.3的'edit-> convert'功能将我的代码从swift 3.1转换为3.2.
我尝试将代码转换为Swift 3.2的原因是,如果我使用Xcode 9构建代码,我将得到"使用Swift 3.1编译的模块无法在Swift 4.0中导入"的错误.
我看到我的 flutter 项目生成了一个文件ios/Flutter/Flutter.podspec
,这个文件有什么用?
Flutter.framework
?s.ios.deployment_target='11.0'
,Flutter.framework
将使用 target 构建iOS 11
吗?我运行 flutter 的插件image_picker
示例。
当我从图库中一张一张地挑选图像时,内存不断增加。理想情况下,memory should jump back
因为它at most select one image
在这个示例应用程序中。
class _MyHomePageState extends State<MyHomePage> {
File _imageFile; <-- this one keep the file of selected image.
dynamic _pickImageError;
bool isVideo = false;
VideoPlayerController _controller;
String _retrieveDataError;
void _onImageButtonPressed(ImageSource source) async {
...
try {
_imageFile = await ImagePicker.pickImage(source: source); <--- how to set value
setState(() {});
} catch (e) {
_pickImageError = e;
}
...
}
@override
Widget build(BuildContext context) {
...
Image.file(_imageFile); …
Run Code Online (Sandbox Code Playgroud) 带Flutter的DevTools中的绿色大右箭头(->)是什么意思?
我想这与可交互区域有关,但我不确定。
该代码与Flutter中的代码相同,第二页位于第1页时无法单击。这是简化的代码:
PageController _controller = PageController(initialPage: 0, viewportFraction: 0.5);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.yellow,
child: PageView(
controller: _controller,
children: <Widget>[
Center(
child: FlatButton(
onPressed: () {},
color: Colors.red,
child: Text('First Tab'),
),
),
Center(
child: FlatButton(
onPressed: () {},
color: Colors.blue,
child: Text('Second Tab'),
),
),
Center(
child: FlatButton(
onPressed: () {},
color: Colors.green,
child: Text('Third Tab'),
),
),
],
),
);
}
Run Code Online (Sandbox Code Playgroud) BlocBuilder
的 flutter_bloc
是将页面的所有状态放在一起。
有一种情况,pulling a list
有 2 个数据 ( isPullingState
, dataList
),如何避免在dataList
未更改时构建 dataList 的小部件部分,但构建的小部件部分isPullingState
从true变为false?
BlocBuilderCondition
看起来只有在孔状态不变时才避免重建。
两个git commit具有相同的机会是什么 abbrev-commit
我看到git history默认显示git abbrev-commit是为了简化和美观。但是,两个相同的东西abbrev-commit
出现在一个git repo中的机会是什么?
因为我在 中做了一些更改Plugins/Path_Provider
,并且它仍在开发中。
我知道这是expect result
因为version conflict
forPath_Provider
有两个版本,一个 ingit
和一个 in pub host
。
但这仍然是开发时的情况。有没有best practice
针对这个特定期限的案例?
pubspec.yml
:
dependencies:
...
localstorage: ^2.0.0
path_provider: #^1.1.0
git:
url: https://github.com/xxxxxxxx/plugins
ref: dev/path_provider_add_getApplicationLibraryDirectory
path: packages/path_provider
version: ^1.1.0
Run Code Online (Sandbox Code Playgroud)
之后的控制台flutter packages get
:
[MyApp] flutter packages get
Running "flutter pub get" in MyApp...
Because localstorage 2.0.0 depends on path_provider ^1.1.0 and
no versions of localstorage match >2.0.0 <3.0.0,
localstorage ^2.0.0 requires path_provider from hosted.
So, because MyApp …
Run Code Online (Sandbox Code Playgroud) 通常,User-Defined
值将从项目设置继承为xcode-how-to-have-target-settings-inherit-from-project,
但我发现FLUTTER_BUILD_NAME
&FLUTTER_BUILD_NUMBER
并非如此。它们在Project
&Target
中的值是independent
。
是否有一些配置我应该更改以应用它们以被继承?
开发 flutter 时是否可以在 Visual Studio Code 中禁用设备开关?
我的条件是什么:
我打开了模拟器,调试了一段时间,编码了一段时间。
然后我需要插入手机来为手机充电。但vscode太聪明了,无法自动将设备切换到我的手机上。
然后当我调试时,我总是发现为什么现在构建速度很慢?发现现在正在我的手机上调试......
有办法解决这个问题吗?
PS:我电脑旁边的手机并不总是有 USB 电源。