|
| 1 | +# Positioned |
| 2 | + |
| 3 | +The Mirai Positioned allows you to build a Flutter positioned widget using JSON. |
| 4 | +To know more about the positioned widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/widgets/Positioned-class.html). |
| 5 | + |
| 6 | +## Properties |
| 7 | + |
| 8 | +| Property | Type | Description | |
| 9 | +|----------------|-------------------------|---------------------------------------------------------------------------------------------| |
| 10 | +| positionedType | `MiraiPositionedType?` | The type of positioned widget. Can be `directional`, `fill`, or `fromRect`. | |
| 11 | +| left | `double?` | The distance from the left edge of the parent. | |
| 12 | +| top | `double?` | The distance from the top edge of the parent. | |
| 13 | +| right | `double?` | The distance from the right edge of the parent. | |
| 14 | +| bottom | `double?` | The distance from the bottom edge of the parent. | |
| 15 | +| width | `double?` | The width of the child. | |
| 16 | +| height | `double?` | The height of the child. | |
| 17 | +| start | `double?` | The distance from the start edge of the parent (for `directional` type). | |
| 18 | +| end | `double?` | The distance from the end edge of the parent (for `directional` type). | |
| 19 | +| textDirection | `TextDirection` | The text direction to use for resolving `start` and `end`. Defaults to `TextDirection.ltr`. | |
| 20 | +| rect | `MiraiRect?` | The rectangle to position the child (for `fromRect` type). | |
| 21 | +| child | `Map<String, dynamic>?` | The widget to display inside the positioned widget. | |
| 22 | + |
| 23 | +## Example JSON |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "type": "positioned", |
| 28 | + "left": 10, |
| 29 | + "top": 20, |
| 30 | + "right": 30, |
| 31 | + "bottom": 40, |
| 32 | + "child": { |
| 33 | + "type": "text", |
| 34 | + "data": "Hello, World!" |
| 35 | + } |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +## Example JSON for `directional` |
| 40 | + |
| 41 | +```json |
| 42 | +{ |
| 43 | + "type": "positioned", |
| 44 | + "positionedType": "directional", |
| 45 | + "start": 10, |
| 46 | + "top": 20, |
| 47 | + "width": 100, |
| 48 | + "height": 50, |
| 49 | + "textDirection": "ltr", |
| 50 | + "child": { |
| 51 | + "type": "text", |
| 52 | + "data": "Hello, World!" |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +### Example JSON for `fill` |
| 58 | + |
| 59 | +```json |
| 60 | +{ |
| 61 | + "type": "positioned", |
| 62 | + "positionedType": "fill", |
| 63 | + "left": 10, |
| 64 | + "top": 20, |
| 65 | + "right": 30, |
| 66 | + "bottom": 40, |
| 67 | + "child": { |
| 68 | + "type": "text", |
| 69 | + "data": "Hello, World!" |
| 70 | + } |
| 71 | +} |
| 72 | +``` |
| 73 | + |
| 74 | +### Example JSON for fromRect |
| 75 | + |
| 76 | +```json |
| 77 | +{ |
| 78 | + "type": "positioned", |
| 79 | + "positionedType": "fromRect", |
| 80 | + "rect": { |
| 81 | + "left": 10, |
| 82 | + "top": 20, |
| 83 | + "right": 110, |
| 84 | + "bottom": 70 |
| 85 | + }, |
| 86 | + "child": { |
| 87 | + "type": "text", |
| 88 | + "data": "Hello, World!" |
| 89 | + } |
| 90 | +} |
| 91 | +``` |
0 commit comments