Merge: artifact viewer bar position and clicks; tab fade semantics
This commit is contained in:
@@ -13,8 +13,18 @@ typedef ArtifactHtmlBuilder =
|
||||
/// empty `sandbox` blocks scripts, forms, popups and navigation; on Android and
|
||||
/// iOS in a web view with JavaScript disabled and navigation refused. The
|
||||
/// document never runs code with the app's origin or credentials.
|
||||
Widget defaultArtifactHtml(BuildContext context, String html) =>
|
||||
SizedBox.expand(
|
||||
///
|
||||
/// The preview stops at the floating bars instead of passing behind them: on
|
||||
/// the web the iframe is a platform view that takes every click over its
|
||||
/// area, even where a bar is drawn on top, which left the viewer's actions
|
||||
/// and pager unclickable.
|
||||
Widget defaultArtifactHtml(BuildContext context, String html) {
|
||||
final padding = MediaQuery.paddingOf(context);
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: padding.top, bottom: padding.bottom),
|
||||
child: SizedBox.expand(
|
||||
key: const Key('artifact-html-preview'),
|
||||
child: impl.InertHtmlView(html: html),
|
||||
);
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -101,48 +101,48 @@ class ArtifactViewerBody extends StatelessWidget {
|
||||
// no empty glass bar, and no bottom clearance reserved for one.
|
||||
if (resolved == null && count <= 1) return swipe;
|
||||
return FloatingBarOverlay(
|
||||
bar: Padding(
|
||||
padding: withFloatingBarClearance(context, EdgeInsets.zero),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
minimum: const EdgeInsets.all(8),
|
||||
child: SizedBox(
|
||||
height: 56,
|
||||
child: GlassPill(
|
||||
cupertino: usesCupertinoHost(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||
child: Row(
|
||||
key: const Key('artifact-viewer-actions'),
|
||||
children: [
|
||||
if (resolved != null && !resolved.external)
|
||||
ArtifactFileActions(
|
||||
key: ValueKey<String>(
|
||||
'viewer-files-${page.group.stageKey}\u0000'
|
||||
'${page.group.visit}\u0000${page.artifact.url}',
|
||||
),
|
||||
artifact: page.artifact,
|
||||
resolved: resolved,
|
||||
fetch: fetch,
|
||||
bridge: fileBridge,
|
||||
compact: true,
|
||||
),
|
||||
if (resolved != null)
|
||||
_Actions(
|
||||
resolved: resolved,
|
||||
onOpen: onOpen,
|
||||
onCopy: onCopy,
|
||||
),
|
||||
Expanded(
|
||||
child: _Pager(
|
||||
index: index,
|
||||
count: count,
|
||||
onPrevious: onPrevious,
|
||||
onNext: onNext,
|
||||
// The SafeArea already lifts the bar by the inherited bottom inset (a
|
||||
// shell bar below the pane); adding that clearance again floated the
|
||||
// bar far above it.
|
||||
bar: SafeArea(
|
||||
top: false,
|
||||
minimum: const EdgeInsets.all(8),
|
||||
child: SizedBox(
|
||||
height: 56,
|
||||
child: GlassPill(
|
||||
cupertino: usesCupertinoHost(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||
child: Row(
|
||||
key: const Key('artifact-viewer-actions'),
|
||||
children: [
|
||||
if (resolved != null && !resolved.external)
|
||||
ArtifactFileActions(
|
||||
key: ValueKey<String>(
|
||||
'viewer-files-${page.group.stageKey}\u0000'
|
||||
'${page.group.visit}\u0000${page.artifact.url}',
|
||||
),
|
||||
artifact: page.artifact,
|
||||
resolved: resolved,
|
||||
fetch: fetch,
|
||||
bridge: fileBridge,
|
||||
compact: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (resolved != null)
|
||||
_Actions(
|
||||
resolved: resolved,
|
||||
onOpen: onOpen,
|
||||
onCopy: onCopy,
|
||||
),
|
||||
Expanded(
|
||||
child: _Pager(
|
||||
index: index,
|
||||
count: count,
|
||||
onPrevious: onPrevious,
|
||||
onNext: onNext,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -372,6 +372,8 @@ class _TabEntranceState extends State<_TabEntrance>
|
||||
);
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
// Tabs (and their badge counts) stay announced while they fade in.
|
||||
alwaysIncludeSemantics: true,
|
||||
child: ScaleTransition(
|
||||
scale: Tween<double>(begin: 0.88, end: 1).animate(animation),
|
||||
child: widget.child,
|
||||
|
||||
@@ -726,6 +726,9 @@ void main() {
|
||||
);
|
||||
final pager = tester.getRect(find.byKey(artifactNextKey));
|
||||
expect(pager.bottom, lessThanOrEqualTo(size.height - 120));
|
||||
// Right above the stacked bar, not lifted by its clearance twice
|
||||
// (the bar is one 56 px pill above the inset plus its margin).
|
||||
expect(pager.bottom, greaterThanOrEqualTo(size.height - 120 - 56));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user