Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning for ios profiling issue and link to workaround. #3311

Merged
merged 1 commit into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add warning for ios profiling issue and link to workaround.
  • Loading branch information
kenzieschmoll committed Aug 27, 2021
commit 8e3666d65ebb5625f5bfed8c54c6163f29b0c1e3
6 changes: 4 additions & 2 deletions packages/devtools_app/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ class DevToolsAboutDialog extends StatelessWidget {

Widget _createFeedbackLink(BuildContext context) {
final reportIssuesLink = devToolsExtensionPoints.issueTrackerLink();
final colorScheme = Theme.of(context).colorScheme;
return InkWell(
onTap: () async {
ga.select(
Expand All @@ -527,7 +526,10 @@ class DevToolsAboutDialog extends StatelessWidget {
);
await launchUrl(reportIssuesLink.url, context);
},
child: Text(reportIssuesLink.display, style: linkTextStyle(colorScheme)),
child: Text(
reportIssuesLink.display,
style: Theme.of(context).linkTextStyle,
),
);
}
}
Expand Down
35 changes: 35 additions & 0 deletions packages/devtools_app/lib/src/profiler/profiler_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:vm_service/vm_service.dart' hide Stack;
Expand All @@ -16,6 +17,7 @@ import '../auto_dispose_mixin.dart';
import '../banner_messages.dart';
import '../common_widgets.dart';
import '../config_specific/import_export/import_export.dart';
import '../config_specific/launch_url/launch_url.dart';
import '../globals.dart';
import '../notifications.dart';
import '../screen.dart';
Expand All @@ -30,6 +32,9 @@ import 'profiler_screen_controller.dart';
final profilerScreenSearchFieldKey =
GlobalKey(debugLabel: 'ProfilerScreenSearchFieldKey');

const iosProfilerWorkaround =
'https://github.com/flutter/flutter/issues/88466#issuecomment-905830680';

class ProfilerScreen extends Screen {
const ProfilerScreen()
: super.conditional(
Expand Down Expand Up @@ -153,6 +158,36 @@ class _ProfilerScreenBodyState extends State<ProfilerScreenBody>
cpuProfileData == null) {
return _buildRecordingInfo();
}
if (cpuProfileData.isEmpty) {
// TODO(kenz): remove the note about profiling on iOS after
// https://github.com/flutter/flutter/issues/88466 is fixed.
return Center(
child: RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: 'No CPU samples recorded.',
children: serviceManager.vm.operatingSystem == 'ios'
? [
const TextSpan(
text: '''
\n\nIf you are attempting to profile on a real iOS device, you may be hitting a known issue. Try using this ''',
),
TextSpan(
text: 'workaround',
style: Theme.of(context).linkTextStyle,
recognizer: TapGestureRecognizer()
..onTap = () async {
await launchUrl(
iosProfilerWorkaround, context);
},
),
const TextSpan(text: '.'),
]
: [],
),
),
);
}
return CpuProfiler(
data: cpuProfileData,
controller: controller.cpuProfilerController,
Expand Down
4 changes: 1 addition & 3 deletions packages/devtools_app/lib/src/status_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ class StatusLine extends StatelessWidget {
Screen currentScreen,
TextTheme textTheme,
) {
final colorScheme = Theme.of(context).colorScheme;

final String docPageId = currentScreen.docPageId;
if (docPageId != null) {
return InkWell(
Expand All @@ -125,7 +123,7 @@ class StatusLine extends StatelessWidget {
},
child: Text(
'flutter.dev/devtools/$docPageId',
style: linkTextStyle(colorScheme),
style: Theme.of(context).linkTextStyle,
),
);
} else {
Expand Down
10 changes: 5 additions & 5 deletions packages/devtools_app/lib/src/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ extension ThemeDataExtension on ThemeData {
Color get titleSolidBackgroundColor => colorScheme.isLight
? colorScheme.alternatingBackgroundColor
: canvasColor.darken(0.2);
}

TextStyle linkTextStyle(ColorScheme colorScheme) => TextStyle(
color: colorScheme.devtoolsLink,
decoration: TextDecoration.underline,
);
TextStyle get linkTextStyle => TextStyle(
color: colorScheme.devtoolsLink,
decoration: TextDecoration.underline,
);
}

const wideSearchTextWidth = 400.0;
const defaultSearchTextWidth = 200.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ class ServiceExtensionRichTooltip extends StatelessWidget {
children: [
Text(
'More info',
style: linkTextStyle(Theme.of(context).colorScheme),
style: Theme.of(context).linkTextStyle,
),
const SizedBox(width: densePadding),
Icon(
Expand Down