-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a418da
commit 3ce46ec
Showing
13 changed files
with
3,095 additions
and
1,231 deletions.
There are no files selected for viewing
2,494 changes: 1,264 additions & 1,230 deletions
2,494
examples/mirai_gallery/assets/json/home_screen.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
{ | ||
"type": "scaffold", | ||
"appBar": { | ||
"type": "appBar", | ||
"title": { | ||
"type": "text", | ||
"data": "Mirai Table Example" | ||
} | ||
}, | ||
"body": { | ||
"type": "padding", | ||
"padding": 16.0, | ||
"child": { | ||
"type": "table", | ||
"defaultColumnWidth": { | ||
"type": "flexColumnWidth", | ||
"value": 1 | ||
}, | ||
"border": { | ||
"type": "tableBorder", | ||
"borderSide": { | ||
"color": "#000000", | ||
"width": 1.0 | ||
} | ||
}, | ||
"children": [ | ||
{ | ||
"type": "tableRow", | ||
"children": [ | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "container", | ||
"color": "#40000000", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Header 1" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "container", | ||
"color": "#40000000", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Header 2" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "container", | ||
"color": "#40000000", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Header 3" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "tableRow", | ||
"children": [ | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 1, Cell 1" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 1, Cell 2" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 1, Cell 3" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "tableRow", | ||
"children": [ | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 2, Cell 1" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 2, Cell 2" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 2, Cell 3" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "tableRow", | ||
"children": [ | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 3, Cell 1" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 3, Cell 2" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "tableCell", | ||
"child": { | ||
"type": "sizedBox", | ||
"height": 50.0, | ||
"child": { | ||
"type": "center", | ||
"child": { | ||
"type": "text", | ||
"data": "Row 3, Cell 3" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/mirai/lib/src/parsers/mirai_table/mirai_table.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:mirai/mirai.dart'; | ||
|
||
export 'package:mirai/src/parsers/mirai_table/mirai_table_parser.dart'; | ||
|
||
part 'mirai_table.freezed.dart'; | ||
part 'mirai_table.g.dart'; | ||
|
||
enum MiraiTableColumnWidthType { | ||
fixedColumnWidth, | ||
flexColumnWidth, | ||
fractionColumnWidth, | ||
intrinsicColumnWidth | ||
} | ||
|
||
@freezed | ||
class MiraiTable with _$MiraiTable { | ||
const factory MiraiTable({ | ||
@Default([]) List<MiraiTableRow> children, | ||
Map<int, MiraiTableColumnWidth>? columnWidths, | ||
MiraiTableColumnWidth? defaultColumnWidth, | ||
TextDirection? textDirection, | ||
MiraiTableBorder? border, | ||
@Default(TableCellVerticalAlignment.top) | ||
TableCellVerticalAlignment defaultVerticalAlignment, | ||
TextBaseline? textBaseline, | ||
}) = _MiraiTable; | ||
|
||
factory MiraiTable.fromJson(Map<String, dynamic> json) => | ||
_$MiraiTableFromJson(json); | ||
} | ||
|
||
@freezed | ||
class MiraiTableRow with _$MiraiTableRow { | ||
const factory MiraiTableRow({ | ||
MiraiBoxDecoration? decoration, | ||
@Default([]) List<Map<String, dynamic>> children, | ||
}) = _MiraiTableRow; | ||
|
||
factory MiraiTableRow.fromJson(Map<String, dynamic> json) => | ||
_$MiraiTableRowFromJson(json); | ||
} | ||
|
||
@freezed | ||
class MiraiTableBorder with _$MiraiTableBorder { | ||
const factory MiraiTableBorder({ | ||
MiraiBorderSide? top, | ||
MiraiBorderSide? right, | ||
MiraiBorderSide? bottom, | ||
MiraiBorderSide? left, | ||
MiraiBorderSide? horizontalInside, | ||
MiraiBorderSide? verticalInside, | ||
MiraiBorderRadius? borderRadius, | ||
}) = _MiraiTableBorder; | ||
|
||
factory MiraiTableBorder.fromJson(Map<String, dynamic> json) => | ||
_$MiraiTableBorderFromJson(json); | ||
} | ||
|
||
@freezed | ||
class MiraiTableColumnWidth with _$MiraiTableColumnWidth { | ||
const factory MiraiTableColumnWidth({ | ||
@Default(MiraiTableColumnWidthType.flexColumnWidth) | ||
MiraiTableColumnWidthType type, | ||
double? value, | ||
}) = _MiraiTableColumnWidth; | ||
|
||
factory MiraiTableColumnWidth.fromJson(Map<String, dynamic> json) => | ||
_$MiraiTableColumnWidthFromJson(json); | ||
} |
Oops, something went wrong.
3ce46ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how to form values set in shared preference and get the value