Scroll the path sheet when the keyboard leaves no room
A landscape keyboard can leave less than the search field under the header. The pinned column overflowed there, so that band now scrolls the hops, hex field, search field, and repeater list together. Co-authored-by: zjs81 <zjs81@users.noreply.github.com>
This commit is contained in:
4 files changed
+388
-159
No files matched your search
@@ -165,7 +165,7 @@ Rules for new UI:
|
||||
3. **Forms with sections, live remote values, or anything that needs Save/Discard → page.** Guard unsaved changes with `PopScope` and a discard dialog, as `repeater_settings_screen.dart` does.
|
||||
4. Never stack a dialog on a sheet on a dialog. Close the sheet first, or move the flow to a page.
|
||||
|
||||
The manual path editor (`path_editor_sheet.dart`) uses `showMeshSheet` and `BottomSheetHeader`, the same top padding, drag handle, and title row as the other sheets. The hop list and the hex path field stay pinned under that header, including while the keyboard is open.
|
||||
The manual path editor (`path_editor_sheet.dart`) uses `showMeshSheet` and `BottomSheetHeader`, the same top padding, drag handle, and title row as the other sheets. The hop list and the hex path field stay pinned under that header, including while the keyboard is open. When the band under the header is shorter than the search field, as on a landscape phone with the keyboard open, those blocks and the repeater list scroll together instead of overflowing.
|
||||
|
||||
## 7. App bars
|
||||
|
||||
|
||||
@@ -64,6 +64,6 @@ Contacts/messages persist hop count, path bytes, and width. Legacy contact recor
|
||||
|
||||
## Building a path by hand
|
||||
|
||||
Chat → Routing → Manual opens the Build Path sheet. The hops you have added stay pinned at the top, including while the keyboard is open, and the one just added is highlighted. Under that list is the hex field, so a path can be typed without scrolling past every repeater. Search matches repeater and room names and hop hashes (the public-key prefix). Names that start with the query are listed before other substring matches, then hash-only matches.
|
||||
Chat → Routing → Manual opens the Build Path sheet. The hops you have added stay pinned at the top, including while the keyboard is open, and the one just added is highlighted. Under that list is the hex field, so a path can be typed without scrolling past every repeater. On a very short sheet, such as landscape with the keyboard open, the hop list, hex field, search field, and repeater list scroll together so the search field stays reachable. Search matches repeater and room names and hop hashes (the public-key prefix). Names that start with the query are listed before other substring matches, then hash-only matches.
|
||||
|
||||
For message-path actions, trace maps, and retry behavior, see [chat](chat-and-messaging.md), [channels](channels.md), and [map](map-and-location.md).
|
||||
+298
-157
@@ -355,7 +355,12 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
/// An invalid hex path grows the error text. That growth comes out of the
|
||||
/// hop viewport first, keeping one row when it fits, and the error itself
|
||||
/// scrolls inside its own box instead of overflowing the sheet.
|
||||
({double hop, double hex, double search}) _middleBudget(
|
||||
///
|
||||
/// [scroll] is set when that band is shorter than the search field, which
|
||||
/// happens when a landscape keyboard leaves only the header and the action
|
||||
/// buttons. The pinned column would overflow, so the caller lays the same
|
||||
/// blocks out in one scroll view instead.
|
||||
({double hop, double hex, double search, bool scroll}) _middleBudget(
|
||||
double space,
|
||||
bool compact,
|
||||
) {
|
||||
@@ -372,12 +377,13 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
final wantedHop = _hops.isEmpty
|
||||
? math.min(scaler.scale(compact ? 64 : 80), 140.0)
|
||||
: math.min(_hops.length, compact ? 2 : 3) * row + 4;
|
||||
final wantedHex = baseHex + errorExtra;
|
||||
final minHop = _hops.isEmpty
|
||||
? 0.0
|
||||
: math.min(row, math.max(0.0, space - gaps));
|
||||
|
||||
var hopH = wantedHop;
|
||||
var hexH = baseHex + errorExtra;
|
||||
var hexH = wantedHex;
|
||||
final used = hopH + hexH + searchH + gaps;
|
||||
if (used > space) {
|
||||
var overflow = used - space;
|
||||
@@ -397,18 +403,294 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
hopH = math.max(0.0, hopH - overflow);
|
||||
}
|
||||
}
|
||||
hopH = math.max(0.0, hopH);
|
||||
hexH = math.max(0.0, hexH);
|
||||
// The search field stays at its full height in the pinned column. When
|
||||
// the band cannot hold it, scrolling is the only way to reach it and the
|
||||
// repeater list.
|
||||
final scroll = hopH + hexH + searchH > space;
|
||||
return (
|
||||
hop: math.max(0.0, hopH),
|
||||
hex: math.max(0.0, hexH),
|
||||
hop: scroll ? wantedHop : hopH,
|
||||
hex: scroll ? wantedHex : hexH,
|
||||
search: searchH,
|
||||
scroll: scroll,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _hopViewport(bool compact, double height) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: height < 8
|
||||
? const SizedBox.shrink()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(MeshRadii.md),
|
||||
border: Border.all(color: scheme.outlineVariant),
|
||||
),
|
||||
child: _hops.isEmpty
|
||||
? SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
l10n.pathEditor_noHops,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ReorderableListView.builder(
|
||||
scrollController: _hopScroll,
|
||||
buildDefaultDragHandles: false,
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: compact ? 0 : 4,
|
||||
),
|
||||
itemCount: _hops.length,
|
||||
onReorderItem: _reorderHop,
|
||||
itemBuilder: (context, index) =>
|
||||
_hopTile(context, index, singleLine: compact),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _hexViewport(bool compact, double height) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.fromLTRB(16, compact ? 6 : 12, 16, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!compact) ...[
|
||||
Text(
|
||||
l10n.pathEditor_advancedHex,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
TextField(
|
||||
key: const Key('path-editor-hex-field'),
|
||||
controller: _hexController,
|
||||
onChanged: _onHexChanged,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
style: MeshTheme.mono(fontSize: 14),
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.pathEditor_hexLabel,
|
||||
helperText: compact || _hexError != null
|
||||
? null
|
||||
: l10n.pathEditor_hexHelper(_hashChars),
|
||||
helperMaxLines: 3,
|
||||
errorText: _hexError,
|
||||
errorMaxLines: compact ? 4 : 3,
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: compact,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _searchViewport(bool compact, double height) {
|
||||
final l10n = context.l10n;
|
||||
return SizedBox(
|
||||
height: height,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, compact ? 6 : 12, 16, 0),
|
||||
child: TextField(
|
||||
key: const Key('path-editor-search-field'),
|
||||
onChanged: (value) => setState(() => _search = value),
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.pathEditor_searchRepeaters,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: compact,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _repeaterViewport(List<Contact> repeaters) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
if (repeaters.isEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Text(
|
||||
l10n.path_noRepeatersFound,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
key: const Key('path-editor-repeater-list'),
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
itemCount: repeaters.length,
|
||||
itemBuilder: (context, index) => _repeaterTile(context, repeaters[index]),
|
||||
);
|
||||
}
|
||||
|
||||
/// One scrollable for the hop list, hex field, search field, and repeaters.
|
||||
///
|
||||
/// The blocks are intrinsic height with no nested scrolling, so a drag
|
||||
/// anywhere in the band moves the search field and the repeater list into
|
||||
/// view. The pinned layout keeps its own viewports.
|
||||
Widget _scrollingMiddle({
|
||||
required bool compact,
|
||||
required List<Contact> repeaters,
|
||||
}) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
return CustomScrollView(
|
||||
key: const Key('path-editor-scroll-fallback'),
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
slivers: [
|
||||
SliverToBoxAdapter(child: _scrollHopBlock(compact)),
|
||||
SliverToBoxAdapter(child: _scrollHexBlock(compact)),
|
||||
SliverToBoxAdapter(child: _scrollSearchBlock(compact)),
|
||||
if (repeaters.isEmpty)
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
child: Text(
|
||||
l10n.path_noRepeatersFound,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
sliver: SliverList.builder(
|
||||
key: const Key('path-editor-repeater-list'),
|
||||
itemCount: repeaters.length,
|
||||
itemBuilder: (context, index) =>
|
||||
_repeaterTile(context, repeaters[index]),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _scrollHopBlock(bool compact) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(MeshRadii.md),
|
||||
border: Border.all(color: scheme.outlineVariant),
|
||||
),
|
||||
child: _hops.isEmpty
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
l10n.pathEditor_noHops,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ReorderableListView.builder(
|
||||
scrollController: _hopScroll,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
buildDefaultDragHandles: false,
|
||||
padding: EdgeInsets.symmetric(vertical: compact ? 0 : 4),
|
||||
itemCount: _hops.length,
|
||||
onReorderItem: _reorderHop,
|
||||
itemBuilder: (context, index) =>
|
||||
_hopTile(context, index, singleLine: compact),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _scrollHexBlock(bool compact) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, compact ? 6 : 12, 16, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!compact) ...[
|
||||
Text(
|
||||
l10n.pathEditor_advancedHex,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
TextField(
|
||||
key: const Key('path-editor-hex-field'),
|
||||
controller: _hexController,
|
||||
onChanged: _onHexChanged,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
style: MeshTheme.mono(fontSize: 14),
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.pathEditor_hexLabel,
|
||||
helperText: compact || _hexError != null
|
||||
? null
|
||||
: l10n.pathEditor_hexHelper(_hashChars),
|
||||
helperMaxLines: 3,
|
||||
errorText: _hexError,
|
||||
errorMaxLines: compact ? 4 : 3,
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: compact,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _scrollSearchBlock(bool compact) {
|
||||
final l10n = context.l10n;
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, compact ? 6 : 12, 16, 0),
|
||||
child: TextField(
|
||||
key: const Key('path-editor-search-field'),
|
||||
onChanged: (value) => setState(() => _search = value),
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.pathEditor_searchRepeaters,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: compact,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final theme = Theme.of(context);
|
||||
final scheme = theme.colorScheme;
|
||||
final repeaters = _repeaters;
|
||||
|
||||
return LayoutBuilder(
|
||||
@@ -433,159 +715,18 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
child: LayoutBuilder(
|
||||
builder: (context, inner) {
|
||||
final budget = _middleBudget(inner.maxHeight, compact);
|
||||
if (budget.scroll) {
|
||||
return _scrollingMiddle(
|
||||
compact: compact,
|
||||
repeaters: repeaters,
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: budget.hop,
|
||||
child: budget.hop < 8
|
||||
? const SizedBox.shrink()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
16,
|
||||
4,
|
||||
16,
|
||||
0,
|
||||
),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: scheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(
|
||||
MeshRadii.md,
|
||||
),
|
||||
border: Border.all(
|
||||
color: scheme.outlineVariant,
|
||||
),
|
||||
),
|
||||
child: _hops.isEmpty
|
||||
? SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
l10n.pathEditor_noHops,
|
||||
style: theme.textTheme.bodyMedium
|
||||
?.copyWith(
|
||||
color:
|
||||
scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ReorderableListView.builder(
|
||||
scrollController: _hopScroll,
|
||||
buildDefaultDragHandles: false,
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: compact ? 0 : 4,
|
||||
),
|
||||
itemCount: _hops.length,
|
||||
onReorderItem: _reorderHop,
|
||||
itemBuilder: (context, index) =>
|
||||
_hopTile(
|
||||
context,
|
||||
index,
|
||||
singleLine: compact,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: budget.hex,
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
16,
|
||||
compact ? 6 : 12,
|
||||
16,
|
||||
0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!compact) ...[
|
||||
Text(
|
||||
l10n.pathEditor_advancedHex,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
TextField(
|
||||
key: const Key('path-editor-hex-field'),
|
||||
controller: _hexController,
|
||||
onChanged: _onHexChanged,
|
||||
textCapitalization:
|
||||
TextCapitalization.characters,
|
||||
style: MeshTheme.mono(fontSize: 14),
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.pathEditor_hexLabel,
|
||||
helperText: compact || _hexError != null
|
||||
? null
|
||||
: l10n.pathEditor_hexHelper(_hashChars),
|
||||
helperMaxLines: 3,
|
||||
errorText: _hexError,
|
||||
errorMaxLines: compact ? 4 : 3,
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: compact,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: budget.search,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
16,
|
||||
compact ? 6 : 12,
|
||||
16,
|
||||
0,
|
||||
),
|
||||
child: TextField(
|
||||
key: const Key('path-editor-search-field'),
|
||||
onChanged: (value) =>
|
||||
setState(() => _search = value),
|
||||
scrollPadding: EdgeInsets.zero,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.pathEditor_searchRepeaters,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: compact,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: repeaters.isEmpty
|
||||
? Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
16,
|
||||
12,
|
||||
16,
|
||||
8,
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Text(
|
||||
l10n.path_noRepeatersFound,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
key: const Key('path-editor-repeater-list'),
|
||||
keyboardDismissBehavior:
|
||||
ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
16,
|
||||
8,
|
||||
16,
|
||||
8,
|
||||
),
|
||||
itemCount: repeaters.length,
|
||||
itemBuilder: (context, index) =>
|
||||
_repeaterTile(context, repeaters[index]),
|
||||
),
|
||||
),
|
||||
_hopViewport(compact, budget.hop),
|
||||
_hexViewport(compact, budget.hex),
|
||||
_searchViewport(compact, budget.search),
|
||||
Expanded(child: _repeaterViewport(repeaters)),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -67,6 +67,29 @@ Future<void> _pumpSheet(
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> _revealInFallback(
|
||||
WidgetTester tester,
|
||||
Finder scrollable,
|
||||
Finder target,
|
||||
) async {
|
||||
final state = tester.state<ScrollableState>(scrollable);
|
||||
final view = tester.getRect(
|
||||
find.byKey(const Key('path-editor-scroll-fallback')),
|
||||
);
|
||||
for (var i = 0; i < 40; i++) {
|
||||
final rect = tester.getRect(target);
|
||||
if (rect.center.dy >= view.top && rect.center.dy <= view.bottom) return;
|
||||
final next = (state.position.pixels + 48).clamp(
|
||||
0.0,
|
||||
state.position.maxScrollExtent,
|
||||
);
|
||||
expect(next, greaterThan(state.position.pixels));
|
||||
state.position.jumpTo(next);
|
||||
await tester.pump();
|
||||
}
|
||||
fail('Could not scroll $target into the path sheet');
|
||||
}
|
||||
|
||||
List<String> _repeaterNames(WidgetTester tester) {
|
||||
return tester
|
||||
.widgetList<Text>(
|
||||
@@ -162,6 +185,7 @@ void main() {
|
||||
find.byKey(const Key('path-editor-hex-field')).hitTestable(),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byKey(const Key('path-editor-scroll-fallback')), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
@@ -191,6 +215,70 @@ void main() {
|
||||
expect(button.bottom, lessThanOrEqualTo(sheet.bottom + 1));
|
||||
});
|
||||
|
||||
testWidgets('a landscape keyboard sheet scrolls instead of overflowing', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpSheet(
|
||||
tester,
|
||||
size: const Size(800, 180),
|
||||
initialPath: [0x60, 0x60, 0x11, 0x22],
|
||||
);
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(
|
||||
find.byKey(const Key('path-editor-scroll-fallback')),
|
||||
findsOneWidget,
|
||||
);
|
||||
// The hop list has its own scrollable. The fallback is the scrollable
|
||||
// that also contains the hex field.
|
||||
final scrollable = find.byElementPredicate((element) {
|
||||
if (element.widget is! Scrollable) return false;
|
||||
var hasHex = false;
|
||||
void visit(Element node) {
|
||||
node.visitChildren((child) {
|
||||
if (child.widget.key == const Key('path-editor-hex-field')) {
|
||||
hasHex = true;
|
||||
}
|
||||
visit(child);
|
||||
});
|
||||
}
|
||||
|
||||
visit(element);
|
||||
return hasHex;
|
||||
});
|
||||
await tester.scrollUntilVisible(
|
||||
find.byKey(const Key('path-editor-hex-field')),
|
||||
40,
|
||||
scrollable: scrollable,
|
||||
);
|
||||
await tester.enterText(
|
||||
find.byKey(const Key('path-editor-hex-field')),
|
||||
'ZZ',
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(find.textContaining('Invalid'), findsOneWidget);
|
||||
|
||||
await _revealInFallback(
|
||||
tester,
|
||||
scrollable,
|
||||
find.byKey(const Key('path-editor-search-field'), skipOffstage: false),
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('path-editor-search-field')).hitTestable(),
|
||||
findsOneWidget,
|
||||
);
|
||||
await _revealInFallback(
|
||||
tester,
|
||||
scrollable,
|
||||
find.text('Acreage North', skipOffstage: false),
|
||||
);
|
||||
expect(find.text('Acreage North').hitTestable(), findsOneWidget);
|
||||
final button = tester.getRect(find.text('Use this path'));
|
||||
final sheet = tester.getRect(find.byType(PathEditorSheet));
|
||||
expect(button.bottom, lessThanOrEqualTo(sheet.bottom + 1));
|
||||
});
|
||||
|
||||
testWidgets('action buttons stay below the repeater list on a short sheet', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in new issue
Block a user