Remove custom `analysis_options.yaml` from `imitation_game_flutter` (#184717)
The default `analysis_options.yaml` file created by `flutter create` was
accidentally checked in for `imitation_game_flutter`. This was probably
a mistake and the top-level analysis_options rules should apply for this
package as well.
This PR also removes a duplicated `MaterialApp` widget that Gemini
found.
diff --git a/dev/benchmarks/imitation_game_flutter/analysis_options.yaml b/dev/benchmarks/imitation_game_flutter/analysis_options.yaml
deleted file mode 100644
index 0d29021..0000000
--- a/dev/benchmarks/imitation_game_flutter/analysis_options.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-# This file configures the analyzer, which statically analyzes Dart code to
-# check for errors, warnings, and lints.
-#
-# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
-# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
-# invoked from the command line by running `flutter analyze`.
-
-# The following line activates a set of recommended lints for Flutter apps,
-# packages, and plugins designed to encourage good coding practices.
-include: package:flutter_lints/flutter.yaml
-
-linter:
- # The lint rules applied to this project can be customized in the
- # section below to disable rules from the `package:flutter_lints/flutter.yaml`
- # included above or to enable additional rules. A list of all available lints
- # and their documentation is published at https://dart.dev/lints.
- #
- # Instead of disabling a lint rule for the entire project in the
- # section below, it can also be suppressed for a single line of code
- # or a specific dart file by using the `// ignore: name_of_lint` and
- # `// ignore_for_file: name_of_lint` syntax on the line or in the file
- # producing the lint.
- rules:
- # avoid_print: false # Uncomment to disable the `avoid_print` rule
- # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
-
-# Additional information about this file can be found at
-# https://dart.dev/guides/language/analysis-options
diff --git a/dev/benchmarks/imitation_game_flutter/lib/main.dart b/dev/benchmarks/imitation_game_flutter/lib/main.dart
index 706f93c..1b2966a 100644
--- a/dev/benchmarks/imitation_game_flutter/lib/main.dart
+++ b/dev/benchmarks/imitation_game_flutter/lib/main.dart
@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
void main() {
- runApp(InfiniteScrollApp());
+ runApp(const InfiniteScrollApp());
}
class InfiniteScrollApp extends StatelessWidget {
@@ -15,7 +15,10 @@
Widget build(BuildContext context) {
return MaterialApp(
title: 'Infinite Scrolling Flutter',
- home: InfiniteScrollList(),
+ home: Scaffold(
+ appBar: AppBar(title: const Text('Infinite Scrolling ListView (Static Data)')),
+ body: const InfiniteScrollList(),
+ ),
);
}
}
@@ -31,11 +34,11 @@
final List<String> items = [];
final int itemsPerPage = 20;
final List<String> staticData = [
- "Hello Flutter",
- "Hello Flutter",
- "Hello Flutter",
- "Hello Flutter",
- "Hello Flutter",
+ 'Hello Flutter',
+ 'Hello Flutter',
+ 'Hello Flutter',
+ 'Hello Flutter',
+ 'Hello Flutter',
];
@override
@@ -46,7 +49,7 @@
void _loadMoreData() {
setState(() {
- final newItems = List.generate(itemsPerPage, (i) {
+ final List<String> newItems = List.generate(itemsPerPage, (int i) {
return staticData[i % staticData.length];
});
items.addAll(newItems);
@@ -55,27 +58,19 @@
@override
Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- appBar: AppBar(
- title: Text("Infinite Scrolling ListView (Static Data)"),
- ),
- body: NotificationListener<ScrollNotification>(
- onNotification: (ScrollNotification scrollInfo) {
- if (scrollInfo.metrics.pixels >=
- scrollInfo.metrics.maxScrollExtent - 50) {
- _loadMoreData();
- return true;
- }
- return false;
- },
- child: ListView.builder(
- itemCount: items.length,
- itemBuilder: (context, index) {
- return ListTile(title: Text(items[index]));
- },
- ),
- ),
+ return NotificationListener<ScrollNotification>(
+ onNotification: (ScrollNotification scrollInfo) {
+ if (scrollInfo.metrics.pixels >= scrollInfo.metrics.maxScrollExtent - 50) {
+ _loadMoreData();
+ return true;
+ }
+ return false;
+ },
+ child: ListView.builder(
+ itemCount: items.length,
+ itemBuilder: (context, index) {
+ return ListTile(title: Text(items[index]));
+ },
),
);
}