From 4c8a63b17b564633e8133f266a5f462362a43f53 Mon Sep 17 00:00:00 2001 From: Mithul Nayagam <113115383+Potatomonsta@users.noreply.github.com> Date: Fri, 17 Apr 2026 19:00:06 +0530 Subject: [PATCH 1/6] docs: enhance widget documentation with playground examples and JSON structures - Added playground examples and JSON structures for various widgets including AlertDialog, Align, AppBar, AspectRatio, AutoComplete, BackdropFilter, Badge, BottomNavigationBar, Card, CarouselView, Center, CheckBox, Chip, CircleAvatar, CircularProgressIndicator, ClipOval, ClipRRect, and ColoredBox. - Updated documentation format to include tabs for Dart code, JSON representation, and live preview. --- docs/widgets/alert_dialog.mdx | 100 ++++++++- docs/widgets/align.mdx | 71 +++++- docs/widgets/app_bar.mdx | 73 +++++- docs/widgets/aspect_ratio.mdx | 57 ++++- docs/widgets/auto_complete.mdx | 69 +++++- docs/widgets/backdrop_filter.mdx | 91 +++++++- docs/widgets/badge.mdx | 61 ++++- docs/widgets/bottom_navigation_bar.mdx | 131 ++++++++++- docs/widgets/card.mdx | 76 ++++++- docs/widgets/carousel_view.mdx | 101 ++++++++- docs/widgets/center.mdx | 55 ++++- docs/widgets/check_box.mdx | 69 +++++- docs/widgets/chip.mdx | 137 ++++++++++-- docs/widgets/circle_avatar.mdx | 59 ++++- docs/widgets/circular_progress_indicator.mdx | 55 ++++- docs/widgets/clip_oval.mdx | 60 ++++- docs/widgets/clip_rrect.mdx | 60 ++++- docs/widgets/colored_box.mdx | 56 ++++- docs/widgets/column.mdx | 69 +++++- docs/widgets/conditional.mdx | 59 ++++- docs/widgets/container.mdx | 99 +++++++-- docs/widgets/custom_scroll_view.mdx | 70 +++++- docs/widgets/divider.mdx | 60 ++++- docs/widgets/drawer.mdx | 83 ++++++- docs/widgets/dropdown_menu.mdx | 83 ++++++- docs/widgets/dynamic_view.mdx | 58 ++++- docs/widgets/elevated_button.mdx | 65 +++++- docs/widgets/expanded.mdx | 56 ++++- docs/widgets/filled_button.mdx | 65 +++++- docs/widgets/fitted_box.mdx | 60 ++++- docs/widgets/flexible.mdx | 57 ++++- docs/widgets/floating_action_button.mdx | 96 +++++++- docs/widgets/form.mdx | 97 +++++++- docs/widgets/fractionally_sized_box.mdx | 62 +++++- docs/widgets/gesture_detector.mdx | 72 +++++- docs/widgets/grid_view.mdx | 99 ++++++++- docs/widgets/hero.mdx | 55 ++++- docs/widgets/icon.mdx | 58 ++++- docs/widgets/icon_button.mdx | 103 ++++++++- docs/widgets/image.mdx | 55 ++++- docs/widgets/ink_well.mdx | 77 ++++++- docs/widgets/limited_box.mdx | 56 ++++- docs/widgets/linear_progress_indicator.mdx | 60 ++++- docs/widgets/list_tile.mdx | 140 +++++++++++- docs/widgets/listview.mdx | 222 ++++++++++++++++++- docs/widgets/network_widget.mdx | 58 ++++- docs/widgets/opacity.mdx | 72 +++++- docs/widgets/outlined_button.mdx | 64 +++++- docs/widgets/padding.mdx | 61 ++++- docs/widgets/page_view.mdx | 98 +++++++- docs/widgets/placeholder.mdx | 60 ++++- docs/widgets/positioned.mdx | 58 ++++- docs/widgets/radio_group.mdx | 107 ++++++++- docs/widgets/refresh_indicator.mdx | 57 ++++- docs/widgets/row.mdx | 71 +++++- docs/widgets/safe_area.mdx | 60 ++++- docs/widgets/scaffold.mdx | 93 +++++++- docs/widgets/selectable_text.mdx | 58 ++++- docs/widgets/set_value.mdx | 74 ++++++- docs/widgets/single_child_scroll_view.mdx | 72 +++++- docs/widgets/sized_box.mdx | 51 ++++- docs/widgets/slider.mdx | 72 +++++- docs/widgets/sliver_app_bar.mdx | 76 ++++++- docs/widgets/sliver_fill_remaining.mdx | 59 ++++- docs/widgets/sliver_grid.mdx | 118 +++++++++- docs/widgets/sliver_list.mdx | 97 +++++++- docs/widgets/sliver_opacity.mdx | 67 +++++- docs/widgets/sliver_padding.mdx | 73 +++++- docs/widgets/sliver_safe_area.mdx | 59 ++++- docs/widgets/sliver_to_box_adapter.mdx | 71 +++++- docs/widgets/sliver_visibility.mdx | 67 +++++- docs/widgets/spacer.mdx | 52 ++++- docs/widgets/stack.mdx | 67 +++++- docs/widgets/switch.mdx | 52 ++++- docs/widgets/tab_bar.mdx | 96 +++++++- docs/widgets/table.mdx | 195 ++++++++++++++-- docs/widgets/table_cell.mdx | 66 +++++- docs/widgets/table_row.mdx | 104 ++++++++- docs/widgets/text.mdx | 57 ++++- docs/widgets/text_button.mdx | 65 +++++- docs/widgets/text_field.mdx | 64 +++++- docs/widgets/text_form_field.mdx | 74 ++++++- docs/widgets/tool_tip.mdx | 57 ++++- docs/widgets/vertical_divider.mdx | 55 ++++- docs/widgets/visibility.mdx | 55 ++++- docs/widgets/webview.mdx | 52 ++++- docs/widgets/wrap.mdx | 121 +++++++++- 87 files changed, 6181 insertions(+), 441 deletions(-) diff --git a/docs/widgets/alert_dialog.mdx b/docs/widgets/alert_dialog.mdx index 0c668bcc5..57e34f216 100644 --- a/docs/widgets/alert_dialog.mdx +++ b/docs/widgets/alert_dialog.mdx @@ -3,6 +3,61 @@ title: "AlertDialog" description: "Documentation for AlertDialog" --- +export const PLAYGROUND_BASE_URL = "https://playground.stac.dev"; +export const alertDialogPreviewJson = { + "type": "alertDialog", + "content": { + "type": "padding", + "padding": { + "top": 0, + "left": 12, + "right": 12, + "bottom": 8 + }, + "child": { + "type": "text", + "data": "Discard draft?", + "align": "center", + "style": { + "fontSize": 14 + } + } + }, + "actions": [ + { + "type": "textButton", + "child": { + "type": "text", + "data": "CANCEL" + }, + "onPressed": { + "actionType": "navigate", + "navigationStyle": "pop" + } + }, + { + "type": "sizedBox", + "width": 8 + }, + { + "type": "textButton", + "child": { + "type": "text", + "data": "DISCARD" + }, + "onPressed": { + "actionType": "navigate", + "navigationStyle": "pop" + } + }, + { + "type": "sizedBox", + "width": 12 + } + ] +}; +export const alertDialogPreviewSrc = `${PLAYGROUND_BASE_URL}/embed?showTopBar=false&showEditor=false`; + The Stac AlertDialog allows you to build a Flutter alert dialog widget using JSON. To know more about the alert dialog widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/material/AlertDialog-class.html). @@ -39,8 +94,10 @@ To know more about the alert dialog widget in Flutter, refer to the [official do ## Example - -```dart Dart + + + +```dart StacAlertDialog( content: StacPadding( padding: StacEdgeInsets( @@ -70,7 +127,10 @@ StacAlertDialog( ) ``` -```json JSON + + + +```json { "type": "alertDialog", "content": { @@ -124,4 +184,36 @@ StacAlertDialog( ] } ``` - + + + + +