Unverified Commit 79d0358e authored by xubaolin's avatar xubaolin Committed by GitHub

Update PopupMenuButton to match Material Design spec (#70160)

parent 7ee910b0
......@@ -38,6 +38,7 @@ void main() {
key: targetKey,
builder: (BuildContext context) {
return PopupMenuButton<int>(
placement: PopupMenuPlacement.belowButton,
onSelected: (int value) {
Navigator.pushNamed(context, '/next');
},
......@@ -78,20 +79,20 @@ void main() {
Offset bottomLeft = tester.getBottomLeft(find.text('hello, world'));
Offset bottomRight = tester.getBottomRight(find.text('hello, world'));
expect(topLeft, const Offset(392.0, 299.5));
expect(topRight, const Offset(596.0, 299.5));
expect(bottomLeft, const Offset(392.0, 316.5));
expect(bottomRight, const Offset(596.0, 316.5));
expect(topLeft, const Offset(392.0, 347.5));
expect(topRight, const Offset(596.0, 347.5));
expect(bottomLeft, const Offset(392.0, 364.5));
expect(bottomRight, const Offset(596.0, 364.5));
topLeft = tester.getTopLeft(find.text('你好,世界'));
topRight = tester.getTopRight(find.text('你好,世界'));
bottomLeft = tester.getBottomLeft(find.text('你好,世界'));
bottomRight = tester.getBottomRight(find.text('你好,世界'));
expect(topLeft, const Offset(392.0, 347.5));
expect(topRight, const Offset(477.0, 347.5));
expect(bottomLeft, const Offset(392.0, 364.5));
expect(bottomRight, const Offset(477.0, 364.5));
expect(topLeft, const Offset(392.0, 395.5));
expect(topRight, const Offset(477.0, 395.5));
expect(bottomLeft, const Offset(392.0, 412.5));
expect(bottomRight, const Offset(477.0, 412.5));
});
testWidgets('Text baseline with EN locale', (WidgetTester tester) async {
......@@ -124,6 +125,7 @@ void main() {
key: targetKey,
builder: (BuildContext context) {
return PopupMenuButton<int>(
placement: PopupMenuPlacement.belowButton,
onSelected: (int value) {
Navigator.pushNamed(context, '/next');
},
......@@ -164,19 +166,19 @@ void main() {
Offset bottomLeft = tester.getBottomLeft(find.text('hello, world'));
Offset bottomRight = tester.getBottomRight(find.text('hello, world'));
expect(topLeft, const Offset(392.0, 300.0));
expect(topRight, const Offset(584.0, 300.0));
expect(bottomLeft, const Offset(392.0, 316));
expect(bottomRight, const Offset(584.0, 316));
expect(topLeft, const Offset(392.0, 348.0));
expect(topRight, const Offset(584.0, 348.0));
expect(bottomLeft, const Offset(392.0, 364));
expect(bottomRight, const Offset(584.0, 364));
topLeft = tester.getTopLeft(find.text('你好,世界'));
topRight = tester.getTopRight(find.text('你好,世界'));
bottomLeft = tester.getBottomLeft(find.text('你好,世界'));
bottomRight = tester.getBottomRight(find.text('你好,世界'));
expect(topLeft, const Offset(392.0, 348.0));
expect(topRight, const Offset(472.0, 348.0));
expect(bottomLeft, const Offset(392.0, 364.0));
expect(bottomRight, const Offset(472.0, 364.0));
expect(topLeft, const Offset(392.0, 396.0));
expect(topRight, const Offset(472.0, 396.0));
expect(bottomLeft, const Offset(392.0, 412.0));
expect(bottomRight, const Offset(472.0, 412.0));
});
}
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