|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | 3 | // found in the LICENSE file. |
4 | 4 |
|
| 5 | +/// @docImport 'dart:io'; |
| 6 | +/// |
5 | 7 | /// @docImport 'package:cupertino_ui/cupertino_ui.dart'; |
6 | 8 | /// |
7 | 9 | /// @docImport 'drawer.dart'; |
8 | 10 | /// @docImport 'list_tile_theme.dart'; |
9 | 11 | library; |
10 | 12 |
|
11 | 13 | import 'dart:developer' show Flow, Timeline; |
12 | | -import 'dart:io' show Platform; |
13 | 14 |
|
14 | 15 | import 'package:cupertino_ui/cupertino_ui.dart' show CupertinoDialogAction; |
15 | 16 | import 'package:flutter/foundation.dart'; |
16 | 17 | import 'package:flutter/scheduler.dart'; |
17 | 18 | import 'package:flutter/widgets.dart' hide Flow; |
18 | 19 |
|
| 20 | +import '_about_io.dart' if (dart.library.js_interop) '_about_web.dart' as impl; |
19 | 21 | import 'app_bar.dart'; |
20 | 22 | import 'back_button.dart'; |
21 | 23 | import 'card.dart'; |
@@ -101,7 +103,9 @@ class AboutListTile extends StatelessWidget { |
101 | 103 | /// [child]) and as the caption of the [AboutDialog] that is shown. |
102 | 104 | /// |
103 | 105 | /// Defaults to the value of [Title.title], if a [Title] widget can be found. |
104 | | - /// Otherwise, defaults to [Platform.resolvedExecutable]. |
| 106 | + /// Otherwise, defaults to the file name of [Platform.resolvedExecutable] on |
| 107 | + /// native platforms, or to the empty string on the web, where there is no |
| 108 | + /// executable. |
105 | 109 | final String? applicationName; |
106 | 110 |
|
107 | 111 | /// The version of this build of the application. |
@@ -382,7 +386,9 @@ class AboutDialog extends StatelessWidget { |
382 | 386 | /// The name of the application. |
383 | 387 | /// |
384 | 388 | /// Defaults to the value of [Title.title], if a [Title] widget can be found. |
385 | | - /// Otherwise, defaults to [Platform.resolvedExecutable]. |
| 389 | + /// Otherwise, defaults to the file name of [Platform.resolvedExecutable] on |
| 390 | + /// native platforms, or to the empty string on the web, where there is no |
| 391 | + /// executable. |
386 | 392 | final String? applicationName; |
387 | 393 |
|
388 | 394 | /// The version of this build of the application. |
@@ -631,7 +637,9 @@ class LicensePage extends StatefulWidget { |
631 | 637 | /// The name of the application. |
632 | 638 | /// |
633 | 639 | /// Defaults to the value of [Title.title], if a [Title] widget can be found. |
634 | | - /// Otherwise, defaults to [Platform.resolvedExecutable]. |
| 640 | + /// Otherwise, defaults to the file name of [Platform.resolvedExecutable] on |
| 641 | + /// native platforms, or to the empty string on the web, where there is no |
| 642 | + /// executable. |
635 | 643 | final String? applicationName; |
636 | 644 |
|
637 | 645 | /// The version of this build of the application. |
@@ -1200,7 +1208,7 @@ String _defaultApplicationName(BuildContext context) { |
1200 | 1208 | // can provide an explicit applicationName to the widgets defined in this |
1201 | 1209 | // file, instead of relying on the default. |
1202 | 1210 | final Title? ancestorTitle = context.findAncestorWidgetOfExactType<Title>(); |
1203 | | - return ancestorTitle?.title ?? Platform.resolvedExecutable.split(Platform.pathSeparator).last; |
| 1211 | + return ancestorTitle?.title ?? impl.executableName; |
1204 | 1212 | } |
1205 | 1213 |
|
1206 | 1214 | String _defaultApplicationVersion(BuildContext context) { |
|
0 commit comments