我必须将堆栈中的小部件移动(屏幕大小 - 我可以从密钥获取的小部件 A 的大小)。这两个值仅在构建后才可用,但据我所知,我应该在 initState 中初始化我的动画。有没有办法在构建完成后初始化我的补间动画?
我读过一些关于在 Android 中使用 MVP 模式的文章。对我来说最好的方法是创建合同(每个模型、视图和演示者一个界面)。问题是我是否应该为每个 Activity 创建这样的合同,或者如果我的应用程序中有几个 Activity,如何实现它。谢谢
我有以下需要 unpressedImage 字段的类。如果未指定pressedImage,我需要将unpressedImage 值设置为pressedImage 字段。我怎样才能以最好的方式实现这一目标?
class ImageButton extends StatefulWidget {
final Image unpressedImage;
final Image pressedImage;
final onTap;
const ImageButton({
Key key,
@required this.unpressedImage,
this.pressedImage,
this.onTap,
}) : super(key: key);
@override
_ImageButtonState createState() => _ImageButtonState();
}
Run Code Online (Sandbox Code Playgroud)