我嵌套了GestureDetetors 但问题是只有 childGestureDetector被onTap执行。我不想覆盖孩子的 onTap,而是希望父母和孩子的 onTap 都执行。这是我的代码:
GestureDetector(
onTap: () {
todo1();
},
child: GestureDetector(
onTap: () {
todo2();
},
child: Text("Nested Gesture")))
Run Code Online (Sandbox Code Playgroud)
如何更改它以同时调用onTaptodo1()和todo2()onTap?
编辑:子级是一个可重用的自定义小部件,它有自己的实现,但现在由父级使用,除了其子级之外,父级也有自己的实现
我尝试recyclerView.getLayoutManager().smoothScrollToPosition(recyclerView,null,0)仅在mDiffer.submitlist(list)完成“比较”并对列表更新/更改进行动画处理后才进行调用。
是否有 AsyncListDiffer 功能onAfterSubmitList(Callback callback)可以用来实现此目的?
如果没有,是否有办法找出何时submitList()完成其任务,以便我可以将其scrollToPosition(0)放在那里?
我试图@Query在我的@Dao接口中创建一个具有布尔参数的函数,isAsc以确定顺序:
@Query("SELECT * FROM Persons ORDER BY first_name (:isAsc ? ASC : DESC)")
List<Person> getPersonsAlphabetically(boolean isAsc);
Run Code Online (Sandbox Code Playgroud)
显然,这是不允许的。这附近有工作吗?
编辑:
使用两个查询(如下)似乎很奇怪,因为唯一的区别是ASC和DESC:
@Query("SELECT * FROM Persons ORDER BY last_name ASC")
List<Person> getPersonsSortByAscLastName();
@Query("SELECT * FROM Persons ORDER BY last_name DESC")
List<Person> getPersonsSortByDescLastName();
Run Code Online (Sandbox Code Playgroud) Can someone please clarify what is the meaning and usage of "..." in Flutter?
I wanted to learn about "triple dots" used in Flutter syntax. After some reading I found out that the word I was looking for was "spreading".
Widget _build() {
List<Widget> children = [
Text("first child"),
Text("second child"),
Text("third child"),
];
return Column(
children: <Widget>[
...children,
Text("fourth child"),
],
);
}
Run Code Online (Sandbox Code Playgroud)
If I didn't have the ... right before the children, it will give an error The …