fix(ui): 骨架屏改为逐卡片扫光
This commit is contained in:
1 parent
00405d2e3b
commit
a5dbae7fff
2 files changed
+91
-38
No files matched your search
@@ -0,0 +1,47 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/widgets/drama_grid_skeleton.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('renders one local shimmer mask per skeleton card', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(390, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: DramaGridSkeleton(
|
||||
columns: 3,
|
||||
horizontalPadding: 14,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
|
||||
expect(find.byType(GridView), findsOneWidget);
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: find.byType(GridView),
|
||||
matching: find.byType(ShaderMask),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
for (var index = 0; index < 9; index++) {
|
||||
final card = find.byKey(Key('drama-grid-skeleton-$index'));
|
||||
expect(card, findsOneWidget);
|
||||
expect(
|
||||
find.ancestor(of: card, matching: find.byType(ShaderMask)),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user