From 26554e2476202ea412d143139954eafff417dcfb Mon Sep 17 00:00:00 2001 From: Mrudul-2 <147049798+Mrudul-2@users.noreply.github.com> Date: Sat, 22 Feb 2025 23:36:27 +0530 Subject: [PATCH] readOnly implementation in widget as well as history page --- lib/screens/history/history_widgets/his_request_pane.dart | 1 + lib/widgets/editor_json.dart | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/screens/history/history_widgets/his_request_pane.dart b/lib/screens/history/history_widgets/his_request_pane.dart index f9d38300..a64b96f8 100644 --- a/lib/screens/history/history_widgets/his_request_pane.dart +++ b/lib/screens/history/history_widgets/his_request_pane.dart @@ -145,6 +145,7 @@ class HisRequestBody extends ConsumerWidget { fieldKey: "${selectedHistoryModel?.historyId}-json-body-viewer", initialValue: requestModel?.body, + readOnly: true, ), ), _ => Padding( diff --git a/lib/widgets/editor_json.dart b/lib/widgets/editor_json.dart index 3d13e439..b7e24dbe 100644 --- a/lib/widgets/editor_json.dart +++ b/lib/widgets/editor_json.dart @@ -14,11 +14,13 @@ class JsonTextFieldEditor extends StatefulWidget { required this.fieldKey, this.onChanged, this.initialValue, + this.readOnly = false, }); final String fieldKey; final Function(String)? onChanged; final String? initialValue; + final bool readOnly; @override State createState() => _JsonTextFieldEditorState(); } @@ -101,6 +103,7 @@ class _JsonTextFieldEditorState extends State { borderRadius: kBorderRadius8, ), showErrorMessage: true, + readOnly: widget.readOnly, isFormatting: true, key: Key(widget.fieldKey), controller: controller,