Skip to content

Commit

Permalink
Updated obsolete button references (flutter#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
HansMuller authored Oct 14, 2020
1 parent b431cd9 commit 0418a01
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 50 deletions.
12 changes: 4 additions & 8 deletions packages/animations/example/lib/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class _FadeScaleTransitionDemoState extends State<FadeScaleTransitionDemo>
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -90,21 +90,17 @@ class _FadeScaleTransitionDemoState extends State<FadeScaleTransitionDemo>
},
);
},
color: Theme.of(context).colorScheme.primary,
textColor: Theme.of(context).colorScheme.onPrimary,
child: const Text('SHOW MODAL'),
),
const SizedBox(width: 10),
RaisedButton(
ElevatedButton(
onPressed: () {
if (_isAnimationRunningForwardsOrComplete) {
_controller.reverse();
} else {
_controller.forward();
}
},
color: Theme.of(context).colorScheme.primary,
textColor: Theme.of(context).colorScheme.onPrimary,
child: _isAnimationRunningForwardsOrComplete
? const Text('HIDE FAB')
: const Text('SHOW FAB'),
Expand All @@ -124,13 +120,13 @@ class _ExampleAlertDialog extends StatelessWidget {
return AlertDialog(
content: const Text('Alert Dialog'),
actions: <Widget>[
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text('CANCEL'),
),
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
Expand Down
14 changes: 4 additions & 10 deletions packages/animations/example/lib/shared_axis_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,12 @@ class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FlatButton(
TextButton(
onPressed: _isLoggedIn ? _toggleLoginStatus : null,
textColor: Theme.of(context).colorScheme.primary,
child: const Text('BACK'),
),
RaisedButton(
ElevatedButton(
onPressed: _isLoggedIn ? null : _toggleLoginStatus,
color: Theme.of(context).colorScheme.primary,
textColor: Theme.of(context).colorScheme.onPrimary,
disabledColor: Colors.black12,
child: const Text('NEXT'),
),
],
Expand Down Expand Up @@ -229,17 +225,15 @@ class _SignInPage extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: FlatButton(
child: TextButton(
onPressed: () {},
textColor: Theme.of(context).colorScheme.primary,
child: const Text('FORGOT EMAIL?'),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: FlatButton(
child: TextButton(
onPressed: () {},
textColor: Theme.of(context).colorScheme.primary,
child: const Text('CREATE ACCOUNT'),
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/lib/src/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import 'modal.dart';
/// Widget build(BuildContext context) {
/// return Scaffold(
/// body: Center(
/// child: RaisedButton(
/// child: ElevatedButton(
/// onPressed: () {
/// showModal(
/// context: context,
Expand Down
4 changes: 2 additions & 2 deletions packages/animations/lib/src/fade_through_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import 'dual_transition_builder.dart' as dual_transition_builder;
/// return Container(
/// color: Colors.red,
/// child: Center(
/// child: MaterialButton(
/// child: TextButton(
/// child: Text('Push route'),
/// onPressed: () {
/// Navigator.of(context).pushNamed('/a');
Expand All @@ -50,7 +50,7 @@ import 'dual_transition_builder.dart' as dual_transition_builder;
/// return Container(
/// color: Colors.blue,
/// child: Center(
/// child: MaterialButton(
/// child: TextButton(
/// child: Text('Pop route'),
/// onPressed: () {
/// Navigator.of(context).pop();
Expand Down
4 changes: 2 additions & 2 deletions packages/animations/lib/src/shared_axis_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum SharedAxisTransitionType {
/// return Container(
/// color: Colors.red,
/// child: Center(
/// child: RaisedButton(
/// child: ElevatedButton(
/// child: Text('Push route'),
/// onPressed: () {
/// Navigator.of(context).pushNamed('/a');
Expand All @@ -72,7 +72,7 @@ enum SharedAxisTransitionType {
/// return Container(
/// color: Colors.blue,
/// child: Center(
/// child: RaisedButton(
/// child: ElevatedButton(
/// child: Text('Pop route'),
/// onPressed: () {
/// Navigator.of(context).pop();
Expand Down
20 changes: 10 additions & 10 deletions packages/animations/test/fade_scale_transition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -34,7 +34,7 @@ void main() {
),
),
);
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pumpAndSettle();
expect(find.byType(_FlutterLogoModal), findsOneWidget);
},
Expand All @@ -49,7 +49,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -66,7 +66,7 @@ void main() {
),
),
);
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pump();
// Opacity duration: First 30% of 150ms, linear transition
double topFadeTransitionOpacity = _getOpacity(key, tester);
Expand Down Expand Up @@ -117,7 +117,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -135,7 +135,7 @@ void main() {
),
);
// Show the incoming modal and let it animate in fully.
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pumpAndSettle();

// Tap on modal barrier to start reverse animation.
Expand Down Expand Up @@ -182,7 +182,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -200,7 +200,7 @@ void main() {
),
);

await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pump();
// Opacity duration: First 30% of 150ms, linear transition
double topFadeTransitionOpacity = _getOpacity(key, tester);
Expand Down Expand Up @@ -283,7 +283,7 @@ void main() {
return Center(
child: Column(
children: <Widget>[
RaisedButton(
ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand Down Expand Up @@ -318,7 +318,7 @@ void main() {
expect(bottomState.widget.name, 'bottom route');

// Start the enter transition of the modal route.
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pump();
await tester.pump();

Expand Down
28 changes: 14 additions & 14 deletions packages/animations/test/modal_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -33,7 +33,7 @@ void main() {
),
),
);
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pumpAndSettle();

// New route containing _FlutterLogoModal is present.
Expand All @@ -58,7 +58,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -77,7 +77,7 @@ void main() {
);

// Start forwards animation
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pump();

// Opacity duration: Linear transition throughout 300ms
Expand Down Expand Up @@ -108,7 +108,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -127,7 +127,7 @@ void main() {
);

// Start forwards animation
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pumpAndSettle();
expect(find.byType(_FlutterLogoModal), findsOneWidget);

Expand Down Expand Up @@ -162,7 +162,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -178,7 +178,7 @@ void main() {
),
),
);
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pumpAndSettle();

// New route containing _FlutterLogoModal is present.
Expand All @@ -204,7 +204,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -222,7 +222,7 @@ void main() {
);

// Start forwards animation
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pump();

// Opacity duration: First 30% of 150ms, linear transition
Expand Down Expand Up @@ -275,7 +275,7 @@ void main() {
home: Scaffold(
body: Builder(builder: (BuildContext context) {
return Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand All @@ -293,7 +293,7 @@ void main() {
);

// Start forwards animation
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pumpAndSettle();
expect(find.byType(_FlutterLogoModal), findsOneWidget);

Expand Down Expand Up @@ -345,7 +345,7 @@ void main() {
return Center(
child: Column(
children: <Widget>[
RaisedButton(
ElevatedButton(
onPressed: () {
showModal<void>(
context: context,
Expand Down Expand Up @@ -379,7 +379,7 @@ void main() {
expect(bottomState.widget.name, 'bottom route');

// Start the enter transition of the modal route.
await tester.tap(find.byType(RaisedButton));
await tester.tap(find.byType(ElevatedButton));
await tester.pump();
await tester.pump();

Expand Down
6 changes: 3 additions & 3 deletions packages/animations/test/open_container_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ class __RemoveOpenContainerExampleState
Column(
children: <Widget>[
const Text('Closed'),
RaisedButton(
ElevatedButton(
onPressed: action,
child: const Text('Open the container'),
),
Expand All @@ -1813,11 +1813,11 @@ class __RemoveOpenContainerExampleState
openBuilder: (BuildContext context, VoidCallback action) => Column(
children: <Widget>[
const Text('Open'),
RaisedButton(
ElevatedButton(
onPressed: action,
child: const Text('Close the container'),
),
RaisedButton(
ElevatedButton(
onPressed: () {
setState(() {
removeOpenContainerWidget = true;
Expand Down

0 comments on commit 0418a01

Please sign in to comment.