- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我最近试图在 firebase fcm 中添加,但它没有工作,只是导致了几个错误,所以我将所有内容回滚到原始运行代码,但在此过程中升级了 flutter ...因为 v1.3.10 英雄不能包含其子层次结构中的另一个 Hero 小部件,但我找不到修复程序。 (理想情况下不想改回版本)
我检查了 heroTags,也找不到任何嵌套的 Hero 小部件 - 也许是因为动画构建器?
import 'package:flutter/material.dart';
import 'dart:math';
import 'package:vector_math/vector_math.dart' show radians, Vector3;
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import './Custom Icons/my_flutter_app_icons.dart' as CustomIcons;
import 'package:startoversword/liftPage.dart';
import 'package:startoversword/analWinkPage.dart';
import 'package:startoversword/lipPage.dart';
import 'package:startoversword/windscreenWiperPage.dart';
import 'package:startoversword/highHeelPage.dart';
import 'package:startoversword/rollerCoasterPage.dart';
import 'package:startoversword/notificationPage.dart';
import 'package:flutter/services.dart';
void main() async {
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Menu',
home: _placeMyAppScaffold(),
);
}
}
class _placeMyAppScaffold extends StatelessWidget {
Color defaultPink = Colors.white;
Color pageThemeColor = Color(0xffF599E9);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
body: SizedBox.expand(child: RadialMenu()),
appBar: AppBar(
actions: <Widget>[
FlatButton(
child: Icon(Icons.notifications, color: Colors.white, size: 50.0),
onPressed: () {
print("notification pressed");
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NotificationPage()));
},
),
],
title: Text('The S Word'),
backgroundColor: pageThemeColor,
));
}
}
class RadialMenu extends StatefulWidget {
createState() => _RadialMenuState();
}
class _RadialMenuState extends State<RadialMenu>
with SingleTickerProviderStateMixin {
AnimationController controller;
@override
void initState() {
super.initState();
controller =
AnimationController(duration: Duration(milliseconds: 900), vsync: this);
}
@override
Widget build(BuildContext context) {
return RadialAnimation(controller: controller);
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
}
class RadialAnimation extends StatelessWidget {
RadialAnimation({Key key, this.controller})
: translation = Tween<double>(
begin: 0.0,
end: 100.0,
).animate(
CurvedAnimation(parent: controller, curve: Curves.elasticOut),
),
scale = Tween<double>(
begin: 1.5,
end: 0.0,
).animate(
CurvedAnimation(parent: controller, curve: Curves.fastOutSlowIn),
),
rotation = Tween<double>(
begin: 0.0,
end: 360.0,
).animate(
CurvedAnimation(
parent: controller,
curve: Interval(
0.0,
0.7,
curve: Curves.decelerate,
),
),
),
super(key: key);
final AnimationController controller;
final Animation<double> rotation;
final Animation<double> translation;
final Animation<double> scale;
@override
Widget build(BuildContext context) {
Color defaultPink = Color(0xffF599E9);
return AnimatedBuilder(
animation: controller,
builder: (context, widget) {
return Transform.rotate(
angle: radians(rotation.value),
child: Stack(alignment: Alignment.center, children: <Widget>[
Hero(
tag: "liftScreenButton",
child: Container(
child: _buildButton(
30,
color: Color(0xfff665c6),
icon: CustomIcons.YoniFonts.lift,
context: context,
nextScreen: 'LiftScreen',
),
),
),
Hero(
tag: "winkScreenButton",
child: Container(
child: _buildButton(
90,
color: Color(0xffe654be),
icon: CustomIcons.YoniFonts.dot_circled,
context: context,
nextScreen: 'winkScreen',
),
),
),
Hero(
tag: "lipScreenButton",
child: Container(
child: _buildButton(
150,
color: Color(0xffd643b7),
icon: CustomIcons.YoniFonts.lips,
context: context,
nextScreen: 'lipScreen',
),
),
),
Hero(
tag: "windscreenWiperScreenButton",
child: Container(
child: _buildButton(
210,
color: Color(0xffc632b0),
icon: CustomIcons.YoniFonts.car,
context: context,
nextScreen: 'WindscreenWiperScreen',
),
),
),
Hero(
tag: "highHeelScreenButton",
child: Container(
child: _buildButton(
270,
color: Color(0xffb621a9),
icon: CustomIcons.YoniFonts.high_heels,
context: context,
nextScreen: 'HighHeelScreen',
),
),
),
Hero(
tag: "rollerCoasterScreenButton",
child: Container(
child: _buildButton(
330,
color: Color(0xffa711a2),
icon: CustomIcons.YoniFonts.roller_coaster,
context: context,
nextScreen: 'rollerCoasterScreen',
),
),
),
Transform.scale(
scale: scale.value - 1,
child: FloatingActionButton(
child: Icon(CustomIcons.YoniFonts.upsideDownYoni),
heroTag: "upsideDownYoni",
onPressed: _close,
backgroundColor: defaultPink),
),
Transform.scale(
scale: scale.value,
child: FloatingActionButton(
heroTag: "initalYoni",
child: Icon(CustomIcons.YoniFonts.yoni),
onPressed: _open,
backgroundColor: defaultPink,
),
)
]));
});
}
_open() {
controller.forward();
}
_close({context, String nextScreen}) {
controller.reverse();
if (nextScreen == 'LiftScreen') {
print("NEXT SCREEN IS LIFTPAGE");
Navigator.push(
context, MaterialPageRoute(builder: (context) => LiftPage()));
} else if (nextScreen == "winkScreen") {
print("NEXT SCREEN IS WINKPAGE");
Navigator.push(
context, MaterialPageRoute(builder: (context) => WinkPage()));
} else if (nextScreen == "lipScreen") {
print("NEXT SCREEN IS LIP PAGE");
Navigator.push(
context, MaterialPageRoute(builder: (context) => LipPage()));
} else if (nextScreen == "WindscreenWiperScreen") {
print("NEXT SCREEN IS WINDSCREENWIPERPAGE");
Navigator.push(context,
MaterialPageRoute(builder: (context) => WindScreenWiperPage()));
} else if (nextScreen == "HighHeelScreen") {
print("NEXT SCREEN IS HIGHHEELPAGE");
Navigator.push(
context, MaterialPageRoute(builder: (context) => HighHeelPage()));
} else if (nextScreen == "rollerCoasterScreen") {
print("NEXT SCREEN IS ROLLERCOASTERPAGE");
Navigator.push(context,
MaterialPageRoute(builder: (context) => RollerCoasterPage()));
} else {
return;
}
;
}
_buildButton(double angle,
{Color color, IconData icon, context, String nextScreen}) {
final double rad = radians(angle);
return Transform(
transform: Matrix4.identity()
..translate(
(translation.value) * cos(rad), (translation.value) * sin(rad)),
child: FloatingActionButton(
child: Icon(icon),
heroTag: nextScreen,
backgroundColor: color,
onPressed: () => _close(context: context, nextScreen: nextScreen),
elevation: 0));
}
}
错误信息指向
_buildButton(double angle,
{Color color, IconData icon, context, String nextScreen}) {
final double rad = radians(angle);
return Transform(
transform: Matrix4.identity()
..translate(
(translation.value) * cos(rad), (translation.value) * sin(rad)),
child: FloatingActionButton(
child: Icon(icon),
heroTag: nextScreen, //error here
backgroundColor: color,
onPressed: () => _close(context: context, nextScreen: nextScreen),
elevation: 0));
}
}
感兴趣的是这里的完整输出
I/flutter (20678): #431 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter (20678): #432 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter (20678): #433 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter (20678): #434 RenderObjectToWidgetElement._rebuild
package:flutter/…/widgets/binding.dart:940
I/flutter (20678): #435 RenderObjectToWidgetElement.mount
package:flutter/…/widgets/binding.dart:911
I/flutter (20678): #436 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
package:flutter/…/widgets/binding.dart:857
I/flutter (20678): #437 BuildOwner.buildScope
package:flutter/…/widgets/framework.dart:2320
I/flutter (20678): #438 RenderObjectToWidgetAdapter.attachToRenderTree
package:flutter/…/widgets/binding.dart:856
I/flutter (20678): #439 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget
package:flutter/…/widgets/binding.dart:737
I/flutter (20678): #440 runApp
package:flutter/…/widgets/binding.dart:787
I/flutter (20678): #441 main
package:startoversword/main.dart:21
I/flutter (20678): #452 SystemChrome.setPreferredOrientations (package:flutter/src/services/system_chrome.dart)
I/flutter (20678): #463 OptionalMethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart)
I/flutter (20678): #474 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart)
I/flutter (20678): (elided 46 frames from class _AssertionError, package dart:async, and package dart:async-patch)
I/flutter (20678):
I/flutter (20678): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (20678): Another exception was thrown: A Hero widget cannot be the descendant of another Hero widget.
I/chatty (20678): uid=10088(com.oxspines.talkingsword) 1.ui identical 3 lines
I/flutter (20678): Another exception was thrown: A Hero widget cannot be the descendant of another Hero widget.
I/OpenGLRenderer(20678): Davey! duration=865ms; Flags=0, IntendedVsync=76957734745126, Vsync=76957768078458, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=76957769369260, AnimationStart=76957769756360, PerformTraversalsStart=76957774959760, DrawStart=76957778308860, SyncQueued=76957778894960, SyncStart=76957788359860, IssueDrawCommandsStart=76957793180660, SwapBuffers=76957809783260, FrameCompleted=76958609467060, DequeueBufferDuration=116998000, QueueBufferDuration=12148000,
I/Choreographer(20678): Skipped 57 frames! The application may be doing too much work on its main thread.
I/OpenGLRenderer(20678): Davey! duration=1061ms; Flags=0, IntendedVsync=76957801411790, Vsync=76958751411752, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=76958769243160, AnimationStart=76958772853660, PerformTraversalsStart=76958779455160, DrawStart=76958795072260, SyncQueued=76958796183260, SyncStart=76958889098460, IssueDrawCommandsStart=76958889855560, SwapBuffers=76958893194360, FrameCompleted=76958955694360, DequeueBufferDuration=35517000, QueueBufferDuration=4901000,
最佳答案
那是因为 FloatingActionButton 已经有一个 Hero 小部件包装它(查看其源代码)。在您的代码中,您将 FAB 嵌入到另一个 Hero 小部件中。
要修复它,您只需将 FAB 中的“heroTag”属性设置为“null”,或者删除围绕该 FAB 的包装 Hero 小部件,只保留默认的。
关于flutter - 版本更改后,Hero 小部件不能是另一个 Hero 小部件的后代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57075921/
SO亲爱的 friend 们: 2014 年 3 月 18 日。我正在处理一种情况,在使用 ng-repeat 时,数组内的元素(我从 Json 字符串中获取)更改了原始顺序。 需要明确的是,数组中的
有很多问题询问如何在 JavaScript 单击处理程序中更改 div 的类,例如,此处:Change Div style onclick .我理解得很好(只需更改 .className),并且它有效
我从access导入了一个数据库到mysql,但其中一个表的列名“股数”带有空格,但我尝试更改、替换甚至删除列名,但失败了。任何人都可以帮助解决这一问题 String UpdateQuary = "U
我正在做一个随机的学校元素。 目前,我有一个包含两个 CSS 的页面。一种用于正常 View ,一种用于残障人士 View 。 此页面还包括两个按钮,它们将更改使用的样式表。 function c
我需要使用 javascript 更改 HTML 元素中的文本,但我不知道该怎么做。 ¿有什么帮助吗? 我把它定义成这样: Text I want to change. 我正在尝试这样做: docum
我在它自己的文件 nav_bar.shtml 中有一个主导航栏,每个其他页面都包含该导航栏。这个菜单栏是一个 jQuery 菜单栏(ApyCom 是销售这些导航栏的公司的名称)。导航栏上的元素如何确定
我正在摆弄我的代码,并开始想知道这个变化是否来自: if(array[index] == 0) 对此: if(!array[index] != 0) 可能会影响任何代码,或者它只是做同样的事情而我不需
我一直在想办法调整控制台窗口的大小。这是我正在使用的函数的代码: #include #include #define WIDTH 70 #define HEIGHT 35 HANDLE wHnd;
我有很多情况会导致相同的消息框警报。 有没有比做几个 if 语句更简单/更好的解决方案? PRODUCTS BOX1 BOX2 BOX3
我有一个包含这些元素的 XELEMENT B Bob Petier 19310227 1 我想像这样转换前缀。 B Bob Pet
我使用 MySQL 5.6 遇到了这种情况: 此查询有效并返回预期结果: select * from some_table where a = 'b' and metadata->>"$.countr
我想知道是否有人知道可以检测 R 中日期列格式的任何中断的包或函数,即检测日期向量格式更改的位置,例如: 11/2/90 12/2/90 . . . 15/Feb/1990 16/Feb/1990 .
我希望能够在小部件显示后更改 GtkButton 的标签 char *ButtonStance == "Connect"; GtkWidget *EntryButton = gtk_button_ne
我正在使用 Altera DE2 FPGA 开发板并尝试使用 SD 卡端口和音频线路输出。我正在使用 VHDL 和 C 进行编程,但由于缺乏经验/知识,我在 C 部分遇到了困难。 目前,我可以从 SD
注意到这个链接后: http://www.newscientist.com/blogs/nstv/2010/12/best-videos-of-2010-progress-bar-illusion.h
我想知道在某些情况下,即使剧本任务已成功执行并且 ok=2,ansible 也会显示“changed=0”。使用 Rest API 和 uri 模块时会发生这种情况。我试图找到解释但没有成功。谁能告诉
这个问题已经有答案了: 已关闭12 年前。 Possible Duplicate: add buttons to push notification alert 是否可以在远程通知显示的警报框中指定有
当您的 TabBarController 中有超过 5 个 View Controller 时,系统会自动为您设置一个“更多” View 。是否可以更改此 View 中导航栏的颜色以匹配我正在使用的颜
如何更改.AndroidStudioBeta文件夹的位置,默认情况下,该文件夹位于Windows中的\ .. \ User \ .AndroidStudioBeta,而不会破坏任何内容? /编辑: 找
我目前正在尝试将更具功能性的编程风格应用于涉及低级(基于 LWJGL)GUI 开发的项目。显然,在这种情况下,需要携带很多状态,这在当前版本中是可变的。我的目标是最终拥有一个完全不可变的状态,以避免状
我是一名优秀的程序员,十分优秀!