feat(player): 首页进详情与播放页改为淡入转场
This commit is contained in:
1 parent
3a636ca894
commit
8c04099d97
4 files changed
+72
-3
No files matched your search
@@ -0,0 +1,50 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/navigation/fade_page_route.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('should_fade_in_without_slide_and_use_short_transitions', (
|
||||
tester,
|
||||
) async {
|
||||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
var routePushed = false;
|
||||
final route = FadePageRoute<void>(
|
||||
builder: (_) =>
|
||||
const Scaffold(key: Key('fade-route-page'), body: SizedBox.expand()),
|
||||
);
|
||||
|
||||
expect(route.transitionDuration, const Duration(milliseconds: 220));
|
||||
expect(route.reverseTransitionDuration, const Duration(milliseconds: 180));
|
||||
expect(route.opaque, isTrue);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
navigatorKey: navigatorKey,
|
||||
home: Builder(
|
||||
builder: (context) => Scaffold(
|
||||
body: TextButton(
|
||||
onPressed: () {
|
||||
navigatorKey.currentState!.push(route);
|
||||
routePushed = true;
|
||||
},
|
||||
child: const Text('Open'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Open'));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
|
||||
expect(routePushed, isTrue);
|
||||
expect(find.byKey(const Key('fade-route-page')), findsOneWidget);
|
||||
final fade = tester.widget<FadeTransition>(
|
||||
find.byType(FadeTransition).last,
|
||||
);
|
||||
expect(fade.opacity.value, inExclusiveRange(0, 1));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user