是否可以更改Flutter项目的项目名称?项目名称是指您在创建flutter项目时提供的名称flutter create name.
我正在尝试在Card小部件中的一些文本和图标的顶部和底部添加一些填充.我发现flutter有一个简单的方法来为容器做这个,但似乎无法找到一种方法来与其他小部件(除了将它们包装在容器中).这是我到目前为止的代码:
body: new Container(
padding: new EdgeInsets.all(10.0),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget> [
new Card(
color: Colors.white70,
child: new Container(
padding: new EdgeInsets.all(10.0),
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget> [ //Padding between these please
new Text("I love Flutter", style: new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
new Icon(Icons.favorite, color: Colors.redAccent, size: 50.0)
]
)
)
)
]
)
)
Run Code Online (Sandbox Code Playgroud)
所以在我的列子中,我想在顶部和底部添加一些填充,而不必插入新的Container.这可能吗?
我正在尝试从Flutter中的不同小部件更改状态.例如,在以下示例中,我在几秒钟后设置状态.
这是代码:
class _MyAppState extends State<MyApp> {
int number = 1;
@override
void initState() {
super.initState();
new Future.delayed(new Duration(seconds: 5)).then((_) {
this.setState(() => number = 2);
print("Changed");
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Center(
child: new FlatButton(
color: Colors.blue,
child: new Text("Next Page"),
onPressed: () {
Navigator.of(context).push(new MaterialPageRoute(
builder: (BuildContext context) => new StatefulBuilder(builder: (BuildContext context, setState) =>new MySecondPage(number))
));
},
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用一个InheritedWidget,但除非我将它包装在我的顶级窗口小部件周围,否则这将无法工作,这对我正在尝试做的事情是不可行的(上面的代码是我想要实现的简化).
有关实现这一目标的最佳方法的任何想法都在Flutter中?
我已经用Cocoapods安装了FBSDK但由于某种原因无法在我的AppDelegate.swift文件中导入它.FBSDK工具包出现在我的Xcode项目中,所以我觉得它应该正常工作.

无论如何我都不是iOS开发人员,我只是想为Flutter SDK编写一个简单的原生插件.有人有想法吗?
- 这是pod文件的样子 -
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
if ENV['FLUTTER_FRAMEWORK_DIR'] == nil
abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework')
end
target 'Runner' do
use_frameworks!
# Pods for Runner
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
if File.exists? '../.flutter-plugins'
flutter_root = File.expand_path('..')
File.foreach('../.flutter-plugins') { |line|
plugin = line.split(pattern='=')
if plugin.length == 2
name = plugin[0].strip()
path = plugin[1].strip()
resolved_path …Run Code Online (Sandbox Code Playgroud) 我对如何使用SlideTransition感到困惑,特别是关于Position属性.Atm我有一个AnimationBuilder,我想在其中使用SlideTransition和AnimationController.我如何获得AnimationBuilder的孩子的位置?或者那不是必须传递给Position属性的东西?也许一个小例子会有所帮助!
我正在尝试HashMap在ListView.builder窗口小部件中显示我的值的内容.有没有办法做到这一点?有了一个List我可以简单地使用索引,但是如果HashMap没有使用索引,它将如何工作List?地图的键是字符串,值是与要显示的数据的地图.
我试着点击我的按钮然后检查结果后等待一段时间expect.我正在使用Future.delayed它.但那对我不起作用.我有一个超时错误.
TimeoutException after 0:00:05.000000: Test timed out after 5 seconds.
Run Code Online (Sandbox Code Playgroud)
这是我使用的代码:
... // other tests
await tester.tap(find.widgetWithText(GestureDetector, "ref size"));
await new Future.delayed(new Duration(milliseconds: 50));
expect(testContainerState.childWidth, 50.0);
Run Code Online (Sandbox Code Playgroud)
有没有人知道为什么会发生这种(imo)奇怪的行为?
我正在尝试创建一个滚动列表,该列表可以在滚动列表的底部具有页脚。如果列表没有填满所有垂直屏幕空间,则页脚将需要向下移动到页面底部。
我尝试使用SliverList和SliverFillRemaining在中实现这一点,CustomScrollView但SliverFillRemaining我相信显示了一些意外的行为。它填满了多余的空间(请参阅gif)。
我使用以下代码创建了此列表:
child: new CustomScrollView(
slivers: <Widget>[
new SliverList(
delegate: new SliverChildBuilderDelegate(
(BuildContext context, int index) {
return new Card(
child: new Container(
padding: new EdgeInsets.all(20.0),
child: new Center(child: new Text("Card $index")),
),
);
},
childCount: 3,
),
),
new SliverPadding(
padding: new EdgeInsets.all(5.0),
),
new SliverFillRemaining(
child: new Container(
color: Colors.red,
),
)
],
)
Run Code Online (Sandbox Code Playgroud)
我正在尝试在动画完成后执行一个操作。我尝试添加一个 statusListener 但这对我不起作用。我的代码如下所示:
@override
void initState() {
super.initState();
_controller = new AnimationController(
duration: new Duration(milliseconds: 500),
vsync: this,
)..addStatusListener((AnimationStatus status) {
print("Going");
if (status.index == 3 && spins > 0) { // AnimationStatus index 3 == completed animation
_controller.duration = new Duration(milliseconds: speed - 50);
_controller.forward(from: _controller.value == null ? 0.0 : 1 - _controller.value);
spins--;
print(speed);
}
});
}
Run Code Online (Sandbox Code Playgroud)
将print(Going);永远不会被执行,但我的动画不结束。出了什么问题?
/// - -编辑 - -///
我正在使用AnimatedBuilder,那部分代码如下所示:
child: new AnimatedBuilder(
animation: _controller,
child: new Image.network(widget.url),
builder: …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个滚动列表小部件,它显示一些项目,并能够在底部添加页脚滚动.
如果滚动列表没有占据整个高度,例如只有2个项目,页脚仍应出现在屏幕的底部.以下是我正在努力实现的一些草图
我尝试计算listview需要的垂直大小,但这意味着我需要知道构建时孩子的高度.有没有更好的办法?
编辑
我试图为达到同样的事情在这里但当然颤振.