fix(theme): snack bars float above the navigation bar, lined up with it
Flutter's default snack bar is Material 2's fixed one, a rectangle across the window's foot, which sat squarely on the floating, rounded navigation bar. Material 3 places snack bars floating above the navigation bar with small rounded corners: they now stand 8 dp above it and 16 dp in from the sides, as the bar does, and from medium windows on they are 560 dp wide and centred rather than as wide as the window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
7a2f1a96d9
commit
11a16f5686
1 changed files with 111 additions and 41 deletions
|
|
@ -150,6 +150,39 @@ void main() {
|
|||
expect(around(), scheme.surfaceContainerLow);
|
||||
});
|
||||
|
||||
testWidgets('a snack bar floats 8 above the navigation bar, as far in '
|
||||
'from the sides; from medium windows on 560 wide, centred', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.padding = const FakeViewPadding(bottom: 24);
|
||||
addTearDown(tester.view.resetPadding);
|
||||
Future<Rect> snackBar() async {
|
||||
await openTab(tester, 'Library');
|
||||
ScaffoldMessenger.of(
|
||||
tester.element(find.byType(LibraryScreen)),
|
||||
).showSnackBar(const SnackBar(content: Text('Archived')));
|
||||
await tester.pumpAndSettle();
|
||||
return tester.getRect(
|
||||
find.descendant(
|
||||
of: find.byType(SnackBar),
|
||||
matching: find.byType(Material),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
await showApp(tester, width: 400);
|
||||
final narrow = await snackBar();
|
||||
expect(narrow.left, 16);
|
||||
expect(narrow.right, 400 - 16);
|
||||
// The bar's top, less 8.
|
||||
expect(narrow.bottom, 900 - 24 - 8 - 64 - 8);
|
||||
|
||||
await showApp(tester);
|
||||
final wide = await snackBar();
|
||||
expect(wide.width, 560);
|
||||
expect(wide.center.dx, 600);
|
||||
});
|
||||
|
||||
testWidgets('on a phone, the navigation bar steps aside inside a '
|
||||
'studyset and its notes, and comes back in the library; inside, the '
|
||||
"screens keep clear of the system's bar", (tester) async {
|
||||
|
|
|
|||
Loading…
Reference in a new issue