fix(home): 首页深色底部导航补齐安全区底色
This commit is contained in:
1 parent
ac1202c329
commit
66e9062ba5
3 files changed
+91
-29
No files matched your search
@@ -82,4 +82,68 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('tab-theater')));
|
||||
expect(theaterTaps, 1);
|
||||
});
|
||||
|
||||
testWidgets('should_fill_dark_bottom_safe_area_with_black_background', (
|
||||
tester,
|
||||
) async {
|
||||
const barKey = Key('dark-nav-bar');
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: MediaQuery(
|
||||
data: const MediaQueryData(padding: EdgeInsets.only(bottom: 34)),
|
||||
child: Scaffold(
|
||||
bottomNavigationBar: AppBottomNav(
|
||||
dark: true,
|
||||
barKey: barKey,
|
||||
items: [
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-home'),
|
||||
icon: Icons.movie_outlined,
|
||||
selectedIcon: Icons.movie_rounded,
|
||||
label: 'Home',
|
||||
selected: true,
|
||||
onTap: () {},
|
||||
),
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-theater'),
|
||||
icon: Icons.explore_outlined,
|
||||
selectedIcon: Icons.explore_rounded,
|
||||
label: 'Theater',
|
||||
onTap: () {},
|
||||
),
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-create'),
|
||||
icon: Icons.add_box_outlined,
|
||||
selectedIcon: Icons.add_box_rounded,
|
||||
label: 'Create',
|
||||
onTap: () {},
|
||||
),
|
||||
AppBottomNavItem(
|
||||
tabKey: const Key('tab-mine'),
|
||||
icon: Icons.person_outline_rounded,
|
||||
selectedIcon: Icons.person_rounded,
|
||||
label: 'Me',
|
||||
onTap: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
tester.getSize(find.byType(AppBottomNav)).height,
|
||||
AppDimens.navHeight + 34,
|
||||
);
|
||||
expect(tester.getSize(find.byKey(barKey)).height, AppDimens.navHeight);
|
||||
|
||||
final coloredBox = tester.widget<ColoredBox>(
|
||||
find.descendant(
|
||||
of: find.byType(AppBottomNav),
|
||||
matching: find.byType(ColoredBox),
|
||||
),
|
||||
);
|
||||
expect(coloredBox.color, Colors.black);
|
||||
});
|
||||
}
|
||||
@@ -53,7 +53,7 @@ void main() {
|
||||
final decoration = bar.decoration as BoxDecoration;
|
||||
final border = decoration.border as Border;
|
||||
// 首页 feed 用深色导航。
|
||||
expect(decoration.color, const Color(0xE6000000));
|
||||
expect(decoration.color, Colors.black);
|
||||
expect(border.top.color, Colors.white12);
|
||||
expect(
|
||||
tester
|
||||
|
||||
Reference in new issue
Block a user