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 9 def widgets = ["ScrollView", "ListView", "GridView"] 10 if (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 15 widgets = ["HorizontalScrollView", "Gallery"] 16 if (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