Skip to content

Commit 08ca903

Browse files
feat: use elevated button
1 parent b67ab23 commit 08ca903

File tree

6 files changed

+25
-58
lines changed

6 files changed

+25
-58
lines changed

example/lib/sources/complete_form.dart

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -320,23 +320,20 @@ class _CompleteFormState extends State<CompleteForm> {
320320
],
321321
),
322322
),
323+
const SizedBox(height: 8),
323324
Row(
324325
children: <Widget>[
325326
Expanded(
326327
child: ElevatedButton(
327-
onPressed: () {
328-
if (_formKey.currentState?.saveAndValidate() ?? false) {
329-
debugPrint(_formKey.currentState?.value.toString());
330-
} else {
331-
debugPrint(_formKey.currentState?.value.toString());
332-
debugPrint('validation failed');
333-
}
334-
},
335-
child: const Text(
336-
'Submit',
337-
style: TextStyle(color: Colors.white),
338-
),
339-
),
328+
onPressed: () {
329+
if (_formKey.currentState?.saveAndValidate() ?? false) {
330+
debugPrint(_formKey.currentState?.value.toString());
331+
} else {
332+
debugPrint(_formKey.currentState?.value.toString());
333+
debugPrint('validation failed');
334+
}
335+
},
336+
child: const Text('Submit')),
340337
),
341338
const SizedBox(width: 20),
342339
Expanded(
@@ -345,11 +342,7 @@ class _CompleteFormState extends State<CompleteForm> {
345342
_formKey.currentState?.reset();
346343
},
347344
// color: Theme.of(context).colorScheme.secondary,
348-
child: Text(
349-
'Reset',
350-
style: TextStyle(
351-
color: Theme.of(context).colorScheme.secondary),
352-
),
345+
child: const Text('Reset'),
353346
),
354347
),
355348
],

example/lib/sources/conditional_fields.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,8 @@ class _ConditionalFieldsState extends State<ConditionalFields> {
5454
child: const Text('Magic info'),
5555
),
5656
const SizedBox(height: 10),
57-
MaterialButton(
58-
color: Theme.of(context).colorScheme.secondary,
59-
child: const Text(
60-
"Submit",
61-
style: TextStyle(color: Colors.white),
62-
),
57+
ElevatedButton(
58+
child: const Text("Submit"),
6359
onPressed: () {
6460
_formKey.currentState!.saveAndValidate();
6561
debugPrint(_formKey.currentState?.instantValue.toString() ?? '');

example/lib/sources/custom_fields.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,8 @@ class _CustomFieldsState extends State<CustomFields> {
8080
Row(
8181
children: <Widget>[
8282
Expanded(
83-
child: MaterialButton(
84-
color: Theme.of(context).colorScheme.secondary,
85-
child: const Text(
86-
"Submit",
87-
style: TextStyle(color: Colors.white),
88-
),
83+
child: ElevatedButton(
84+
child: const Text("Submit"),
8985
onPressed: () {
9086
_formKey.currentState!.save();
9187
if (_formKey.currentState!.validate()) {
@@ -98,12 +94,8 @@ class _CustomFieldsState extends State<CustomFields> {
9894
),
9995
const SizedBox(width: 20),
10096
Expanded(
101-
child: MaterialButton(
102-
color: Theme.of(context).colorScheme.secondary,
103-
child: const Text(
104-
"Reset",
105-
style: TextStyle(color: Colors.white),
106-
),
97+
child: ElevatedButton(
98+
child: const Text("Reset"),
10799
onPressed: () {
108100
_formKey.currentState!.reset();
109101
},

example/lib/sources/dynamic_fields.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ class _DynamicFieldsState extends State<DynamicFields> {
4646
Row(
4747
children: <Widget>[
4848
Expanded(
49-
child: MaterialButton(
50-
color: Theme.of(context).colorScheme.secondary,
51-
child: const Text(
52-
"Submit",
53-
style: TextStyle(color: Colors.white),
54-
),
49+
child: ElevatedButton(
50+
child: const Text("Submit"),
5551
onPressed: () {
5652
_formKey.currentState!.saveAndValidate();
5753
setState(() {
@@ -63,12 +59,8 @@ class _DynamicFieldsState extends State<DynamicFields> {
6359
),
6460
const SizedBox(width: 20),
6561
Expanded(
66-
child: MaterialButton(
67-
color: Theme.of(context).colorScheme.secondary,
68-
child: const Text(
69-
"Add field",
70-
style: TextStyle(color: Colors.white),
71-
),
62+
child: ElevatedButton(
63+
child: const Text("Add field"),
7264
onPressed: () {
7365
final newTextFieldName = 'name_${_newTextFieldId++}';
7466
final newTextFieldKey = ValueKey(_newTextFieldId);

example/lib/sources/related_fields.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,8 @@ class _RelatedFieldsState extends State<RelatedFields> {
6464
.toList(),
6565
),
6666
const SizedBox(height: 10),
67-
MaterialButton(
68-
color: Theme.of(context).colorScheme.secondary,
69-
child: const Text(
70-
"Submit",
71-
style: TextStyle(color: Colors.white),
72-
),
67+
ElevatedButton(
68+
child: const Text("Submit"),
7369
onPressed: () {
7470
_formKey.currentState!.saveAndValidate();
7571
debugPrint(_formKey.currentState?.instantValue.toString() ?? '');

example/lib/sources/signup_form.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ class _SignupFormState extends State<SignupForm> {
8989
},
9090
),
9191
const SizedBox(height: 10),
92-
MaterialButton(
93-
color: Theme.of(context).colorScheme.secondary,
92+
ElevatedButton(
9493
onPressed: () {
9594
if (_formKey.currentState?.saveAndValidate() ?? false) {
9695
if (true) {
@@ -103,8 +102,7 @@ class _SignupFormState extends State<SignupForm> {
103102
}
104103
debugPrint(_formKey.currentState?.value.toString());
105104
},
106-
child:
107-
const Text('Signup', style: TextStyle(color: Colors.white)),
105+
child: const Text('Signup'),
108106
)
109107
],
110108
),

0 commit comments

Comments
 (0)