2024-01-05 07:20:55 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
|
|
|
extension PumpConsumerWidget on WidgetTester {
|
|
|
|
/// Wraps the provided [widget] with Material app such that it becomes:
|
|
|
|
///
|
|
|
|
/// ProviderScope
|
|
|
|
/// |-MaterialApp
|
|
|
|
/// |-Material
|
|
|
|
/// |-[widget]
|
|
|
|
Future<void> pumpConsumerWidget(
|
|
|
|
Widget widget, {
|
|
|
|
Duration? duration,
|
|
|
|
EnginePhase phase = EnginePhase.sendSemanticsUpdate,
|
|
|
|
List<Override> overrides = const [],
|
|
|
|
}) async {
|
|
|
|
return pumpWidget(
|
|
|
|
ProviderScope(
|
|
|
|
overrides: overrides,
|
|
|
|
child: MaterialApp(
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
home: Material(child: widget),
|
|
|
|
),
|
|
|
|
),
|
2024-05-16 17:58:02 +02:00
|
|
|
duration: duration,
|
|
|
|
phase: phase,
|
2024-01-05 07:20:55 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|