diff --git a/packages/attachment_engine/attachment_engine/CHANGELOG.md b/packages/attachment_engine/attachment_engine/CHANGELOG.md index 3480ca3..5b4baf0 100644 --- a/packages/attachment_engine/attachment_engine/CHANGELOG.md +++ b/packages/attachment_engine/attachment_engine/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.0.1-dev.4 + +* `TextAttachmentRenderer.showSearch` now defaults to `false` (was `true`). + The in-file search bar remains available by opting in explicitly; the + plain scrollable text view is now the out-of-the-box behavior. + ## 0.0.1-dev.3 * New `OfficeAttachmentRenderer.onDismissed` callback, invoked once the diff --git a/packages/attachment_engine/attachment_engine/lib/src/renderers/text_renderer.dart b/packages/attachment_engine/attachment_engine/lib/src/renderers/text_renderer.dart index 7b14cd9..88fd09c 100644 --- a/packages/attachment_engine/attachment_engine/lib/src/renderers/text_renderer.dart +++ b/packages/attachment_engine/attachment_engine/lib/src/renderers/text_renderer.dart @@ -14,15 +14,15 @@ import 'renderer.dart'; /// Plain text viewer. Set [snippetMode] to true (via [TextAttachmentRenderer.preview]) /// for a short, non-scrolling preview rather than the full document. /// -/// Full (non-snippet) mode includes a search bar (case-insensitive, with -/// match count and next/previous navigation that scrolls to and highlights -/// each match) — set [showSearch] to false to opt out and get the plain -/// scrollable text view instead. +/// Full (non-snippet) mode can optionally show a search bar (case-insensitive, +/// with match count and next/previous navigation that scrolls to and +/// highlights each match) — set [showSearch] to true to opt in; it defaults +/// to off, giving the plain scrollable text view. class TextAttachmentRenderer extends AttachmentRenderer { const TextAttachmentRenderer({ this.snippetMode = false, this.snippetLength = 280, - this.showSearch = true, + this.showSearch = false, }); final bool snippetMode; @@ -30,7 +30,7 @@ class TextAttachmentRenderer extends AttachmentRenderer { /// Whether the full (non-snippet) view shows an in-file search bar. /// Ignored when [snippetMode] is true (a 3-line preview has nothing - /// meaningful to search). + /// meaningful to search). Off by default. final bool showSearch; @override diff --git a/packages/attachment_engine/attachment_engine/pubspec.yaml b/packages/attachment_engine/attachment_engine/pubspec.yaml index 34758f9..6d42b73 100644 --- a/packages/attachment_engine/attachment_engine/pubspec.yaml +++ b/packages/attachment_engine/attachment_engine/pubspec.yaml @@ -1,6 +1,6 @@ name: attachment_engine description: "Universal attachment engine for Flutter to resolve, cache, download, preview, and render documents, media, and web content using native platform APIs." -version: 0.0.1-dev.3 +version: 0.0.1-dev.4 homepage: "https://github.com/dhc-tech/flutter-packages/tree/main/packages/attachment_engine/attachment_engine" repository: "https://github.com/dhc-tech/flutter-packages" issue_tracker: "https://github.com/dhc-tech/flutter-packages/issues" diff --git a/packages/attachment_engine/attachment_engine/test/text_renderer_test.dart b/packages/attachment_engine/attachment_engine/test/text_renderer_test.dart index 511880d..e835404 100644 --- a/packages/attachment_engine/attachment_engine/test/text_renderer_test.dart +++ b/packages/attachment_engine/attachment_engine/test/text_renderer_test.dart @@ -32,7 +32,9 @@ void main() { Future pumpTextView( WidgetTester tester, String content, { - TextAttachmentRenderer renderer = const TextAttachmentRenderer(), + TextAttachmentRenderer renderer = const TextAttachmentRenderer( + showSearch: true, + ), }) async { final file = File('${tempDir.path}/sample.txt'); file.writeAsStringSync(content); @@ -195,7 +197,7 @@ void main() { 'reusing the same widget for different text reloads its lines and ' 'search results instead of keeping the previous document\'s', (tester) async { - const renderer = TextAttachmentRenderer(); + const renderer = TextAttachmentRenderer(showSearch: true); final fileA = File('${tempDir.path}/a.txt'); fileA.writeAsStringSync('apple pie\nbanana split\n'); final fileB = File('${tempDir.path}/b.txt');