feat(ui): 更新底栏图标与播放加载视觉
This commit is contained in:
1 parent
8ec6df2be5
commit
12b1a11bd3
11 files changed
+584
-70
No files matched your search
@@ -11,6 +11,7 @@ import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/theme/app_dimens.dart';
|
||||
import 'package:fruitshorts/core/widgets/app_bottom_nav.dart';
|
||||
import 'package:fruitshorts/core/widgets/root_nav_glyph.dart';
|
||||
import 'package:fruitshorts/pages/following/following_page.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
@@ -138,18 +139,20 @@ void main() {
|
||||
.duration,
|
||||
lessThanOrEqualTo(const Duration(milliseconds: 200)),
|
||||
);
|
||||
final selectedHomeIcon = tester.widget<Icon>(
|
||||
final selectedHomeIcon = tester.widget<RootNavGlyph>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-home')),
|
||||
matching: find.byIcon(Icons.home_rounded),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
);
|
||||
expect(selectedHomeIcon.color, AppColors.navSelected);
|
||||
expect(selectedHomeIcon.kind, RootNavGlyphKind.home);
|
||||
expect(selectedHomeIcon.selected, isTrue);
|
||||
expect(selectedHomeIcon.size, AppDimens.navIcon);
|
||||
expect(
|
||||
tester.getSize(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-home')),
|
||||
matching: find.byIcon(Icons.home_rounded),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
),
|
||||
const Size.square(AppDimens.navIcon),
|
||||
@@ -157,21 +160,21 @@ void main() {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-recommend')),
|
||||
matching: find.byIcon(Icons.smart_display_outlined),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-follow')),
|
||||
matching: find.byIcon(Icons.bookmark_border_rounded),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-mine')),
|
||||
matching: find.byIcon(Icons.person_outline_rounded),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
@@ -188,7 +191,7 @@ void main() {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-recommend')),
|
||||
matching: find.byIcon(Icons.smart_display_rounded),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
@@ -219,20 +222,20 @@ void main() {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-home')),
|
||||
matching: find.byIcon(Icons.home_outlined),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
tester
|
||||
.widget<Icon>(
|
||||
.widget<RootNavGlyph>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-home')),
|
||||
matching: find.byIcon(Icons.home_outlined),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
)
|
||||
.color,
|
||||
AppColors.navUnselected,
|
||||
.selected,
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -270,7 +273,7 @@ void main() {
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('tab-follow')),
|
||||
matching: find.byIcon(Icons.bookmark_rounded),
|
||||
matching: find.byType(RootNavGlyph),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/widgets/app_root_tab.dart';
|
||||
import 'package:fruitshorts/core/widgets/root_nav_glyph.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'should_render_four_ordered_glyphs_with_home_selected_when_root_nav_builds',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
bottomNavigationBar: AppRootBottomNav(
|
||||
selected: AppRootTab.home,
|
||||
onSelected: (_) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final glyphs = tester
|
||||
.widgetList<RootNavGlyph>(find.byType(RootNavGlyph))
|
||||
.toList();
|
||||
expect(glyphs.map((glyph) => glyph.kind), RootNavGlyphKind.values);
|
||||
expect(glyphs.map((glyph) => glyph.selected), [
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
]);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user