|
| 1 | +# Chip |
| 2 | + |
| 3 | +The Mirai Chip allows you to build a Flutter Chip widget using JSON. |
| 4 | +To know more about the Chip widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/material/Chip-class.html). |
| 5 | + |
| 6 | +## Properties |
| 7 | + |
| 8 | +| Property | Type | Description | |
| 9 | +|----------------------------|--------------------------------|------------------------------------------------------------------------------------------------| |
| 10 | +| avatar | `Map<String, dynamic>?` | The widget to display prior to the chip's label. | |
| 11 | +| label | `Map<String, dynamic>` | The primary content of the chip. | |
| 12 | +| labelStyle | `MiraiTextStyle?` | The style to use for the label. | |
| 13 | +| labelPadding | `MiraiEdgeInsets?` | The padding around the label. | |
| 14 | +| deleteIcon | `Map<String, dynamic>?` | The widget to display as the chip's delete icon. | |
| 15 | +| onDeleted | `Map<String, dynamic>?` | The callback that is called when the delete icon is tapped. | |
| 16 | +| deleteIconColor | `String?` | The color of the delete icon. | |
| 17 | +| deleteButtonTooltipMessage | `String?` | The message to display in the tooltip for the delete icon. | |
| 18 | +| side | `MiraiBorderSide?` | The border to display around the chip. | |
| 19 | +| shape | `MiraiRoundedRectangleBorder?` | The shape of the chip's border. | |
| 20 | +| clipBehavior | `Clip` | The clip behavior of the chip. Defaults to `Clip.none`. | |
| 21 | +| autofocus | `bool` | Whether this chip should focus itself if nothing else is already focused. Defaults to `false`. | |
| 22 | +| color | `String?` | The color of the chip. | |
| 23 | +| backgroundColor | `String?` | The background color of the chip. | |
| 24 | +| padding | `MiraiEdgeInsets?` | The padding around the chip. | |
| 25 | +| visualDensity | `MiraiVisualDensity?` | The visual density of the chip. | |
| 26 | +| materialTapTargetSize | `MaterialTapTargetSize?` | Configures the minimum size of the tap target. | |
| 27 | +| elevation | `double?` | The elevation of the chip. | |
| 28 | +| shadowColor | `String?` | The color of the chip's shadow. | |
| 29 | +| surfaceTintColor | `String?` | The color of the chip's surface tint. | |
| 30 | +| iconTheme | `MiraiIconThemeData?` | The theme for icons in the chip. | |
| 31 | +| avatarBoxConstraints | `MiraiBoxConstraints?` | The constraints for the avatar. | |
| 32 | +| deleteIconBoxConstraints | `MiraiBoxConstraints?` | The constraints for the delete icon. | |
| 33 | + |
| 34 | +## Example JSON |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "type": "chip", |
| 39 | + "avatar": { |
| 40 | + "type": "circleAvatar", |
| 41 | + "backgroundColor": "#FF0000", |
| 42 | + "child": { |
| 43 | + "type": "text", |
| 44 | + "data": "A" |
| 45 | + } |
| 46 | + }, |
| 47 | + "label": { |
| 48 | + "type": "text", |
| 49 | + "data": "Chip Label" |
| 50 | + }, |
| 51 | + "labelStyle": { |
| 52 | + "color": "#000000", |
| 53 | + "fontSize": 14 |
| 54 | + }, |
| 55 | + "labelPadding": { |
| 56 | + "left": 8, |
| 57 | + "top": 4, |
| 58 | + "right": 8, |
| 59 | + "bottom": 4 |
| 60 | + }, |
| 61 | + "deleteIcon": { |
| 62 | + "type": "icon", |
| 63 | + "icon": "delete" |
| 64 | + }, |
| 65 | + "deleteIconColor": "#FF0000", |
| 66 | + "deleteButtonTooltipMessage": "Delete", |
| 67 | + "side": { |
| 68 | + "color": "#000000", |
| 69 | + "width": 1.0 |
| 70 | + }, |
| 71 | + "shape": { |
| 72 | + "type": "roundedRectangle", |
| 73 | + "borderRadius": 8.0 |
| 74 | + }, |
| 75 | + "clipBehavior": "antiAlias", |
| 76 | + "autofocus": false, |
| 77 | + "color": "#FFFFFF", |
| 78 | + "backgroundColor": "#EEEEEE", |
| 79 | + "padding": { |
| 80 | + "left": 8, |
| 81 | + "top": 4, |
| 82 | + "right": 8, |
| 83 | + "bottom": 4 |
| 84 | + }, |
| 85 | + "visualDensity": { |
| 86 | + "horizontal": 0.0, |
| 87 | + "vertical": 0.0 |
| 88 | + }, |
| 89 | + "materialTapTargetSize": "padded", |
| 90 | + "elevation": 2.0, |
| 91 | + "shadowColor": "#000000", |
| 92 | + "surfaceTintColor": "#FFFFFF", |
| 93 | + "iconTheme": { |
| 94 | + "color": "#000000", |
| 95 | + "size": 24.0 |
| 96 | + }, |
| 97 | + "avatarBoxConstraints": { |
| 98 | + "minWidth": 24.0, |
| 99 | + "minHeight": 24.0 |
| 100 | + }, |
| 101 | + "deleteIconBoxConstraints": { |
| 102 | + "minWidth": 24.0, |
| 103 | + "minHeight": 24.0 |
| 104 | + } |
| 105 | +} |
| 106 | +``` |
0 commit comments