Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/attachment_engine/attachment_engine/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ 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;
final int snippetLength;

/// 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ void main() {
Future<void> 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);
Expand Down Expand Up @@ -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');
Expand Down
Loading