mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-04-04 08:15:09 +08:00
request rewrite body json format
This commit is contained in:
@@ -229,9 +229,8 @@ class _RewriteUpdateAddState extends State<RewriteUpdateAddDialog> {
|
||||
child: Text(localizations.testData, style: const TextStyle(fontSize: 14))),
|
||||
const SizedBox(width: 10),
|
||||
if (!isMatch)
|
||||
Expanded(
|
||||
child:
|
||||
Text(localizations.noChangesDetected, style: TextStyle(color: Colors.red, fontSize: 14))),
|
||||
Text(localizations.noChangesDetected, style: TextStyle(color: Colors.red, fontSize: 14)),
|
||||
Expanded(child: SizedBox()),
|
||||
IconButton(
|
||||
tooltip: 'JSON Format',
|
||||
icon: Icon(Icons.data_object,
|
||||
|
||||
@@ -154,6 +154,8 @@ class RewriteReplaceState extends State<MobileRewriteReplace> {
|
||||
.toList());
|
||||
}
|
||||
|
||||
bool jsonFormatted = false;
|
||||
|
||||
//body
|
||||
Widget body() {
|
||||
bool isCN = Localizations.localeOf(context) == const Locale.fromSubtags(languageCode: 'zh');
|
||||
@@ -183,8 +185,21 @@ class RewriteReplaceState extends State<MobileRewriteReplace> {
|
||||
}))),
|
||||
Expanded(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
|
||||
IconButton(
|
||||
tooltip: 'JSON Format',
|
||||
icon:
|
||||
Icon(Icons.data_object, size: 20, color: jsonFormatted ? Theme.of(context).colorScheme.primary : null),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
jsonFormatted = !jsonFormatted;
|
||||
bodyTextController.text =
|
||||
jsonFormatted ? JSON.pretty(bodyTextController.text) : JSON.compact(bodyTextController.text);
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(localizations.enable),
|
||||
const SizedBox(width: 10),
|
||||
const SizedBox(width: 5),
|
||||
SwitchWidget(
|
||||
value: rewriteItem.enabled,
|
||||
scale: 0.65,
|
||||
@@ -481,7 +496,8 @@ class HeadersState extends State<Headers> with AutomaticKeepAliveClientMixin {
|
||||
physics: const ClampingScrollPhysics(),
|
||||
separatorBuilder: (context, index) =>
|
||||
index == list.length ? const SizedBox() : const Divider(thickness: 0.2),
|
||||
itemBuilder: (context, index) => index < list.length?list[index]
|
||||
itemBuilder: (context, index) => index < list.length
|
||||
? list[index]
|
||||
: TextButton(
|
||||
child: Text("${localizations.add}Header", textAlign: TextAlign.center),
|
||||
onPressed: () {
|
||||
|
||||
@@ -118,6 +118,8 @@ class _RewriteUpdateAddState extends State<RewriteUpdateEdit> {
|
||||
var valueController = TextEditingController();
|
||||
var dataController = HighlightTextEditingController();
|
||||
|
||||
bool jsonFormatted = false;
|
||||
|
||||
AppLocalizations get i18n => AppLocalizations.of(context)!;
|
||||
|
||||
@override
|
||||
@@ -218,7 +220,21 @@ class _RewriteUpdateAddState extends State<RewriteUpdateEdit> {
|
||||
Align(
|
||||
alignment: Alignment.centerLeft, child: Text(i18n.testData, style: const TextStyle(fontSize: 14))),
|
||||
const SizedBox(width: 10),
|
||||
if (!isMatch) Text(i18n.noChangesDetected, style: TextStyle(color: Colors.red, fontSize: 14))
|
||||
if (!isMatch) Text(i18n.noChangesDetected, style: TextStyle(color: Colors.red, fontSize: 14)),
|
||||
Expanded(child: SizedBox()),
|
||||
IconButton(
|
||||
tooltip: 'JSON Format',
|
||||
icon: Icon(Icons.data_object,
|
||||
size: 20, color: jsonFormatted ? Theme.of(context).colorScheme.primary : null),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
jsonFormatted = !jsonFormatted;
|
||||
dataController.text =
|
||||
jsonFormatted ? JSON.pretty(dataController.text) : JSON.compact(dataController.text);
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 3),
|
||||
]),
|
||||
const SizedBox(height: 5),
|
||||
formField(i18n.enterMatchData, lines: 15, required: false, controller: dataController),
|
||||
|
||||
Reference in New Issue
Block a user