• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Rule: NestedScrollingWidgets
2//
3// Description: Checks whether a scrolling widget has nested scrolling widgets.
4//
5// Conditions:
6// - The node is a scrolling widget
7// - The node has a descendant who is also a scrolling widget
8
9def widgets = ["ScrollView", "ListView", "GridView"]
10if (node.name() in widgets && node.all().any{ it.name() in widgets }) {
11    analysis << "The vertically scrolling ${node.name()} should not contain another " +
12            "vertically scrolling widget"
13}
14
15widgets = ["HorizontalScrollView", "Gallery"]
16if (node.name() in widgets && node.all().any{ it.name() in widgets }) {
17    analysis << "The horizontally scrolling ${node.name()} should not contain another " +
18            "horizontally scrolling widget"
19}
20