Unverified Commit a508d358 authored by Pierre-Louis's avatar Pierre-Louis Committed by GitHub

Use adaptive more icon for popup_menu (#70773)

parent 8522ec7e
...@@ -1102,20 +1102,6 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { ...@@ -1102,20 +1102,6 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
} }
} }
Icon _getIcon(TargetPlatform platform) {
assert(platform != null);
switch (platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return const Icon(Icons.more_vert);
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return const Icon(Icons.more_horiz);
}
}
bool get _canRequestFocus { bool get _canRequestFocus {
final NavigationMode mode = MediaQuery.maybeOf(context)?.navigationMode ?? NavigationMode.traditional; final NavigationMode mode = MediaQuery.maybeOf(context)?.navigationMode ?? NavigationMode.traditional;
switch (mode) { switch (mode) {
...@@ -1146,7 +1132,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> { ...@@ -1146,7 +1132,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
); );
return IconButton( return IconButton(
icon: widget.icon ?? _getIcon(Theme.of(context).platform), icon: widget.icon ?? Icon(Icons.adaptive.more),
padding: widget.padding, padding: widget.padding,
tooltip: widget.tooltip ?? MaterialLocalizations.of(context).showMenuTooltip, tooltip: widget.tooltip ?? MaterialLocalizations.of(context).showMenuTooltip,
onPressed: widget.enabled ? showButtonMenu : null, onPressed: widget.enabled ? showButtonMenu : null,
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'dart:ui' show window, SemanticsFlag; import 'dart:ui' show window, SemanticsFlag;
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -368,8 +369,8 @@ void main() { ...@@ -368,8 +369,8 @@ void main() {
testWidgets('PopupMenuButton is horizontal on iOS', (WidgetTester tester) async { testWidgets('PopupMenuButton is horizontal on iOS', (WidgetTester tester) async {
Widget build(TargetPlatform platform) { Widget build(TargetPlatform platform) {
debugDefaultTargetPlatformOverride = platform;
return MaterialApp( return MaterialApp(
theme: ThemeData(platform: platform),
home: Scaffold( home: Scaffold(
appBar: AppBar( appBar: AppBar(
actions: <Widget>[ actions: <Widget>[
...@@ -405,6 +406,8 @@ void main() { ...@@ -405,6 +406,8 @@ void main() {
expect(find.byIcon(Icons.more_vert), findsNothing); expect(find.byIcon(Icons.more_vert), findsNothing);
expect(find.byIcon(Icons.more_horiz), findsOneWidget); expect(find.byIcon(Icons.more_horiz), findsOneWidget);
debugDefaultTargetPlatformOverride = null;
}); });
group('PopupMenuButton with Icon', () { group('PopupMenuButton with Icon', () {
......
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