Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
14f9ed28
Unverified
Commit
14f9ed28
authored
Aug 16, 2023
by
Michael Goderbauer
Committed by
GitHub
Aug 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Analyze doc code snippets for all packages for which we publish docs (#132607)
Fixes TODO in the analyzer script :)
parent
e52e8da3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
33 deletions
+74
-33
analyze_snippet_code.dart
dev/bots/analyze_snippet_code.dart
+23
-11
pubspec.yaml
examples/api/pubspec.yaml
+4
-0
cupertino_localizations.dart
...lutter_localizations/lib/src/cupertino_localizations.dart
+12
-8
material_localizations.dart
...flutter_localizations/lib/src/material_localizations.dart
+12
-8
url_strategy.dart
.../flutter_web_plugins/lib/src/navigation/url_strategy.dart
+4
-2
url_strategy.dart
..._web_plugins/lib/src/navigation_non_web/url_strategy.dart
+8
-4
plugin_registry.dart
packages/flutter_web_plugins/lib/src/plugin_registry.dart
+11
-0
No files found.
dev/bots/analyze_snippet_code.dart
View file @
14f9ed28
...
...
@@ -61,6 +61,11 @@
// contains no explicit imports, the snippets will implicitly import all the
// main Flutter packages (including material and flutter_test), as well as most
// core Dart packages with the usual prefixes.
//
// When invoked without an additional path argument, the script will analyze
// the code snippets for all packages in the "packages" subdirectory that do
// not specify "nodoc: true" in their pubspec.yaml (i.e. all packages for which
// we publish docs will have their doc code snippets analyzed).
import
'dart:async'
;
import
'dart:convert'
;
...
...
@@ -73,9 +78,6 @@ import 'package:watcher/watcher.dart';
final
String
_flutterRoot
=
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
path
.
fromUri
(
Platform
.
script
))));
final
String
_packageFlutter
=
path
.
join
(
_flutterRoot
,
'packages'
,
'flutter'
,
'lib'
);
final
String
_packageFlutterTest
=
path
.
join
(
_flutterRoot
,
'packages'
,
'flutter_test'
,
'lib'
);
final
String
_packageFlutterDriver
=
path
.
join
(
_flutterRoot
,
'packages'
,
'flutter_driver'
,
'lib'
);
final
String
_packageIntegrationTest
=
path
.
join
(
_flutterRoot
,
'packages'
,
'integration_test'
,
'lib'
);
final
String
_defaultDartUiLocation
=
path
.
join
(
_flutterRoot
,
'bin'
,
'cache'
,
'pkg'
,
'sky_engine'
,
'lib'
,
'ui'
);
final
String
_flutter
=
path
.
join
(
_flutterRoot
,
'bin'
,
Platform
.
isWindows
?
'flutter.bat'
:
'flutter'
);
...
...
@@ -147,18 +149,28 @@ Future<void> main(List<String> arguments) async {
exit
(
0
);
}
List
<
Directory
>
flutterPackages
;
final
List
<
Directory
>
flutterPackages
;
if
(
parsedArguments
.
rest
.
length
==
1
)
{
// Used for testing.
flutterPackages
=
<
Directory
>[
Directory
(
parsedArguments
.
rest
.
single
)];
}
else
{
flutterPackages
=
<
Directory
>[
Directory
(
_packageFlutter
),
Directory
(
_packageFlutterTest
),
Directory
(
_packageIntegrationTest
),
Directory
(
_packageFlutterDriver
),
// TODO(goderbauer): Add all other packages for which we publish docs.
];
// By default analyze snippets in all packages in the packages subdirectory
// that do not specify "nodoc: true" in their pubspec.yaml.
flutterPackages
=
<
Directory
>[];
final
String
packagesRoot
=
path
.
join
(
_flutterRoot
,
'packages'
);
for
(
final
FileSystemEntity
entity
in
Directory
(
packagesRoot
).
listSync
())
{
if
(
entity
is
!
Directory
)
{
continue
;
}
final
File
pubspec
=
File
(
path
.
join
(
entity
.
path
,
'pubspec.yaml'
));
if
(!
pubspec
.
existsSync
())
{
throw
StateError
(
"Unexpected package '
${entity.path}
' found in packages directory"
);
}
if
(!
pubspec
.
readAsStringSync
().
contains
(
'nodoc: true'
))
{
flutterPackages
.
add
(
Directory
(
path
.
join
(
entity
.
path
,
'lib'
)));
}
}
assert
(
flutterPackages
.
length
>=
4
);
}
final
bool
includeDartUi
=
parsedArguments
.
wasParsed
(
'dart-ui-location'
)
||
parsedArguments
[
'include-dart-ui'
]
as
bool
;
...
...
examples/api/pubspec.yaml
View file @
14f9ed28
...
...
@@ -29,8 +29,12 @@ dev_dependencies:
sdk
:
flutter
flutter_goldens
:
sdk
:
flutter
flutter_localizations
:
sdk
:
flutter
flutter_test
:
sdk
:
flutter
flutter_web_plugins
:
sdk
:
flutter
test
:
1.24.6
_fe_analyzer_shared
:
64.0.0
# THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...
...
packages/flutter_localizations/lib/src/cupertino_localizations.dart
View file @
14f9ed28
...
...
@@ -10,6 +10,10 @@ import 'l10n/generated_cupertino_localizations.dart';
import
'utils/date_localizations.dart'
as
util
;
import
'widgets_localizations.dart'
;
// Examples can assume:
// import 'package:flutter_localizations/flutter_localizations.dart';
// import 'package:flutter/cupertino.dart';
/// Implementation of localized strings for Cupertino widgets using the `intl`
/// package for date and time formatting.
///
...
...
@@ -32,11 +36,11 @@ import 'widgets_localizations.dart';
/// app supports with [CupertinoApp.supportedLocales]:
///
/// ```dart
/// CupertinoApp(
///
const
CupertinoApp(
/// localizationsDelegates: GlobalCupertinoLocalizations.delegates,
/// supportedLocales: [
///
const
Locale('en', 'US'), // American English
///
const
Locale('he', 'IL'), // Israeli Hebrew
/// supportedLocales:
<Locale>
[
/// Locale('en', 'US'), // American English
/// Locale('he', 'IL'), // Israeli Hebrew
/// // ...
/// ],
/// // ...
...
...
@@ -432,11 +436,11 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
/// app supports with [CupertinoApp.supportedLocales]:
///
/// ```dart
/// CupertinoApp(
///
const
CupertinoApp(
/// localizationsDelegates: GlobalCupertinoLocalizations.delegates,
/// supportedLocales: [
///
const
Locale('en', 'US'), // English
///
const
Locale('he', 'IL'), // Hebrew
/// supportedLocales:
<Locale>
[
/// Locale('en', 'US'), // English
/// Locale('he', 'IL'), // Hebrew
/// ],
/// // ...
/// )
...
...
packages/flutter_localizations/lib/src/material_localizations.dart
View file @
14f9ed28
...
...
@@ -11,6 +11,10 @@ import 'l10n/generated_material_localizations.dart';
import
'utils/date_localizations.dart'
as
util
;
import
'widgets_localizations.dart'
;
// Examples can assume:
// import 'package:flutter_localizations/flutter_localizations.dart';
// import 'package:flutter/material.dart';
/// Implementation of localized strings for the material widgets using the
/// `intl` package for date and time formatting.
///
...
...
@@ -30,11 +34,11 @@ import 'widgets_localizations.dart';
/// app supports with [MaterialApp.supportedLocales]:
///
/// ```dart
/// MaterialApp(
///
const
MaterialApp(
/// localizationsDelegates: GlobalMaterialLocalizations.delegates,
/// supportedLocales: [
///
const
Locale('en', 'US'), // American English
///
const
Locale('he', 'IL'), // Israeli Hebrew
/// supportedLocales:
<Locale>
[
/// Locale('en', 'US'), // American English
/// Locale('he', 'IL'), // Israeli Hebrew
/// // ...
/// ],
/// // ...
...
...
@@ -681,11 +685,11 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
/// app supports with [MaterialApp.supportedLocales]:
///
/// ```dart
/// MaterialApp(
///
const
MaterialApp(
/// localizationsDelegates: GlobalMaterialLocalizations.delegates,
/// supportedLocales: [
///
const
Locale('en', 'US'), // English
///
const
Locale('he', 'IL'), // Hebrew
/// supportedLocales:
<Locale>
[
/// Locale('en', 'US'), // English
/// Locale('he', 'IL'), // Hebrew
/// ],
/// // ...
/// )
...
...
packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart
View file @
14f9ed28
...
...
@@ -34,8 +34,10 @@ void usePathUrlStrategy() {
/// ```dart
/// import 'package:flutter_web_plugins/flutter_web_plugins.dart';
///
/// void main() {
/// // Somewhere before calling `runApp()` do:
/// setUrlStrategy(PathUrlStrategy());
/// }
/// ```
class
PathUrlStrategy
extends
ui_web
.
HashUrlStrategy
{
/// Creates an instance of [PathUrlStrategy].
...
...
packages/flutter_web_plugins/lib/src/navigation_non_web/url_strategy.dart
View file @
14f9ed28
...
...
@@ -99,8 +99,10 @@ void usePathUrlStrategy() {
/// ```dart
/// import 'package:flutter_web_plugins/flutter_web_plugins.dart';
///
/// void main() {
/// // Somewhere before calling `runApp()` do:
/// setUrlStrategy(const HashUrlStrategy());
/// }
/// ```
class
HashUrlStrategy
extends
UrlStrategy
{
/// Creates an instance of [HashUrlStrategy].
...
...
@@ -117,8 +119,10 @@ class HashUrlStrategy extends UrlStrategy {
/// ```dart
/// import 'package:flutter_web_plugins/flutter_web_plugins.dart';
///
/// void main() {
/// // Somewhere before calling `runApp()` do:
/// setUrlStrategy(PathUrlStrategy());
/// }
/// ```
class
PathUrlStrategy
extends
HashUrlStrategy
{
/// Creates an instance of [PathUrlStrategy].
...
...
packages/flutter_web_plugins/lib/src/plugin_registry.dart
View file @
14f9ed28
...
...
@@ -9,6 +9,12 @@ import 'dart:ui_web' as ui_web;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/services.dart'
;
// Examples can assume:
// import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// import 'package:flutter/services.dart';
// import 'dart:ui_web' as ui_web;
// void handleFrameworkMessage(String name, ByteData? data, PlatformMessageResponseCallback? callback) { }
/// A registrar for Flutter plugins implemented in Dart.
///
/// Plugins for the web platform are implemented in Dart and are
...
...
@@ -32,6 +38,11 @@ import 'package:flutter/services.dart';
/// final MyPlugin instance = MyPlugin();
/// channel.setMethodCallHandler(instance.handleMethodCall);
/// }
///
/// Future<dynamic> handleMethodCall(MethodCall call) async {
/// // ...
/// }
///
/// // ...
/// }
/// ```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment