Skip to content

Commit ac50e99

Browse files
authored
Fix formatting of some code alongside image cases (#12723)
We plan to move away from this format soon, but fix the broken rendering until we have a chance to do so. Fixes #12717
1 parent 7716540 commit ac50e99

File tree

2 files changed

+73
-74
lines changed

2 files changed

+73
-74
lines changed

src/content/get-started/fundamentals/layout.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ The first figure on this page used both.
203203
This is the most basic example of using a `Row` widget.
204204

205205
{% render "docs/code-and-image.md",
206-
image:"fwe/layout/row.png",
207-
caption: "This figure shows a row widget with three children."
208-
alt: "A screenshot of a row widget with three children"
206+
image: "fwe/layout/row.png",
207+
caption: "This figure shows a row widget with three children.",
208+
alt: "A screenshot of a row widget with three children",
209209
code:"
210210
```dart
211211
Widget build(BuildContext context) {
@@ -228,9 +228,9 @@ of the images in the example above using columns.
228228

229229

230230
{% render "docs/code-and-image.md",
231-
image:"fwe/layout/nested_row_column.png",
232-
caption: "This figure shows a row widget with three children, each of which is a column."
233-
alt: "A screenshot of a row of three widgets, each of which has a label underneath it."
231+
image: "fwe/layout/nested_row_column.png",
232+
caption: "This figure shows a row widget with three children, each of which is a column.",
233+
alt: "A screenshot of a row of three widgets, each of which has a label underneath it.",
234234
code:"
235235
```dart
236236
Widget build(BuildContext context) {
@@ -287,9 +287,9 @@ divides the free horizontal space evenly between,
287287
before, and after each image.
288288

289289
{% render "docs/code-and-image.md",
290-
image:"fwe/layout/space_evenly.png",
291-
caption: "This figure shows a row widget with three children, which are aligned with the MainAxisAlignment.spaceEvenly constant."
292-
alt: "A screenshot of three widgets, spaced evenly from each other."
290+
image: "fwe/layout/space_evenly.png",
291+
caption: "This figure shows a row widget with three children, which are aligned with the MainAxisAlignment.spaceEvenly constant.",
292+
alt: "A screenshot of three widgets, spaced evenly from each other.",
293293
code:"
294294
```dart
295295
Widget build(BuildContext context) {
@@ -340,9 +340,9 @@ images is too wide for its render box,
340340
wrap each image with an [`Expanded`][] widget.
341341

342342
{% render "docs/code-and-image.md",
343-
image:"fwe/layout/expanded_row.png",
344-
caption: "This figure shows a row widget with three children that are wrapped with `Expanded` widgets."
345-
alt: "A screenshot of three widgets, which take up exactly the amount of space available on the main axis. All three widgets are equal width."
343+
image: "fwe/layout/expanded_row.png",
344+
caption: "This figure shows a row widget with three children that are wrapped with `Expanded` widgets.",
345+
alt: "A screenshot of three widgets, which take up exactly the amount of space available on the main axis. All three widgets are equal width.",
346346
code:"
347347
```dart
348348
Widget build(BuildContext context) {
@@ -375,9 +375,9 @@ The following code sets the flex factor of the
375375
middle image to 2:
376376

377377
{% render "docs/code-and-image.md",
378-
image:"fwe/layout/flex_2_row.png",
379-
caption: "This figure shows a row widget with three children which are wrapped with `Expanded` widgets. The center child has it's `flex` property set to 2."
380-
alt: "A screenshot of three widgets, which take up exactly the amount of space available on the main axis. The widget in the center is twice as wide as the widgets on the left and right."
378+
image: "fwe/layout/flex_2_row.png",
379+
caption: "This figure shows a row widget with three children which are wrapped with `Expanded` widgets. The center child has it's `flex` property set to 2.",
380+
alt: "A screenshot of three widgets, which take up exactly the amount of space available on the main axis. The widget in the center is twice as wide as the widgets on the left and right.",
381381
code:"
382382
```dart
383383
Widget build(BuildContext context) {
@@ -470,9 +470,9 @@ all the available space on the cross axis,
470470
as shown in the example below.
471471

472472
{% render "docs/code-and-image.md",
473-
image:"fwe/layout/basic_listview.png",
474-
caption: "This figure shows a ListView widget with three children."
475-
alt: "A screenshot of three widgets laid out vertically. They have expanded to take up all available space on the cross axis."
473+
image: "fwe/layout/basic_listview.png",
474+
caption: "This figure shows a ListView widget with three children.",
475+
alt: "A screenshot of three widgets laid out vertically. They have expanded to take up all available space on the cross axis.",
476476
code:"
477477
```dart
478478
Widget build(BuildContext context) {
@@ -501,9 +501,9 @@ and therefore the number of todos is unknown.
501501

502502

503503
{% render "docs/code-and-image.md",
504-
image:"fwe/layout/listview_builder.png",
505-
caption: "This figure shows the ListView.builder constructor to display an unknown number of children."
506-
alt: "A screenshot of several widgets laid out vertically. They have expanded to take up all available space on the cross axis."
504+
image: "fwe/layout/listview_builder.png",
505+
caption: "This figure shows the ListView.builder constructor to display an unknown number of children.",
506+
alt: "A screenshot of several widgets laid out vertically. They have expanded to take up all available space on the cross axis.",
507507
code:"
508508
```dart
509509
final List<ToDo> items = Repository.fetchTodos();
@@ -599,9 +599,9 @@ or greater than 600 pixels.
599599

600600

601601
{% render "docs/code-and-image.md",
602-
image:"fwe/layout/layout_builder.png",
603-
caption: "This figure shows a narrow layout, which lays out its children vertically, and a wider layout, which lays out its children in a grid."
604-
alt: "Two screenshots, in which one shows a narrow layout and the other shows a wide layout."
602+
image: "fwe/layout/layout_builder.png",
603+
caption: "This figure shows a narrow layout, which lays out its children vertically, and a wider layout, which lays out its children in a grid.",
604+
alt: "Two screenshots, in which one shows a narrow layout and the other shows a wide layout.",
605605
code:"
606606
```dart
607607
Widget build(BuildContext context) {
@@ -667,8 +667,8 @@ the following example changes the
667667
background color of every other list item.
668668

669669
{% render "docs/code-and-image.md",
670-
image:"fwe/layout/alternating_list_items.png"
671-
caption:"This figure shows a `ListView`, in which its children have alternating background colors. The background colors were determined programmatically based on the index of the child within the `ListView`."
670+
image: "fwe/layout/alternating_list_items.png",
671+
caption:"This figure shows a `ListView`, in which its children have alternating background colors. The background colors were determined programmatically based on the index of the child within the `ListView`.",
672672
code:"
673673
```dart
674674
final List<ToDo> items = Repository.fetchTodos();

src/content/get-started/fundamentals/user-input.md

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ You can style a button based on its state using `WidgetStateProperty`.
111111

112112

113113
{% render "docs/code-and-image.md",
114-
image:"fwe/user-input/ElevatedButton.webp",
115-
caption: "This figure shows an ElevatedButton with the text \"Enabled\" being clicked."
116-
alt: "A GIF of an elevated button with the text 'Enabled'"
114+
image: "fwe/user-input/ElevatedButton.webp",
115+
caption: "This figure shows an ElevatedButton with the text \"Enabled\" being clicked.",
116+
alt: "A GIF of an elevated button with the text 'Enabled'",
117117
code:"
118118
```dart
119119
int count = 0;
@@ -166,9 +166,9 @@ but doesn't allow users to highlight or copy the text.
166166
`SelectableText` displays a string of _user-selectable_ text.
167167

168168
{% render "docs/code-and-image.md",
169-
image:"fwe/user-input/SelectableText.webp",
170-
caption: "This figure shows a cursor highlighting a portion of a string of text."
171-
alt: 'A GIF of a cursor highlighting two lines of text from a paragraph.'
169+
image: "fwe/user-input/SelectableText.webp",
170+
caption: "This figure shows a cursor highlighting a portion of a string of text.",
171+
alt: 'A GIF of a cursor highlighting two lines of text from a paragraph.',
172172
code:"
173173
```dart
174174
@override
@@ -196,9 +196,9 @@ different text styles. It's not for handling user input,
196196
but is useful if you're allowing users edit and format text.
197197

198198
{% render "docs/code-and-image.md",
199-
image:"fwe/user-input/RichText.png",
200-
caption: "This figure shows a string of text formatted with different text styles."
201-
alt: 'A screenshot of the text "Hello bold world!" with the word "bold" in bold font.'
199+
image: "fwe/user-input/RichText.png",
200+
caption: "This figure shows a string of text formatted with different text styles.",
201+
alt: 'A screenshot of the text "Hello bold world!" with the word "bold" in bold font.',
202202
code:"
203203
```dart
204204
@override
@@ -252,9 +252,9 @@ The class supports other configurable properties, such as
252252
`readOnly` which prevents the user from changing the text.
253253

254254
{% render "docs/code-and-image.md",
255-
image:"fwe/user-input/TextField.webp",
256-
caption: "This figure shows text being typed into a TextField with a selected border and label."
257-
alt: "A GIF of a text field with the label 'Mascot Name', purple focus border and the phrase 'Dash the hummingbird' being typed in."
255+
image: "fwe/user-input/TextField.webp",
256+
caption: "This figure shows text being typed into a TextField with a selected border and label.",
257+
alt: "A GIF of a text field with the label 'Mascot Name', purple focus border and the phrase 'Dash the hummingbird' being typed in.",
258258
code:"
259259
```dart
260260
final TextEditingController _controller = TextEditingController();
@@ -396,14 +396,13 @@ A `SegmentedButton` has a few relevant properties:
396396
providing a way to configure a `selectedIcon`.
397397

398398
{% render "docs/code-and-image.md",
399-
image:"fwe/user-input/segmented-button.webp",
399+
image: "fwe/user-input/segmented-button.webp",
400400
caption: "This figure shows a SegmentedButton, each segment with an icon and
401-
text representing its value."
401+
text representing its value.",
402402
alt: "A GIF of a SegmentedButton with 4 segments: Day, Week, Month, and Year.
403403
Each has a calendar icon to represent its value and a text label.
404-
Day is first selected, then week and month, then year."
404+
Day is first selected, then week and month, then year.",
405405
code:"
406-
407406
```dart
408407
enum Calendar { day, week, month, year }
409408
@@ -471,11 +470,11 @@ multiple horizontal or vertical runs, to make sure your chips wrap and
471470
don't get cut off at the edge of your app.
472471

473472
{% render "docs/code-and-image.md",
474-
image:"fwe/user-input/chip.png",
473+
image: "fwe/user-input/chip.png",
475474
caption: "This figure shows two rows of Chip widgets, each containing a circular
476-
leading profile image and content text."
475+
leading profile image and content text.",
477476
alt: "A screenshot of 4 Chips split over two rows with a leading circular
478-
profile image with content text."
477+
profile image with content text.",
479478
code:"
480479
```dart
481480
@override
@@ -541,12 +540,12 @@ Configuration parameters include the following:
541540
customizing the widget's look and behavior.
542541

543542
{% render "docs/code-and-image.md",
544-
image:"fwe/user-input/dropdownmenu.webp",
543+
image: "fwe/user-input/dropdownmenu.webp",
545544
caption: "This figure shows a DropdownMenu widget with 5 value options. Each
546-
option's text color is styled to represent the color value."
545+
option's text color is styled to represent the color value.",
547546
alt: "A GIF the DropdownMenu widget that is selected, it displays 5 options:
548547
Blue, Pink, Green, Orange, and Grey. The option text is displayed in the color
549-
of its value."
548+
of its value.",
550549
code:"
551550
```dart
552551
enum ColorLabel {
@@ -615,12 +614,12 @@ Configuration parameters for the `Slider` widget:
615614

616615

617616
{% render "docs/code-and-image.md",
618-
image:"fwe/user-input/slider.webp",
617+
image: "fwe/user-input/slider.webp",
619618
caption: "This figure shows a slider widget with a value ranging from 0.0 to 5.0
620619
broken up into 5 divisions. It shows the current value as a label as the dial
621-
is dragged."
620+
is dragged.",
622621
alt: "A GIF of a slider that has the dial dragged left to right in increments
623-
of 1, from 0.0 to 5.0"
622+
of 1, from 0.0 to 5.0",
624623
code:"
625624
```dart
626625
double _currentVolume = 1;
@@ -682,10 +681,10 @@ The configuration for `Checkbox` and `Switch` contain:
682681
### Checkbox
683682

684683
{% render "docs/code-and-image.md",
685-
image:"fwe/user-input/checkbox.webp",
686-
caption: "This figure shows a checkbox being checked and unchecked."
684+
image: "fwe/user-input/checkbox.webp",
685+
caption: "This figure shows a checkbox being checked and unchecked.",
687686
alt: "A GIF that shows a pointer clicking a checkbox
688-
and then clicking again to uncheck it."
687+
and then clicking again to uncheck it.",
689688
code:"
690689
```dart
691690
bool isChecked = false;
@@ -708,11 +707,11 @@ Widget build(BuildContext context) {
708707
### Switch
709708

710709
{% render "docs/code-and-image.md",
711-
image:"fwe/user-input/Switch.webp",
712-
caption: "This figure shows a Switch widget that is toggled on and off."
710+
image: "fwe/user-input/Switch.webp",
711+
caption: "This figure shows a Switch widget that is toggled on and off.",
713712
alt: "A GIF of a Switch widget that is toggled on and off. In its off state,
714713
it is gray with dark gray borders. In its on state,
715-
it is red with a light red border."
714+
it is red with a light red border.",
716715
code:"
717716
```dart
718717
bool light = true;
@@ -748,11 +747,11 @@ the other radio buttons are unselected.
748747
gets triggered when users click it, like `Switch` and `Checkbox`.
749748

750749
{% render "docs/code-and-image.md",
751-
image:"fwe/user-input/Radio.webp",
750+
image: "fwe/user-input/Radio.webp",
752751
caption: "This figure shows a column of ListTiles containing a radio button and
753-
label, where only one radio button can be selected at a time."
752+
label, where only one radio button can be selected at a time.",
754753
alt: "A GIF of 4 ListTiles in a column, each containing a leading Radio button
755-
and title text. The Radio buttons are selected in order from top to bottom."
754+
and title text. The Radio buttons are selected in order from top to bottom.",
756755
code:"
757756
```dart
758757
enum Character { musician, chef, firefighter, artist }
@@ -810,12 +809,12 @@ These convenience widgets are the same checkbox and switch widgets,
810809
but support a label (as a `ListTile`).
811810

812811
{% render "docs/code-and-image.md",
813-
image:"fwe/user-input/SpecialListTiles.webp",
812+
image: "fwe/user-input/SpecialListTiles.webp",
814813
caption: "This figure shows a column containing a CheckboxListTile and
815-
a SwitchListTile being toggled."
814+
a SwitchListTile being toggled.",
816815
alt: "A ListTile with a leading icon, title text, and a trailing checkbox being
817816
checked and unchecked. It also shows a ListTile with a leading icon, title text
818-
and a switch being toggled on and off."
817+
and a switch being toggled on and off.",
819818
code:"
820819
```dart
821820
double timeDilation = 1.0;
@@ -893,12 +892,12 @@ which returns a `Future<DateTime>`,
893892
so don't forget to await the asynchronous function call!
894893

895894
{% render "docs/code-and-image.md",
896-
image:"fwe/user-input/DatePicker.webp",
895+
image: "fwe/user-input/DatePicker.webp",
897896
caption: "This figure shows a DatePicker that is displayed when the
898-
'Pick a date' button is clicked."
897+
'Pick a date' button is clicked.",
899898
alt: "A GIF of a pointer clicking a button that says 'Pick a date',
900899
then shows a date picker. The date Friday, August 30 is selected and the 'OK'
901-
button is clicked."
900+
button is clicked.",
902901
code:"
903902
```dart
904903
DateTime? selectedDate;
@@ -910,7 +909,7 @@ Widget build(BuildContext context) {
910909
return Column(children: [
911910
Text(
912911
date == null
913-
? "You haven't picked a date yet."
912+
? 'You haven\\\'t picked a date yet.'
914913
: DateFormat('MM-dd-yyyy').format(date),
915914
),
916915
ElevatedButton.icon(
@@ -944,12 +943,12 @@ Instead of returning a `Future<DateTime>`,
944943
Once again, don't forget to await the function call!
945944

946945
{% render "docs/code-and-image.md",
947-
image:"fwe/user-input/TimePicker.webp",
946+
image: "fwe/user-input/TimePicker.webp",
948947
caption: "This figure shows a TimePicker that is displayed when the
949-
'Pick a time' button is clicked."
948+
'Pick a time' button is clicked.",
950949
alt: "A GIF of a pointer clicking a button that says 'Pick a time', then shows
951950
a time picker. The time picker shows a circular clock as the cursor moves the
952-
hour hand, then minute hand, selects PM, then the 'OK' button is clicked."
951+
hour hand, then minute hand, selects PM, then the 'OK' button is clicked.",
953952
code:"
954953
```dart
955954
TimeOfDay? selectedTime;
@@ -960,7 +959,7 @@ Widget build(BuildContext context) {
960959
961960
return Column(children: [
962961
Text(
963-
time == null ? "You haven't picked a time yet." : time.format(context),
962+
time == null ? 'You haven\\\'t picked a time yet.' : time.format(context),
964963
),
965964
ElevatedButton.icon(
966965
icon: const Icon(Icons.calendar_today),
@@ -1015,11 +1014,11 @@ It has a number of configuration parameters, including:
10151014
identified from sibling `Dismissible` widgets in the widget tree.
10161015

10171016
{% render "docs/code-and-image.md",
1018-
image:"fwe/user-input/Dismissible.webp",
1017+
image: "fwe/user-input/Dismissible.webp",
10191018
caption: "This figure shows a list of Dismissible widgets that each contain a
10201019
ListTile. Swiping across the ListTile reveals a green background and makes the tile
1021-
disappear."
1022-
alt: "A screenshot of three widgets, spaced evenly from each other."
1020+
disappear.",
1021+
alt: "A screenshot of three widgets, spaced evenly from each other.",
10231022
code:"
10241023
```dart
10251024
List<int> items = List<int>.generate(100, (int index) => index);

0 commit comments

Comments
 (0)