Unverified Commit 80849ade authored by Phil Quitslund's avatar Phil Quitslund Committed by GitHub

[dev, bots, examples] rename local functions with `_`s (#102703)

parent 6a443138
......@@ -16,7 +16,7 @@ void main() {
body: (WidgetController controller) async {
final Finder nestedScroll = find.byKey(const ValueKey<String>('tabbar_view'));
expect(nestedScroll, findsOneWidget);
Future<void> _scrollOnce(double offset) async {
Future<void> scrollOnce(double offset) async {
await controller.timedDrag(
nestedScroll,
Offset(-offset, 0.0),
......@@ -25,10 +25,10 @@ void main() {
await Future<void>.delayed(const Duration(milliseconds: 500));
}
for (int i = 0; i < 3; i += 1) {
await _scrollOnce(-300.0);
await _scrollOnce(-300.0);
await _scrollOnce(300.0);
await _scrollOnce(300.0);
await scrollOnce(-300.0);
await scrollOnce(-300.0);
await scrollOnce(300.0);
await scrollOnce(300.0);
}
},
);
......
......@@ -14,7 +14,7 @@ void main() {
pageDelay: const Duration(seconds: 1),
driverOps: (FlutterDriver driver) async {
final SerializableFinder tabBarView = find.byValueKey('tabbar_view_complexity');
Future<void> _scrollOnce(double offset) async {
Future<void> scrollOnce(double offset) async {
// Technically it's not scrolling but moving
await driver.scroll(tabBarView, offset, 0.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
......@@ -22,8 +22,8 @@ void main() {
// When we eventually add more test panes we will want to tweak these
// to go through all the panes
for (int i = 0; i < 6; i += 1) {
await _scrollOnce(-300.0);
await _scrollOnce(300.0);
await scrollOnce(-300.0);
await scrollOnce(300.0);
}
},
);
......
......@@ -14,16 +14,16 @@ void main() {
pageDelay: const Duration(seconds: 1),
driverOps: (FlutterDriver driver) async {
final SerializableFinder tabBarView = find.byValueKey('tabbar_view');
Future<void> _scrollOnce(double offset) async {
Future<void> scrollOnce(double offset) async {
// Technically it's not scrolling but moving
await driver.scroll(tabBarView, offset, 0.0, const Duration(milliseconds: 300));
await Future<void>.delayed(const Duration(milliseconds: 500));
}
for (int i = 0; i < 3; i += 1) {
await _scrollOnce(-300.0);
await _scrollOnce(-300.0);
await _scrollOnce(300.0);
await _scrollOnce(300.0);
await scrollOnce(-300.0);
await scrollOnce(-300.0);
await scrollOnce(300.0);
await scrollOnce(300.0);
}
},
);
......
......@@ -15,7 +15,7 @@ void main() {
assert(false, "Don't run benchmarks in checked mode! Use 'flutter run --release'.");
print('MatrixUtils.transformRect and .transformPoint benchmark...');
Matrix4 _makePerspective(double radius, double angle, double perspective) {
Matrix4 makePerspective(double radius, double angle, double perspective) {
return MatrixUtils.createCylindricalProjectionTransform(
radius: radius,
angle: angle,
......@@ -29,9 +29,9 @@ void main() {
Matrix4.identity()..scale(1.2, 1.3, 1.0)..translate(12.0, 13.0, 10.0),
];
final List<Matrix4> perspectiveTransforms = <Matrix4>[
_makePerspective(10.0, math.pi / 8.0, 0.3),
_makePerspective( 8.0, math.pi / 8.0, 0.2),
_makePerspective( 1.0, math.pi / 4.0, 0.1)..rotateX(0.1),
makePerspective(10.0, math.pi / 8.0, 0.3),
makePerspective( 8.0, math.pi / 8.0, 0.2),
makePerspective( 1.0, math.pi / 4.0, 0.1)..rotateX(0.1),
];
final List<Rect> rectangles = <Rect>[
const Rect.fromLTRB(1.1, 1.2, 1.5, 1.8),
......
......@@ -822,21 +822,21 @@ Future<void> verifyNoRuntimeTypeInToString(String workingDirectory) async {
for (int index = 0; index < lines.length; index++) {
if (toStringRegExp.hasMatch(lines[index])) {
final int sourceLine = index + 1;
bool _checkForRuntimeType(String line) {
bool checkForRuntimeType(String line) {
if (line.contains(r'$runtimeType') || line.contains('runtimeType.toString()')) {
problems.add('${file.path}:$sourceLine}: toString calls runtimeType.toString');
return true;
}
return false;
}
if (_checkForRuntimeType(lines[index])) {
if (checkForRuntimeType(lines[index])) {
continue;
}
if (lines[index].contains('=>')) {
while (!lines[index].contains(';')) {
index++;
assert(index < lines.length, 'Source file $file has unterminated toString method.');
if (_checkForRuntimeType(lines[index])) {
if (checkForRuntimeType(lines[index])) {
break;
}
}
......@@ -845,7 +845,7 @@ Future<void> verifyNoRuntimeTypeInToString(String workingDirectory) async {
while (!lines[index].contains('}') && openBraceCount > 0) {
index++;
assert(index < lines.length, 'Source file $file has unbalanced braces in a toString method.');
if (_checkForRuntimeType(lines[index])) {
if (checkForRuntimeType(lines[index])) {
break;
}
openBraceCount += '{'.allMatches(lines[index]).length;
......
......@@ -300,15 +300,15 @@ class _AllSectionsView extends AnimatedWidget {
1.0 - ((size.height - minHeight!) /
(midHeight! - minHeight!)).clamp(0.0, 1.0);
double _indicatorOpacity(int index) {
double indicatorOpacity(int index) {
return 1.0 - _selectedIndexDelta(index) * 0.5;
}
double _titleOpacity(int index) {
double titleOpacity(int index) {
return 1.0 - _selectedIndexDelta(index) * tColumnToRow * 0.5;
}
double _titleScale(int index) {
double titleScale(int index) {
return 1.0 - _selectedIndexDelta(index) * tColumnToRow * 0.15;
}
......@@ -320,8 +320,8 @@ class _AllSectionsView extends AnimatedWidget {
id: 'title$index',
child: SectionTitle(
section: section,
scale: _titleScale(index),
opacity: _titleOpacity(index),
scale: titleScale(index),
opacity: titleOpacity(index),
),
));
}
......@@ -330,7 +330,7 @@ class _AllSectionsView extends AnimatedWidget {
children.add(LayoutId(
id: 'indicator$index',
child: SectionIndicator(
opacity: _indicatorOpacity(index),
opacity: indicatorOpacity(index),
),
));
}
......
......@@ -40,7 +40,7 @@ class _ReorderableExampleState extends State<ReorderableExample> {
final Color evenItemColor = colorScheme.secondary.withOpacity(0.15);
final Color draggableItemColor = colorScheme.secondary;
Widget _proxyDecorator(Widget child, int index, Animation<double> animation) {
Widget proxyDecorator(Widget child, int index, Animation<double> animation) {
return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget? child) {
......@@ -59,7 +59,7 @@ class _ReorderableExampleState extends State<ReorderableExample> {
return ReorderableListView(
padding: const EdgeInsets.symmetric(horizontal: 40),
proxyDecorator: _proxyDecorator,
proxyDecorator: proxyDecorator,
children: <Widget>[
for (int index = 0; index < _items.length; index += 1)
ListTile(
......
......@@ -7,7 +7,7 @@ import 'package:flutter_api_samples/cupertino/slider/cupertino_slider.0.dart' as
import 'package:flutter_test/flutter_test.dart';
void main() {
Future<void> _dragSlider(WidgetTester tester, Key sliderKey) {
Future<void> dragSlider(WidgetTester tester, Key sliderKey) {
final Offset topLeft = tester.getTopLeft(find.byKey(sliderKey));
const double unit = CupertinoThumbPainter.radius;
const double delta = 3.0 * unit;
......@@ -22,7 +22,7 @@ void main() {
// Check for the initial slider value.
expect(find.text('0.0'), findsOneWidget);
await _dragSlider(tester, const Key('slider'));
await dragSlider(tester, const Key('slider'));
await tester.pumpAndSettle();
// Check for the updated slider value.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment