Unverified Commit 6b7634b7 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Removed old button widget references from dev/manual_tests (#62816)

parent 76a2f42e
...@@ -328,10 +328,18 @@ class _DemoButtonState extends State<DemoButton> { ...@@ -328,10 +328,18 @@ class _DemoButtonState extends State<DemoButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FlatButton( return TextButton(
focusNode: _focusNode, focusNode: _focusNode,
focusColor: Colors.red, style: ButtonStyle(
hoverColor: Colors.blue, foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
if (states.contains(MaterialState.focused))
return Colors.red;
if (states.contains(MaterialState.hovered))
return Colors.blue;
return null;
}),
),
onPressed: () => _handleOnPressed(), onPressed: () => _handleOnPressed(),
child: Text(widget.name, key: _nameKey), child: Text(widget.name, key: _nameKey),
); );
...@@ -447,7 +455,7 @@ class _FocusDemoState extends State<FocusDemo> { ...@@ -447,7 +455,7 @@ class _FocusDemoState extends State<FocusDemo> {
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: RaisedButton( child: ElevatedButton(
child: const Text('UNDO'), child: const Text('UNDO'),
onPressed: canUndo onPressed: canUndo
? () { ? () {
...@@ -458,7 +466,7 @@ class _FocusDemoState extends State<FocusDemo> { ...@@ -458,7 +466,7 @@ class _FocusDemoState extends State<FocusDemo> {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: RaisedButton( child: ElevatedButton(
child: const Text('REDO'), child: const Text('REDO'),
onPressed: canRedo onPressed: canRedo
? () { ? () {
......
...@@ -535,25 +535,27 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -535,25 +535,27 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
_ControlTile( _ControlTile(
label: _model.rtl ? 'زر مسطح' : 'Flat Button', label: _model.rtl ? 'زر مسطح' : 'Text Button',
child: FlatButton( child: TextButton(
color: m2Swatch[200], style: TextButton.styleFrom(
primary: Colors.white,
backgroundColor: m2Swatch[200]
),
onPressed: _model.enable ? () {} : null, onPressed: _model.enable ? () {} : null,
child: label, child: label,
), ),
), ),
_ControlTile( _ControlTile(
label: _model.rtl ? 'أثارت زر' : 'Raised Button', label: _model.rtl ? 'أثارت زر' : 'Elevated Button',
child: RaisedButton( child: ElevatedButton(
color: m2Swatch[200], style: TextButton.styleFrom(backgroundColor: m2Swatch[200]),
onPressed: _model.enable ? () {} : null, onPressed: _model.enable ? () {} : null,
child: label, child: label,
), ),
), ),
_ControlTile( _ControlTile(
label: _model.rtl ? 'زر المخطط التفصيلي' : 'Outline Button', label: _model.rtl ? 'زر المخطط التفصيلي' : 'Outlined Button',
child: OutlineButton( child: OutlinedButton(
color: m2Swatch[500],
onPressed: _model.enable ? () {} : null, onPressed: _model.enable ? () {} : null,
child: label, child: label,
), ),
......
...@@ -57,11 +57,18 @@ class _DemoButtonState extends State<DemoButton> { ...@@ -57,11 +57,18 @@ class _DemoButtonState extends State<DemoButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FlatButton( return TextButton(
focusNode: focusNode, focusNode: focusNode,
autofocus: widget.autofocus, autofocus: widget.autofocus,
focusColor: Colors.red, style: ButtonStyle(
hoverColor: Colors.blue, overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
if (states.contains(MaterialState.focused))
return Colors.red.withOpacity(0.25);
if (states.contains(MaterialState.hovered))
return Colors.blue.withOpacity(0.25);
return null;
}),
),
onPressed: () => _handleOnPressed(), onPressed: () => _handleOnPressed(),
child: Text(widget.name), child: Text(widget.name),
); );
...@@ -178,7 +185,7 @@ class _FocusDemoState extends State<FocusDemo> { ...@@ -178,7 +185,7 @@ class _FocusDemoState extends State<FocusDemo> {
DemoButton(name: 'Six'), DemoButton(name: 'Six'),
], ],
), ),
OutlineButton(onPressed: () => print('pressed'), child: const Text('PRESS ME')), OutlinedButton(onPressed: () => print('pressed'), child: const Text('PRESS ME')),
const Padding( const Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: TextField( child: TextField(
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() { void main() {
runApp(const MaterialApp( runApp(const MaterialApp(
...@@ -24,7 +23,7 @@ class DemoButton extends StatelessWidget { ...@@ -24,7 +23,7 @@ class DemoButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FlatButton( return TextButton(
onPressed: () => _handleOnPressed(), onPressed: () => _handleOnPressed(),
child: Text(name), child: Text(name),
); );
...@@ -42,6 +41,11 @@ class _HoverDemoState extends State<HoverDemo> { ...@@ -42,6 +41,11 @@ class _HoverDemoState extends State<HoverDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme; final TextTheme textTheme = Theme.of(context).textTheme;
final ButtonStyle overrideFocusColor = ButtonStyle(
overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) {
return states.contains(MaterialState.focused) ? Colors.deepOrangeAccent : null;
})
);
return DefaultTextStyle( return DefaultTextStyle(
style: textTheme.headline4, style: textTheme.headline4,
...@@ -60,15 +64,15 @@ class _HoverDemoState extends State<HoverDemo> { ...@@ -60,15 +64,15 @@ class _HoverDemoState extends State<HoverDemo> {
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
RaisedButton( ElevatedButton(
onPressed: () => print('Button pressed.'), onPressed: () => print('Button pressed.'),
child: const Text('Button'), child: const Text('Button'),
focusColor: Colors.deepOrangeAccent, style: overrideFocusColor,
), ),
FlatButton( TextButton(
onPressed: () => print('Button pressed.'), onPressed: () => print('Button pressed.'),
child: const Text('Button'), child: const Text('Button'),
focusColor: Colors.deepOrangeAccent, style: overrideFocusColor,
), ),
IconButton( IconButton(
onPressed: () => print('Button pressed'), onPressed: () => print('Button pressed'),
......
...@@ -43,41 +43,53 @@ class _HomeState extends State<Home> { ...@@ -43,41 +43,53 @@ class _HomeState extends State<Home> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
FlatButton( TextButton(
child: const Text('Test Underlines'), style: TextButton.styleFrom(
color: Colors.red.shade800, primary: Colors.white,
textColor: Colors.white, backgroundColor: Colors.red.shade800,
),
onPressed: () { Navigator.pushNamed(context, 'underlines'); }, onPressed: () { Navigator.pushNamed(context, 'underlines'); },
child: const Text('Test Underlines'),
), ),
FlatButton( TextButton(
child: const Text('Test Font Fallback'), style: TextButton.styleFrom(
color: Colors.orange.shade700, primary: Colors.white,
textColor: Colors.white, backgroundColor: Colors.orange.shade700,
),
onPressed: () { Navigator.pushNamed(context, 'fallback'); }, onPressed: () { Navigator.pushNamed(context, 'fallback'); },
child: const Text('Test Font Fallback'),
), ),
FlatButton( TextButton(
child: const Text('Test Bidi Formatting'), style: TextButton.styleFrom(
color: Colors.yellow.shade700, primary: Colors.black,
textColor: Colors.black, backgroundColor: Colors.yellow.shade700,
),
onPressed: () { Navigator.pushNamed(context, 'bidi'); }, onPressed: () { Navigator.pushNamed(context, 'bidi'); },
child: const Text('Test Bidi Formatting'),
), ),
FlatButton( TextButton(
child: const Text('TextSpan Fuzzer'), style: TextButton.styleFrom(
color: Colors.green.shade400, primary: Colors.black,
textColor: Colors.black, backgroundColor: Colors.green.shade400,
),
onPressed: () { Navigator.pushNamed(context, 'fuzzer'); }, onPressed: () { Navigator.pushNamed(context, 'fuzzer'); },
child: const Text('TextSpan Fuzzer'),
), ),
FlatButton( TextButton(
child: const Text('Diacritics Fuzzer'), style: TextButton.styleFrom(
color: Colors.blue.shade400, primary: Colors.white,
textColor: Colors.white, backgroundColor: Colors.blue.shade400,
),
onPressed: () { Navigator.pushNamed(context, 'zalgo'); }, onPressed: () { Navigator.pushNamed(context, 'zalgo'); },
child: const Text('Diacritics Fuzzer'),
), ),
FlatButton( TextButton(
child: const Text('Painting Fuzzer'), style: TextButton.styleFrom(
color: Colors.purple.shade200, primary: Colors.black,
textColor: Colors.black, backgroundColor: Colors.purple.shade200,
),
onPressed: () { Navigator.pushNamed(context, 'painting'); }, onPressed: () { Navigator.pushNamed(context, 'painting'); },
child: const Text('Painting Fuzzer'),
), ),
], ],
), ),
...@@ -560,6 +572,7 @@ class _UnderlinesState extends State<Underlines> { ...@@ -560,6 +572,7 @@ class _UnderlinesState extends State<Underlines> {
return Container( return Container(
color: Colors.black, color: Colors.black,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
...@@ -578,37 +591,48 @@ class _UnderlinesState extends State<Underlines> { ...@@ -578,37 +591,48 @@ class _UnderlinesState extends State<Underlines> {
), ),
), ),
Material( Material(
child: ButtonBar( child: Container(
children: <Widget>[ alignment: AlignmentDirectional.centerEnd,
FlatButton( padding: const EdgeInsets.all(8),
onPressed: () { child: OverflowBar(
setState(() { spacing: 8,
_text += 'i'; children: <Widget>[
}); TextButton(
}, onPressed: () {
color: Colors.yellow, setState(() {
child: const Text('ADD i'), _text += 'i';
), });
FlatButton( },
onPressed: () { style: TextButton.styleFrom(
setState(() { backgroundColor: Colors.yellow,
_text += 'w'; ),
}); child: const Text('ADD i'),
}, ),
color: Colors.yellow, TextButton(
child: const Text('ADD w'), onPressed: () {
), setState(() {
FlatButton( _text += 'w';
onPressed: _text == '' ? null : () { });
setState(() { },
_text = _text.substring(0, _text.length - 1); style: TextButton.styleFrom(
}); backgroundColor: Colors.yellow,
}, ),
color: Colors.red, child: const Text('ADD w'),
textColor: Colors.white, ),
child: const Text('REMOVE'), TextButton(
), style: TextButton.styleFrom(
], primary: Colors.white,
backgroundColor: Colors.red,
),
onPressed: _text == '' ? null : () {
setState(() {
_text = _text.substring(0, _text.length - 1);
});
},
child: const Text('REMOVE'),
),
],
),
), ),
), ),
], ],
...@@ -1013,6 +1037,7 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin ...@@ -1013,6 +1037,7 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin
), ),
Material( Material(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[ children: <Widget>[
SwitchListTile( SwitchListTile(
title: const Text('Enable Fuzzer'), title: const Text('Enable Fuzzer'),
...@@ -1042,20 +1067,26 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin ...@@ -1042,20 +1067,26 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin
const ListTile( const ListTile(
title: Text('There should be no red visible.'), title: Text('There should be no red visible.'),
), ),
ButtonBar(
children: <Widget>[ Container(
FlatButton( alignment: AlignmentDirectional.centerEnd,
onPressed: _ticker.isActive ? null : () => _update(null), padding: const EdgeInsets.all(8),
child: const Text('ITERATE'), child: OverflowBar(
), spacing: 8,
FlatButton( children: <Widget>[
onPressed: _ticker.isActive ? null : () { TextButton(
print('The currently visible text is: $_text'); onPressed: _ticker.isActive ? null : () => _update(null),
print(_text.runes.map<String>((int value) => 'U+${value.toRadixString(16).padLeft(4, '0').toUpperCase()}').join(' ')); child: const Text('ITERATE'),
}, ),
child: const Text('DUMP TEXT TO LOGS'), TextButton(
), onPressed: _ticker.isActive ? null : () {
], print('The currently visible text is: $_text');
print(_text.runes.map<String>((int value) => 'U+${value.toRadixString(16).padLeft(4, '0').toUpperCase()}').join(' '));
},
child: const Text('DUMP TEXT TO LOGS'),
),
],
),
), ),
], ],
), ),
......
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