flutter - 动画切换器的内部小部件状态更改
问题描述
我现在正在使用 AnimatedSWitcher,它工作得很好但是如何更改 Animated Switcher 小部件内部的状态我的代码是这样的:
void initstate(){
_layout=first();
}
first(){
return InkWell(onTap:()
{
setState(()
{_layout=second();});
child:
Row(
children:[
Text("example"),
...(other widgets)
]);
second(){
return InkWell(onTap:()
{
setState(()
{_layout=first();});
child:
Row(
children:[
Text("second example"),
]);
@override
Widget build(BuildContext context) {
...,
AnimatedSwitcher(duration: const Duration(milliseconds: 300),
transitionBuilder:
(Widget child, Animation<double> animation) {
return ScaleTransition(child: child, scale: animation);
},
child: _layout,
),
}
在某处我有按钮来更改第一个布局中的文本,但是这个 setState 不起作用。我的问题是如何更改 AnimatedSwitcher 的文本内部小部件
解决方案
推荐阅读
- spring-boot - Java多数据Jdbc和R2dbc问题
- azure - Azure 市场映像中的虚拟机,带有错误的 terraform 脚本
- flutter - Flutter:如何使用钩子重建 UI 的特定部分?
- arrays - 为什么我的蛮力解决方案比优化的哈希表解决方案更快?
- javascript - 如何使用 if 语句根据 Laravel 中的选择下拉框更改输入类型值
- android - 如何使 RecyclerView 在 Android PopupWindow 中工作?
- windows - 用于识别桌面软件的独特元素是什么?
- ubuntu - Camunda平台tomcat服务器8080端口打开jenkins。以至于无法在我的 ubuntu 系统中运行 camunda 平台
- ios - “SFJHSFJ”团队没有帐号。在“帐户”首选项窗格中添加新帐户或验证您的帐户是否具有有效凭据
- typescript - 无法从 TypeScript 反射系统推断 GraphQL 类型。您需要为“地址”类的“id”提供显式类型