diff --git a/docs/snippets/playground_base.mdx b/docs/snippets/playground_base.mdx new file mode 100644 index 000000000..3c27456ff --- /dev/null +++ b/docs/snippets/playground_base.mdx @@ -0,0 +1 @@ +export const PLAYGROUND_BASE_URL = "https://playground.stac.dev/"; \ No newline at end of file diff --git a/docs/widgets/alert_dialog.mdx b/docs/widgets/alert_dialog.mdx index 0c668bcc5..095f8d98f 100644 --- a/docs/widgets/alert_dialog.mdx +++ b/docs/widgets/alert_dialog.mdx @@ -3,6 +3,62 @@ title: "AlertDialog" description: "Documentation for AlertDialog" --- +import { PLAYGROUND_BASE_URL } from "/snippets/playground_base.mdx"; + +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`; + 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 +95,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 +128,10 @@ StacAlertDialog( ) ``` -```json JSON + + + +```json { "type": "alertDialog", "content": { @@ -124,4 +185,37 @@ StacAlertDialog( ] } ``` - + + + + +