forked from lxm_flutter/json2dart
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
961628180c |
@@ -11,20 +11,22 @@ bool isCamelCase = true;
|
|||||||
|
|
||||||
var downloadFileName = "";
|
var downloadFileName = "";
|
||||||
|
|
||||||
const defaultValue = """{
|
// const defaultValue = """{
|
||||||
"body": "",
|
// "body": "",
|
||||||
"data": [1],
|
// "data": [1],
|
||||||
"input_content":["1"],
|
// "input_content":["1"],
|
||||||
"list1":[{"name":"hello"}],
|
// "list1":[{"name":"hello"}],
|
||||||
"number": [1.02],
|
// "number": [1.02],
|
||||||
"user":{"name":"abc"}
|
// "user":{"name":"abc"}
|
||||||
}""";
|
// }""";
|
||||||
|
const defaultValue = "";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
TextAreaElement jsonInput = querySelector("#json");
|
TextAreaElement jsonInput = querySelector("#json");
|
||||||
jsonInput.value = defaultValue;
|
jsonInput.value = defaultValue;
|
||||||
|
|
||||||
jsonInput.onInput.listen((event) {
|
jsonInput.onInput.listen((event) {
|
||||||
|
print(jsonInput.value);
|
||||||
refreshData();
|
refreshData();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,42 +7,46 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="scaffolded-by" content="https://github.com/google/stagehand" />
|
<meta name="scaffolded-by" content="https://github.com/google/stagehand" />
|
||||||
<title>hello_world</title>
|
<title>json2dart_for_json_serializable</title>
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
<link rel="icon" href="favicon.ico">
|
<link rel="icon" href="favicon.ico">
|
||||||
<script defer src="main.dart.js"></script>
|
<script defer src="main.dart.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<h1>为了便利使用json_serializable库</h1>
|
||||||
<div>
|
<div>
|
||||||
<div id="input" class="textarea">
|
<div class="title">
|
||||||
<div class="top">
|
<span class="half_span">将json粘贴至左边</span>
|
||||||
将json粘贴至左边
|
<span class="half_span">
|
||||||
</div>
|
<div class="result_title">
|
||||||
<textarea id="json" title="json字符串"></textarea>
|
类名称
|
||||||
<div>
|
<input id="out_entity_name" />
|
||||||
<button id="format">格式化</button>
|
<input type="checkbox" id="use_json_key" />
|
||||||
</div>
|
<span id="check_label">jsonKey annotation</span>
|
||||||
|
<input type="checkbox" id="camelCase" />
|
||||||
|
<span id="camelCaseLabel">use camelCase</span>
|
||||||
|
</div>
|
||||||
|
<div id="file_name"></div>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="output" class="textarea">
|
<div class="content">
|
||||||
<div class="top"></div>
|
<span class="half_span">
|
||||||
<div class="result_title">
|
<textarea id="json" title="json字符串" class="content_area"></textarea>
|
||||||
类名称
|
</span>
|
||||||
<input id="out_entity_name" />
|
<span class="half_span">
|
||||||
<input type="checkbox" id="use_json_key" />
|
<textarea id="result" title="结果" class="content_area"></textarea>
|
||||||
<span id="check_label">jsonKey annotation</span>
|
</span>
|
||||||
<input type="checkbox" id="camelCase" />
|
</div>
|
||||||
<span id="camelCaseLabel">use camelCase</span>
|
<div class="func">
|
||||||
</div>
|
<span class="half_span">
|
||||||
<div id="file_name"></div>
|
<button id="format">格式化</button>
|
||||||
<textarea id="result" title="结果"></textarea>
|
</span>
|
||||||
<div>
|
<span class="half_span">
|
||||||
<button id="copy">复制</button>
|
<button id="copy">复制</button>
|
||||||
<button id="save">下载</button>
|
<button id="save">下载</button>
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -2,40 +2,73 @@
|
|||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: "Roboto", sans-serif;
|
font-family: "Roboto", sans-serif;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
.top {
|
.top {
|
||||||
height: 4vh;
|
height: 4vh;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 1vh;
|
padding-top: 1vh;
|
||||||
}
|
|
||||||
|
|
||||||
.textarea {
|
|
||||||
width: 50%;
|
|
||||||
height: 90%;
|
|
||||||
text-align: center;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
width: 90%;
|
|
||||||
height: 80vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.result_title {
|
.result_title {
|
||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#result {
|
.textarea {
|
||||||
width: 90%;
|
width: 50%;
|
||||||
height: 70vh;
|
height: 90%;
|
||||||
|
text-align: center;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content_area {
|
||||||
|
width: 80%;
|
||||||
|
height: 90vh;
|
||||||
|
text-align: center;
|
||||||
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.out_entity_name {
|
.out_entity_name {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.half_span {
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 86%;
|
||||||
|
height: 70vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-top: 5vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.func .half_span {
|
||||||
|
height: 7rem;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 5rem;
|
||||||
|
height: 2rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#file_name {
|
||||||
|
font-size: 0.5rem;
|
||||||
|
padding-top: 5px;
|
||||||
|
color: mediumvioletred;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user