Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1a08ce74
Unverified
Commit
1a08ce74
authored
Oct 06, 2020
by
Hans Muller
Committed by
GitHub
Oct 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the remaining obsolete button references in flutter_gallery (#67437)
parent
4fa4f91d
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
130 additions
and
137 deletions
+130
-137
buttons_demo.dart
...tests/flutter_gallery/lib/demo/material/buttons_demo.dart
+62
-63
dialog_demo.dart
..._tests/flutter_gallery/lib/demo/material/dialog_demo.dart
+9
-9
expansion_panels_demo.dart
...tter_gallery/lib/demo/material/expansion_panels_demo.dart
+2
-3
modal_bottom_sheet_demo.dart
...er_gallery/lib/demo/material/modal_bottom_sheet_demo.dart
+1
-1
persistent_bottom_sheet_demo.dart
...llery/lib/demo/material/persistent_bottom_sheet_demo.dart
+2
-2
snack_bar_demo.dart
...sts/flutter_gallery/lib/demo/material/snack_bar_demo.dart
+1
-1
text_form_field_demo.dart
...utter_gallery/lib/demo/material/text_form_field_demo.dart
+3
-3
login.dart
...egration_tests/flutter_gallery/lib/demo/shrine/login.dart
+13
-9
shopping_cart.dart
..._tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart
+6
-5
example_code.dart
...ation_tests/flutter_gallery/lib/gallery/example_code.dart
+14
-14
options.dart
...ntegration_tests/flutter_gallery/lib/gallery/options.dart
+11
-9
themes.dart
...integration_tests/flutter_gallery/lib/gallery/themes.dart
+1
-11
updater.dart
...ntegration_tests/flutter_gallery/lib/gallery/updater.dart
+2
-2
accessibility_test.dart
...ration_tests/flutter_gallery/test/accessibility_test.dart
+2
-4
text_form_field_demo_test.dart
...gallery/test/demo/material/text_form_field_demo_test.dart
+1
-1
No files found.
dev/integration_tests/flutter_gallery/lib/demo/material/buttons_demo.dart
View file @
1a08ce74
...
...
@@ -6,23 +6,23 @@ import 'package:flutter/material.dart';
import
'../../gallery/demo.dart'
;
const
String
_
rais
edText
=
'
Rais
ed buttons add dimension to mostly flat layouts. They emphasize '
const
String
_
elevat
edText
=
'
Elevat
ed buttons add dimension to mostly flat layouts. They emphasize '
'functions on busy or wide spaces.'
;
const
String
_
raisedCode
=
'buttons_rais
ed'
;
const
String
_
elevatedCode
=
'buttons_elevat
ed'
;
const
String
_
flatText
=
'A fla
t button displays an ink splash on press '
'but does not lift. Use
fla
t buttons on toolbars, in dialogs and '
const
String
_
textText
=
'A tex
t button displays an ink splash on press '
'but does not lift. Use
tex
t buttons on toolbars, in dialogs and '
'inline with padding'
;
const
String
_
flatCode
=
'buttons_fla
t'
;
const
String
_
textCode
=
'buttons_tex
t'
;
const
String
_outlineText
=
'Outline buttons become opaque and elevate when pressed. They are often '
'paired with
rais
ed buttons to indicate an alternative, secondary action.'
;
const
String
_outline
d
Text
=
'Outline
d
buttons become opaque and elevate when pressed. They are often '
'paired with
elevat
ed buttons to indicate an alternative, secondary action.'
;
const
String
_outline
Code
=
'buttons_outline
'
;
const
String
_outline
dCode
=
'buttons_outlined
'
;
const
String
_dropdownText
=
"A dropdown button displays a menu that's used to select a value from a "
...
...
@@ -53,44 +53,31 @@ class ButtonsDemo extends StatefulWidget {
}
class
_ButtonsDemoState
extends
State
<
ButtonsDemo
>
{
Shape
Border
_buttonShape
;
Outlined
Border
_buttonShape
;
@override
Widget
build
(
BuildContext
context
)
{
final
ButtonThemeData
buttonTheme
=
ButtonTheme
.
of
(
context
).
copyWith
(
shape:
_buttonShape
);
final
List
<
ComponentDemoTabData
>
demos
=
<
ComponentDemoTabData
>[
ComponentDemoTabData
(
tabName:
'RAISED'
,
description:
_raisedText
,
demoWidget:
ButtonTheme
.
fromButtonThemeData
(
data:
buttonTheme
,
child:
buildRaisedButton
(),
),
exampleCodeTag:
_raisedCode
,
documentationUrl:
'https://docs.flutter.io/flutter/material/RaisedButton-class.html'
,
tabName:
'ELEVATED'
,
description:
_elevatedText
,
demoWidget:
buildElevatedButton
(
_buttonShape
),
exampleCodeTag:
_elevatedCode
,
documentationUrl:
'https://docs.flutter.io/flutter/material/ElevatedButton-class.html'
,
),
ComponentDemoTabData
(
tabName:
'FLAT'
,
description:
_flatText
,
demoWidget:
ButtonTheme
.
fromButtonThemeData
(
data:
buttonTheme
,
child:
buildFlatButton
(),
),
exampleCodeTag:
_flatCode
,
documentationUrl:
'https://docs.flutter.io/flutter/material/FlatButton-class.html'
,
tabName:
'TEXT'
,
description:
_textText
,
demoWidget:
buildTextButton
(
_buttonShape
),
exampleCodeTag:
_textCode
,
documentationUrl:
'https://docs.flutter.io/flutter/material/TextButton-class.html'
,
),
ComponentDemoTabData
(
tabName:
'OUTLINE'
,
description:
_outlineText
,
demoWidget:
ButtonTheme
.
fromButtonThemeData
(
data:
buttonTheme
,
child:
buildOutlineButton
(),
),
exampleCodeTag:
_outlineCode
,
documentationUrl:
'https://docs.flutter.io/flutter/material/OutlineButton-class.html'
,
tabName:
'OUTLINED'
,
description:
_outlinedText
,
demoWidget:
buildOutlinedButton
(
_buttonShape
),
exampleCodeTag:
_outlinedCode
,
documentationUrl:
'https://docs.flutter.io/flutter/material/OutlinedButton-class.html'
,
),
ComponentDemoTabData
(
tabName:
'DROPDOWN'
,
...
...
@@ -131,7 +118,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
);
}
Widget
buildRaisedButton
()
{
Widget
buildElevatedButton
(
OutlinedBorder
shape
)
{
final
ButtonStyle
style
=
ElevatedButton
.
styleFrom
(
shape:
shape
);
return
Align
(
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
Column
(
...
...
@@ -140,13 +128,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
RaisedButton
(
child:
const
Text
(
'RAISED BUTTON'
,
semanticsLabel:
'RAISED BUTTON 1'
),
ElevatedButton
(
style:
style
,
child:
const
Text
(
'ELEVATED BUTTON'
,
semanticsLabel:
'ELEVATED BUTTON 1'
),
onPressed:
()
{
// Perform some action
},
),
const
Rais
edButton
(
const
Elevat
edButton
(
child:
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 1'
),
onPressed:
null
,
),
...
...
@@ -155,14 +144,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
RaisedButton
.
icon
(
ElevatedButton
.
icon
(
style:
style
,
icon:
const
Icon
(
Icons
.
add
,
size:
18.0
),
label:
const
Text
(
'
RAISED BUTTON'
,
semanticsLabel:
'RAIS
ED BUTTON 2'
),
label:
const
Text
(
'
ELEVATED BUTTON'
,
semanticsLabel:
'ELEVAT
ED BUTTON 2'
),
onPressed:
()
{
// Perform some action
},
),
RaisedButton
.
icon
(
ElevatedButton
.
icon
(
style:
style
,
icon:
const
Icon
(
Icons
.
add
,
size:
18.0
),
label:
const
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 2'
),
onPressed:
null
,
...
...
@@ -174,7 +165,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
);
}
Widget
buildFlatButton
()
{
Widget
buildTextButton
(
OutlinedBorder
shape
)
{
final
ButtonStyle
style
=
ElevatedButton
.
styleFrom
(
shape:
shape
);
return
Align
(
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
Column
(
...
...
@@ -183,13 +175,14 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
FlatButton
(
child:
const
Text
(
'FLAT BUTTON'
,
semanticsLabel:
'FLAT BUTTON 1'
),
TextButton
(
style:
style
,
child:
const
Text
(
'TEXT BUTTON'
,
semanticsLabel:
'TEXT BUTTON 1'
),
onPressed:
()
{
// Perform some action
},
),
const
Fla
tButton
(
const
Tex
tButton
(
child:
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 3'
,),
onPressed:
null
,
),
...
...
@@ -198,15 +191,17 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
FlatButton
.
icon
(
icon:
const
Icon
(
Icons
.
add_circle_outline
,
size:
18.0
),
label:
const
Text
(
'FLAT BUTTON'
,
semanticsLabel:
'FLAT BUTTON 2'
),
TextButton
.
icon
(
style:
style
,
icon:
const
Icon
(
Icons
.
add_circle_outlined
,
size:
18.0
),
label:
const
Text
(
'TEXT BUTTON'
,
semanticsLabel:
'TEXT BUTTON 2'
),
onPressed:
()
{
// Perform some action
},
),
FlatButton
.
icon
(
icon:
const
Icon
(
Icons
.
add_circle_outline
,
size:
18.0
),
TextButton
.
icon
(
style:
style
,
icon:
const
Icon
(
Icons
.
add_circle_outlined
,
size:
18.0
),
label:
const
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 4'
),
onPressed:
null
,
),
...
...
@@ -217,7 +212,8 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
);
}
Widget
buildOutlineButton
()
{
Widget
buildOutlinedButton
(
OutlinedBorder
shape
)
{
final
ButtonStyle
style
=
ElevatedButton
.
styleFrom
(
shape:
shape
);
return
Align
(
alignment:
const
Alignment
(
0.0
,
-
0.2
),
child:
Column
(
...
...
@@ -226,14 +222,16 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
OutlineButton
(
child:
const
Text
(
'OUTLINE BUTTON'
,
semanticsLabel:
'OUTLINE BUTTON 1'
),
OutlinedButton
(
style:
style
,
child:
const
Text
(
'OUTLINED BUTTON'
,
semanticsLabel:
'OUTLINED BUTTON 1'
),
onPressed:
()
{
// Perform some action
},
),
const
OutlineButton
(
child:
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 5'
),
OutlinedButton
(
style:
style
,
child:
const
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 5'
),
onPressed:
null
,
),
],
...
...
@@ -241,14 +239,15 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
ButtonBar
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
OutlineButton
.
icon
(
OutlinedButton
.
icon
(
style:
style
,
icon:
const
Icon
(
Icons
.
add
,
size:
18.0
),
label:
const
Text
(
'OUTLINE
BUTTON'
,
semanticsLabel:
'OUTLINE
BUTTON 2'
),
label:
const
Text
(
'OUTLINE
D BUTTON'
,
semanticsLabel:
'OUTLINED
BUTTON 2'
),
onPressed:
()
{
// Perform some action
},
),
OutlineButton
.
icon
(
Outline
d
Button
.
icon
(
icon:
const
Icon
(
Icons
.
add
,
size:
18.0
),
label:
const
Text
(
'DISABLED'
,
semanticsLabel:
'DISABLED BUTTON 6'
),
onPressed:
null
,
...
...
dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart
View file @
1a08ce74
...
...
@@ -94,7 +94,7 @@ class DialogDemoState extends State<DialogDemo> {
body:
ListView
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
24.0
,
horizontal:
72.0
),
children:
<
Widget
>[
Rais
edButton
(
Elevat
edButton
(
child:
const
Text
(
'ALERT'
),
onPressed:
()
{
showDemoDialog
<
DialogDemoAction
>(
...
...
@@ -105,11 +105,11 @@ class DialogDemoState extends State<DialogDemo> {
style:
dialogTextStyle
,
),
actions:
<
Widget
>[
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'CANCEL'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
DialogDemoAction
.
cancel
);
},
),
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'DISCARD'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
DialogDemoAction
.
discard
);
},
),
...
...
@@ -118,7 +118,7 @@ class DialogDemoState extends State<DialogDemo> {
);
},
),
Rais
edButton
(
Elevat
edButton
(
child:
const
Text
(
'ALERT WITH TITLE'
),
onPressed:
()
{
showDemoDialog
<
DialogDemoAction
>(
...
...
@@ -130,11 +130,11 @@ class DialogDemoState extends State<DialogDemo> {
style:
dialogTextStyle
,
),
actions:
<
Widget
>[
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'DISAGREE'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
DialogDemoAction
.
disagree
);
},
),
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'AGREE'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
DialogDemoAction
.
agree
);
},
),
...
...
@@ -143,7 +143,7 @@ class DialogDemoState extends State<DialogDemo> {
);
},
),
Rais
edButton
(
Elevat
edButton
(
child:
const
Text
(
'SIMPLE'
),
onPressed:
()
{
showDemoDialog
<
String
>(
...
...
@@ -173,7 +173,7 @@ class DialogDemoState extends State<DialogDemo> {
);
},
),
Rais
edButton
(
Elevat
edButton
(
child:
const
Text
(
'CONFIRMATION'
),
onPressed:
()
{
showTimePicker
(
...
...
@@ -190,7 +190,7 @@ class DialogDemoState extends State<DialogDemo> {
});
},
),
Rais
edButton
(
Elevat
edButton
(
child:
const
Text
(
'FULLSCREEN'
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
<
DismissDialogAction
>(
...
...
dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart
View file @
1a08ce74
...
...
@@ -119,7 +119,7 @@ class CollapsibleBody extends StatelessWidget {
children:
<
Widget
>[
Container
(
margin:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
Fla
tButton
(
child:
Tex
tButton
(
onPressed:
onCancel
,
child:
const
Text
(
'CANCEL'
,
style:
TextStyle
(
color:
Colors
.
black54
,
...
...
@@ -130,9 +130,8 @@ class CollapsibleBody extends StatelessWidget {
),
Container
(
margin:
const
EdgeInsets
.
only
(
right:
8.0
),
child:
Fla
tButton
(
child:
Tex
tButton
(
onPressed:
onSave
,
textTheme:
ButtonTextTheme
.
accent
,
child:
const
Text
(
'SAVE'
),
),
),
...
...
dev/integration_tests/flutter_gallery/lib/demo/material/modal_bottom_sheet_demo.dart
View file @
1a08ce74
...
...
@@ -17,7 +17,7 @@ class ModalBottomSheetDemo extends StatelessWidget {
actions:
<
Widget
>[
MaterialDemoDocumentationButton
(
routeName
)],
),
body:
Center
(
child:
Rais
edButton
(
child:
Elevat
edButton
(
child:
const
Text
(
'SHOW BOTTOM SHEET'
),
onPressed:
()
{
showModalBottomSheet
<
void
>(
context:
context
,
builder:
(
BuildContext
context
)
{
...
...
dev/integration_tests/flutter_gallery/lib/demo/material/persistent_bottom_sheet_demo.dart
View file @
1a08ce74
...
...
@@ -62,7 +62,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
return
AlertDialog
(
content:
const
Text
(
'You tapped the floating action button.'
),
actions:
<
Widget
>[
Fla
tButton
(
Tex
tButton
(
onPressed:
()
{
Navigator
.
pop
(
context
);
},
...
...
@@ -93,7 +93,7 @@ class _PersistentBottomSheetDemoState extends State<PersistentBottomSheetDemo> {
),
),
body:
Center
(
child:
Rais
edButton
(
child:
Elevat
edButton
(
onPressed:
_showBottomSheetCallback
,
child:
const
Text
(
'SHOW BOTTOM SHEET'
),
),
...
...
dev/integration_tests/flutter_gallery/lib/demo/material/snack_bar_demo.dart
View file @
1a08ce74
...
...
@@ -40,7 +40,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
const
Text
(
_text1
),
const
Text
(
_text2
),
Center
(
child:
Rais
edButton
(
child:
Elevat
edButton
(
child:
const
Text
(
'SHOW A SNACKBAR'
),
onPressed:
()
{
final
int
thisSnackBarIndex
=
_snackBarIndex
++;
...
...
dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart
View file @
1a08ce74
...
...
@@ -150,11 +150,11 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
title:
const
Text
(
'This form has errors'
),
content:
const
Text
(
'Really leave this form?'
),
actions:
<
Widget
>
[
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'YES'
),
onPressed:
()
{
Navigator
.
of
(
context
).
pop
(
true
);
},
),
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'NO'
),
onPressed:
()
{
Navigator
.
of
(
context
).
pop
(
false
);
},
),
...
...
@@ -279,7 +279,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
),
const
SizedBox
(
height:
24.0
),
Center
(
child:
Rais
edButton
(
child:
Elevat
edButton
(
child:
const
Text
(
'SUBMIT'
),
onPressed:
_handleSubmitted
,
),
...
...
dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart
View file @
1a08ce74
...
...
@@ -84,10 +84,11 @@ class _LoginPageState extends State<LoginPage> {
children:
<
Widget
>[
ButtonBar
(
children:
<
Widget
>[
FlatButton
(
child:
const
Text
(
'CANCEL'
),
shape:
const
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
7.0
)),
TextButton
(
style:
TextButton
.
styleFrom
(
shape:
const
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
7.0
)),
),
),
onPressed:
()
{
// The login screen is immediately displayed on top of
...
...
@@ -96,16 +97,19 @@ class _LoginPageState extends State<LoginPage> {
// of Shrine completely.
Navigator
.
of
(
context
,
rootNavigator:
true
).
pop
();
},
child:
const
Text
(
'CANCEL'
),
),
RaisedButton
(
child:
const
Text
(
'NEXT'
),
elevation:
8.0
,
shape:
const
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
7.0
)),
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
elevation:
8.0
,
shape:
const
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
7.0
)),
),
),
onPressed:
()
{
Navigator
.
pop
(
context
);
},
child:
const
Text
(
'NEXT'
),
),
],
),
...
...
dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart
View file @
1a08ce74
...
...
@@ -75,12 +75,13 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
bottom:
16.0
,
left:
16.0
,
right:
16.0
,
child:
RaisedButton
(
shape:
const
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
7.0
)),
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
primary:
kShrinePink100
,
shape:
const
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
7.0
)),
),
),
color:
kShrinePink100
,
splashColor:
kShrineBrown600
,
child:
const
Padding
(
padding:
EdgeInsets
.
symmetric
(
vertical:
12.0
),
child:
Text
(
'CLEAR CART'
),
...
...
dev/integration_tests/flutter_gallery/lib/gallery/example_code.dart
View file @
1a08ce74
...
...
@@ -13,9 +13,9 @@ class ButtonsDemo {
void
buttons
()
{
// START buttons_
rais
ed
// Create a
rais
ed button.
Rais
edButton
(
// START buttons_
elevat
ed
// Create a
n elevat
ed button.
Elevat
edButton
(
child:
const
Text
(
'BUTTON TITLE'
),
onPressed:
()
{
// Perform some action
...
...
@@ -25,14 +25,14 @@ RaisedButton(
// Create a disabled button.
// Buttons are disabled when onPressed isn't
// specified or is null.
const
Rais
edButton
(
const
Elevat
edButton
(
child:
Text
(
'BUTTON TITLE'
),
onPressed:
null
,
);
// Create a button with an icon and a
// title.
Rais
edButton
.
icon
(
Elevat
edButton
.
icon
(
icon:
const
Icon
(
Icons
.
add
,
size:
18.0
),
label:
const
Text
(
'BUTTON TITLE'
),
onPressed:
()
{
...
...
@@ -41,9 +41,9 @@ RaisedButton.icon(
);
// END
// START buttons_outline
// Create an outline button.
OutlineButton
(
// START buttons_outline
d
// Create an outline
d
button.
Outline
d
Button
(
child:
const
Text
(
'BUTTON TITLE'
),
onPressed:
()
{
// Perform some action
...
...
@@ -53,14 +53,14 @@ OutlineButton(
// Create a disabled button.
// Buttons are disabled when onPressed isn't
// specified or is null.
const
OutlineButton
(
const
Outline
d
Button
(
child:
Text
(
'BUTTON TITLE'
),
onPressed:
null
,
);
// Create a button with an icon and a
// title.
OutlineButton
.
icon
(
Outline
d
Button
.
icon
(
icon:
const
Icon
(
Icons
.
add
,
size:
18.0
),
label:
const
Text
(
'BUTTON TITLE'
),
onPressed:
()
{
...
...
@@ -69,9 +69,9 @@ OutlineButton.icon(
);
// END
// START buttons_
fla
t
// Create a
fla
t button.
Fla
tButton
(
// START buttons_
tex
t
// Create a
tex
t button.
Tex
tButton
(
child:
const
Text
(
'BUTTON TITLE'
),
onPressed:
()
{
// Perform some action
...
...
@@ -81,7 +81,7 @@ FlatButton(
// Create a disabled button.
// Buttons are disabled when onPressed isn't
// specified or is null.
const
Fla
tButton
(
const
Tex
tButton
(
child:
Text
(
'BUTTON TITLE'
),
onPressed:
null
,
);
...
...
dev/integration_tests/flutter_gallery/lib/gallery/options.dart
View file @
1a08ce74
...
...
@@ -158,7 +158,7 @@ class _ActionItem extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
_OptionsItem
(
child:
_
Fla
tButton
(
child:
_
Tex
tButton
(
onPressed:
onTap
,
child:
Text
(
text
),
),
...
...
@@ -166,21 +166,23 @@ class _ActionItem extends StatelessWidget {
}
}
class
_
Fla
tButton
extends
StatelessWidget
{
const
_
Fla
tButton
({
Key
key
,
this
.
onPressed
,
this
.
child
})
:
super
(
key:
key
);
class
_
Tex
tButton
extends
StatelessWidget
{
const
_
Tex
tButton
({
Key
key
,
this
.
onPressed
,
this
.
child
})
:
super
(
key:
key
);
final
VoidCallback
onPressed
;
final
Widget
child
;
@override
Widget
build
(
BuildContext
context
)
{
return
FlatButton
(
padding:
EdgeInsets
.
zero
,
onPressed:
onPressed
,
child:
DefaultTextStyle
(
style:
Theme
.
of
(
context
).
primaryT
extTheme
.
subtitle1
,
child:
child
,
final
ThemeData
theme
=
Theme
.
of
(
context
);
return
TextButton
(
style:
TextButton
.
styleFrom
(
primary:
theme
.
colorScheme
.
onPrimary
,
textStyle:
theme
.
t
extTheme
.
subtitle1
,
padding:
EdgeInsets
.
zero
,
),
onPressed:
onPressed
,
child:
child
,
);
}
}
...
...
dev/integration_tests/flutter_gallery/lib/gallery/themes.dart
View file @
1a08ce74
...
...
@@ -21,7 +21,7 @@ ThemeData _buildDarkTheme() {
final
ColorScheme
colorScheme
=
const
ColorScheme
.
dark
().
copyWith
(
primary:
primaryColor
,
secondary:
secondaryColor
,
onPrimary:
secondaryColor
,
onPrimary:
Colors
.
white
,
);
final
ThemeData
base
=
ThemeData
(
brightness:
Brightness
.
dark
,
...
...
@@ -30,7 +30,6 @@ ThemeData _buildDarkTheme() {
primaryColor:
primaryColor
,
primaryColorDark:
const
Color
(
0xFF0050a0
),
primaryColorLight:
secondaryColor
,
buttonColor:
primaryColor
,
indicatorColor:
Colors
.
white
,
toggleableActiveColor:
const
Color
(
0xFF6997DF
),
accentColor:
secondaryColor
,
...
...
@@ -38,10 +37,6 @@ ThemeData _buildDarkTheme() {
scaffoldBackgroundColor:
const
Color
(
0xFF202124
),
backgroundColor:
const
Color
(
0xFF202124
),
errorColor:
const
Color
(
0xFFB00020
),
buttonTheme:
ButtonThemeData
(
colorScheme:
colorScheme
,
textTheme:
ButtonTextTheme
.
primary
,
),
);
return
base
.
copyWith
(
textTheme:
_buildTextTheme
(
base
.
textTheme
),
...
...
@@ -62,7 +57,6 @@ ThemeData _buildLightTheme() {
accentColorBrightness:
Brightness
.
dark
,
colorScheme:
colorScheme
,
primaryColor:
primaryColor
,
buttonColor:
primaryColor
,
indicatorColor:
Colors
.
white
,
toggleableActiveColor:
const
Color
(
0xFF1E88E5
),
splashColor:
Colors
.
white24
,
...
...
@@ -72,10 +66,6 @@ ThemeData _buildLightTheme() {
scaffoldBackgroundColor:
Colors
.
white
,
backgroundColor:
Colors
.
white
,
errorColor:
const
Color
(
0xFFB00020
),
buttonTheme:
ButtonThemeData
(
colorScheme:
colorScheme
,
textTheme:
ButtonTextTheme
.
primary
,
),
);
return
base
.
copyWith
(
textTheme:
_buildTextTheme
(
base
.
textTheme
),
...
...
dev/integration_tests/flutter_gallery/lib/gallery/updater.dart
View file @
1a08ce74
...
...
@@ -52,13 +52,13 @@ class UpdaterState extends State<Updater> {
title:
const
Text
(
'Update Flutter Gallery?'
),
content:
Text
(
'A newer version is available.'
,
style:
dialogTextStyle
),
actions:
<
Widget
>[
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'NO THANKS'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
false
);
},
),
Fla
tButton
(
Tex
tButton
(
child:
const
Text
(
'UPDATE'
),
onPressed:
()
{
Navigator
.
pop
(
context
,
true
);
...
...
dev/integration_tests/flutter_gallery/test/accessibility_test.dart
View file @
1a08ce74
...
...
@@ -478,14 +478,12 @@ void main() {
group
(
'All material demos meet text contrast guidelines'
,
()
{
final
List
<
ThemeData
>
themes
=
<
ThemeData
>[
kLightGalleryTheme
,
ThemeData
.
light
(),
ThemeData
.
dark
(),
kDarkGalleryTheme
,
];
const
List
<
String
>
themeNames
=
<
String
>[
'kLightGalleryTheme'
,
'ThemeData.light()'
,
'ThemeData.dark()'
,
'kDarkGalleryTheme'
,
];
for
(
int
themeIndex
=
0
;
themeIndex
<
themes
.
length
;
themeIndex
+=
1
)
{
...
...
dev/integration_tests/flutter_gallery/test/demo/material/text_form_field_demo_test.dart
View file @
1a08ce74
...
...
@@ -10,7 +10,7 @@ void main() {
testWidgets
(
'validates name field correctly'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
TextFormFieldDemo
()));
final
Finder
submitButton
=
find
.
widgetWithText
(
Rais
edButton
,
'SUBMIT'
);
final
Finder
submitButton
=
find
.
widgetWithText
(
Elevat
edButton
,
'SUBMIT'
);
expect
(
submitButton
,
findsOneWidget
);
final
Finder
nameField
=
find
.
widgetWithText
(
TextFormField
,
'Name *'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment