Skip to content

Commit

Permalink
Merge branch 'main' into fix-10029
Browse files Browse the repository at this point in the history
  • Loading branch information
atsansone authored Jan 30, 2024
2 parents 67c6846 + 6c7b089 commit 651dfd9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
22 changes: 0 additions & 22 deletions src/_sass/components/_content.scss
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
@use '../base/variables' as *;
@use '../vendor/bootstrap';

// Header clearance of top nav
@mixin _header-clearance {
$clearance: 100px;

margin-top: -$clearance;
padding-top: $clearance;
}

@mixin header-clearance {
@include _header-clearance;

content: "";
display: block;
}

// Material design icons
@mixin md-icon-content($icon-name, $width: '', $bottom: true) {
font-family: $site-font-family-icon;
Expand Down Expand Up @@ -83,13 +68,6 @@
h1, h2, h3, h4, h5, h6 {
text-wrap: balance;

// Invisible pre-element to avoid modifying styles on headings.
&[id]:not(.no_toc)::before { @include header-clearance; }

// This case is for jekyll-toc entries that use the computed header id, rather than
// the Kramdown id override specified using the {#foo} markdown-extension syntax.
> a[id]::before { @include header-clearance; }

$icon-size: 1.5rem;
$anchor-padding: 0.25rem;

Expand Down
18 changes: 13 additions & 5 deletions src/cookbook/forms/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ a single text field using the following steps:

## 1. Create a `Form` with a `GlobalKey`

First, create a [`Form`][].
The `Form` widget acts as a container for grouping
and validating multiple form fields.
Create a [`Form`][].
The `Form` widget acts as a container for grouping and
validating multiple form fields.

When creating the form, provide a [`GlobalKey`][].
This uniquely identifies the `Form`,
and allows validation of the form in a later step.
This assigns a unique identifier to your `Form`.
It also allows you to validate the form later.

Create the form as a `StatefulWidget`.
This allows you to create a unique `GlobalKey<FormState>()` once.
You can then store it as a variable and access it at different points.

If you made this a `StatelessWidget`, you'd need to store this key *somewhere*.
As it is resource expensive, you wouldn't want to generate a new
`GlobalKey` each time you run the `build` method.

<?code-excerpt "lib/form.dart"?>
```dart
Expand Down

0 comments on commit 651dfd9

Please sign in to comment.