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