feat(flutter): 增加关键操作震动反馈
This commit is contained in:
1 parent
e609e3ad8d
commit
8a481d5c62
20 files changed
+308
-72
No files matched your search
@@ -11,6 +11,7 @@ import 'package:fruitshorts/core/data/repositories/catalog_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
|
||||
import 'package:fruitshorts/core/data/services/auth_controller.dart';
|
||||
import 'package:fruitshorts/core/data/services/auth_session_store.dart';
|
||||
import 'package:fruitshorts/core/platform/haptics.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/watch_records/watch_records_page.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -19,6 +20,7 @@ import 'package:shared_preferences_platform_interface/shared_preferences_async_p
|
||||
|
||||
import '../support/fake_catalog.dart';
|
||||
import '../support/fake_http_adapter.dart';
|
||||
import '../support/fake_haptics.dart';
|
||||
|
||||
void main() {
|
||||
setUp(() {
|
||||
@@ -101,12 +103,14 @@ void main() {
|
||||
(tester) async {
|
||||
final auth = await _auth(signedIn: true);
|
||||
final history = CountingWatchHistory([_progress('the-signal-demo')]);
|
||||
final haptics = FakeHaptics();
|
||||
|
||||
await _pumpPage(
|
||||
tester,
|
||||
auth: auth,
|
||||
history: history,
|
||||
catalog: FakeCatalogRepository(),
|
||||
haptics: haptics,
|
||||
);
|
||||
await tester.tap(find.byKey(const Key('watch-records-clear')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -118,6 +122,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(history.clearCalls, 1);
|
||||
expect(haptics.mediumImpacts, 1);
|
||||
expect(find.text('No watch history yet.'), findsOneWidget);
|
||||
},
|
||||
);
|
||||
@@ -156,6 +161,7 @@ Future<void> _pumpPage(
|
||||
required AuthController auth,
|
||||
required WatchHistoryRepository history,
|
||||
required CatalogRepository catalog,
|
||||
FakeHaptics? haptics,
|
||||
}) async {
|
||||
await tester.pumpWidget(
|
||||
MultiProvider(
|
||||
@@ -163,6 +169,7 @@ Future<void> _pumpPage(
|
||||
ChangeNotifierProvider<AuthController>.value(value: auth),
|
||||
Provider<WatchHistoryRepository>.value(value: history),
|
||||
Provider<CatalogRepository>.value(value: catalog),
|
||||
Provider<Haptics>.value(value: haptics ?? FakeHaptics()),
|
||||
],
|
||||
child: MaterialApp(
|
||||
locale: const Locale('en'),
|
||||
|
||||
Reference in new issue
Block a user