diff --git a/docs/guides/markdown-authoring.mdx b/docs/guides/markdown-authoring.mdx index d263a264..17ea811b 100644 --- a/docs/guides/markdown-authoring.mdx +++ b/docs/guides/markdown-authoring.mdx @@ -94,7 +94,7 @@ Use these properties on blocks. Sections support `flex` and `align`; `scrollable` applies to child blocks and widgets. - `flex` – Relative size (default: `1`). A column with `flex: 2` takes twice the space of `flex: 1` -- `align` – Content alignment such as `topLeft`, `center`, and `bottomRight` +- `align` – Content alignment such as `topLeft`, `center`, and `bottomRight` (default: `centerLeft`) - `scrollable` – Enable scrolling for overflow content (default: `false`) For complete value definitions, see the [Markdown syntax reference](../reference/markdown-syntax). diff --git a/docs/reference/block-types.mdx b/docs/reference/block-types.mdx index ad20c238..ac65d3b8 100644 --- a/docs/reference/block-types.mdx +++ b/docs/reference/block-types.mdx @@ -13,7 +13,7 @@ Content and widget blocks support these properties. Sections support `align` and `flex`, but scrolling is configured on child blocks or widgets. ### `align` -**Type:** String | **Default:** `center` +**Type:** String | **Default:** `centerLeft` Controls content alignment: - `topLeft`, `topCenter`, `topRight` diff --git a/docs/reference/markdown-syntax.mdx b/docs/reference/markdown-syntax.mdx index 49919602..6f7a8015 100644 --- a/docs/reference/markdown-syntax.mdx +++ b/docs/reference/markdown-syntax.mdx @@ -51,7 +51,7 @@ Built-in widgets (`image`, `dartpad`, `qrcode`) use the same widget syntax as `@ ### `align` - Type: string -- Default: `center` +- Default: `centerLeft` - Values: `topLeft`, `topCenter`, `topRight`, `centerLeft`, `center`, `centerRight`, `bottomLeft`, `bottomCenter`, `bottomRight` ### `scrollable` diff --git a/packages/superdeck/lib/src/rendering/blocks/block_widget.dart b/packages/superdeck/lib/src/rendering/blocks/block_widget.dart index 69ca4471..65903190 100644 --- a/packages/superdeck/lib/src/rendering/blocks/block_widget.dart +++ b/packages/superdeck/lib/src/rendering/blocks/block_widget.dart @@ -62,9 +62,11 @@ class _BlockContainerState extends State<_BlockContainer> { child: content, ); - // Apply alignment + // Apply alignment. Blocks default to centerLeft so prose and embedded + // widgets align with left-to-right reading flow; set `align: center` to + // restore centered placement explicitly. content = Align( - alignment: widget.block.align?.toAlignment ?? Alignment.center, + alignment: widget.block.align?.toAlignment ?? Alignment.centerLeft, child: content, ); diff --git a/packages/superdeck/test/src/behavior/alignment_behavior_test.dart b/packages/superdeck/test/src/behavior/alignment_behavior_test.dart index d0c56124..fead0f1b 100644 --- a/packages/superdeck/test/src/behavior/alignment_behavior_test.dart +++ b/packages/superdeck/test/src/behavior/alignment_behavior_test.dart @@ -110,6 +110,42 @@ void main() { }); }); + group('default alignment', () { + testWidgets('ContentBlock without explicit align defaults to centerLeft', ( + tester, + ) async { + final slide = Slide( + key: 'block-default-align', + sections: [ + SectionBlock([ContentBlock('Hello')]), + ], + ); + await SlideTestHarness.pumpSlide(tester, slide); + + final alignWidget = tester.widget(find.byType(Align).first); + expect(alignWidget.alignment, Alignment.centerLeft); + }); + + testWidgets('WidgetBlock without explicit align defaults to centerLeft', ( + tester, + ) async { + final slide = Slide( + key: 'widget-default-align', + sections: [ + SectionBlock([WidgetBlock(name: 'plain')]), + ], + ); + await SlideTestHarness.pumpSlide( + tester, + slide, + widgets: {'plain': (_) => const SizedBox.shrink()}, + ); + + final alignWidget = tester.widget(find.byType(Align).first); + expect(alignWidget.alignment, Alignment.centerLeft); + }); + }); + group('alignment in sections', () { testWidgets('different alignments per section', (tester) async { final slide = Slide(