Unverified Commit 93ca2b5a authored by Hans Muller's avatar Hans Muller Committed by GitHub

Removed ButtonBar from flutter_gallery (#85351)

parent dec122a4
...@@ -127,8 +127,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -127,8 +127,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
ButtonBar( const SizedBox(height: 2),
mainAxisSize: MainAxisSize.min, OverflowBar(
spacing: 8,
children: <Widget>[ children: <Widget>[
ElevatedButton( ElevatedButton(
style: style, style: style,
...@@ -143,8 +144,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -143,8 +144,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
), ),
], ],
), ),
ButtonBar( const SizedBox(height: 16),
mainAxisSize: MainAxisSize.min, OverflowBar(
spacing: 8,
children: <Widget>[ children: <Widget>[
ElevatedButton.icon( ElevatedButton.icon(
style: style, style: style,
...@@ -174,8 +176,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -174,8 +176,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
ButtonBar( const SizedBox(height: 2),
mainAxisSize: MainAxisSize.min, OverflowBar(
spacing: 8,
children: <Widget>[ children: <Widget>[
TextButton( TextButton(
style: style, style: style,
...@@ -190,8 +193,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -190,8 +193,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
), ),
], ],
), ),
ButtonBar( OverflowBar(
mainAxisSize: MainAxisSize.min, spacing: 8,
children: <Widget>[ children: <Widget>[
TextButton.icon( TextButton.icon(
style: style, style: style,
...@@ -221,8 +224,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -221,8 +224,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
ButtonBar( const SizedBox(height: 2),
mainAxisSize: MainAxisSize.min, OverflowBar(
spacing: 8,
children: <Widget>[ children: <Widget>[
OutlinedButton( OutlinedButton(
style: style, style: style,
...@@ -238,8 +242,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> { ...@@ -238,8 +242,9 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
), ),
], ],
), ),
ButtonBar( const SizedBox(height: 16),
mainAxisSize: MainAxisSize.min, OverflowBar(
spacing: 8,
children: <Widget>[ children: <Widget>[
OutlinedButton.icon( OutlinedButton.icon(
style: style, style: style,
......
...@@ -314,8 +314,11 @@ class TravelDestinationContent extends StatelessWidget { ...@@ -314,8 +314,11 @@ class TravelDestinationContent extends StatelessWidget {
), ),
if (destination.type == CardDemoType.standard) if (destination.type == CardDemoType.standard)
// share, explore buttons // share, explore buttons
ButtonBar( Padding(
padding: const EdgeInsetsDirectional.only(start: 8, top: 8),
child: OverflowBar(
alignment: MainAxisAlignment.start, alignment: MainAxisAlignment.start,
spacing: 8,
children: <Widget>[ children: <Widget>[
TextButton( TextButton(
style: textButtonStyle, style: textButtonStyle,
...@@ -329,6 +332,7 @@ class TravelDestinationContent extends StatelessWidget { ...@@ -329,6 +332,7 @@ class TravelDestinationContent extends StatelessWidget {
), ),
], ],
), ),
),
], ],
); );
} }
......
...@@ -82,9 +82,10 @@ class _LoginPageState extends State<LoginPage> { ...@@ -82,9 +82,10 @@ class _LoginPageState extends State<LoginPage> {
), ),
), ),
), ),
Wrap( const SizedBox(height: 12.0),
children: <Widget>[ OverflowBar(
ButtonBar( spacing: 8,
alignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
TextButton( TextButton(
style: TextButton.styleFrom( style: TextButton.styleFrom(
...@@ -117,8 +118,6 @@ class _LoginPageState extends State<LoginPage> { ...@@ -117,8 +118,6 @@ class _LoginPageState extends State<LoginPage> {
), ),
], ],
), ),
],
),
), ),
); );
} }
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_gallery/demo/material/buttons_demo.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Button locations are OK', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/pull/85351
{
await tester.pumpWidget(const MaterialApp(home: ButtonsDemo()));
expect(find.byType(ElevatedButton).evaluate().length, 2);
final Offset topLeft1 = tester.getTopLeft(find.byType(ElevatedButton).first);
final Offset topLeft2 = tester.getTopLeft(find.byType(ElevatedButton).last);
expect(topLeft1.dx, 203);
expect(topLeft2.dx, 453);
expect(topLeft1.dy, topLeft2.dy);
}
{
await tester.tap(find.text('TEXT'));
await tester.pumpAndSettle();
expect(find.byType(TextButton).evaluate().length, 2);
final Offset topLeft1 = tester.getTopLeft(find.byType(TextButton).first);
final Offset topLeft2 = tester.getTopLeft(find.byType(TextButton).last);
expect(topLeft1.dx, 247);
expect(topLeft2.dx, 425);
expect(topLeft1.dy, topLeft2.dy);
}
{
await tester.tap(find.text('OUTLINED'));
await tester.pumpAndSettle();
expect(find.byType(OutlinedButton).evaluate().length, 2);
final Offset topLeft1 = tester.getTopLeft(find.byType(OutlinedButton).first);
final Offset topLeft2 = tester.getTopLeft(find.byType(OutlinedButton).last);
expect(topLeft1.dx, 203);
expect(topLeft2.dx, 453);
expect(topLeft1.dy, topLeft2.dy);
}
});
}
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