Flutter 在Fluttter中导航到新小部件时,如何不处理以前的小部件?
我现在在做什么Flutter 在Fluttter中导航到新小部件时,如何不处理以前的小部件?,flutter,dart,Flutter,Dart,我现在在做什么 Navigator.push(context, RouteAnimationFadeIn(NewWidget(someValue), true)); RouteAnimationFadeIn: class RouteAnimationFadeIn extends PageRouteBuilder { final Widget widget; final bool shouldMaintainState; RouteAnimationFadeIn(thi
Navigator.push(context,
RouteAnimationFadeIn(NewWidget(someValue), true));
RouteAnimationFadeIn:
class RouteAnimationFadeIn extends PageRouteBuilder {
final Widget widget;
final bool shouldMaintainState;
RouteAnimationFadeIn(this.widget, this.shouldMaintainState)
: super(pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return widget;
}, transitionsBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
return FadeTransition(
opacity: animation,
child: child,
);
});
@override
bool get maintainState {
return shouldMaintainState;
}
}
类RouteAnimationFadeIn扩展了PageRouteBuilder{
最终小部件;
最终bool应保持状态;
RouteAnimationFadeIn(this.widget,this.shouldMaintainState)
:super(pageBuilder:(构建上下文、动画、,
动画(二级动画){
返回控件;
},transitionsBuilder:(BuildContext上下文,
动画,,
动画二级动画,
小部件(子部件){
返回衰减转换(
不透明度:动画,
孩子:孩子,
);
});
@凌驾
布尔状态{
返回shouldMaintainState;
}
}
这将处理前一个小部件,该小部件将处理其中所有表单字段的数据。我想要的是Android的一个片段添加式功能,这样新的小部件就可以在旧的小部件上打开,这样,当我使用Navigator.pop(context)时代码>我在其中看到了旧数据
我试过了,但没用。AutomaticEpaLiveClientMixin是最好的选择。您是如何实现的?AutomaticEpaLiveClientMixin是一个不错的选择。你是如何实施的?