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