diff --git a/lib/core/widgets/markdown_html_widget.dart b/lib/core/widgets/markdown_html_widget.dart
index 53e7c770..5361e840 100644
--- a/lib/core/widgets/markdown_html_widget.dart
+++ b/lib/core/widgets/markdown_html_widget.dart
@@ -41,7 +41,7 @@ class MarkdownHtmlWidget extends StatelessWidget {
extensionSet: md.ExtensionSet.gitHubFlavored,
);
- final screenWidth = MediaQuery.of(context).size.width;
+ final screenWidth = MediaQuery.maybeOf(context)?.size.width ?? 400.0;
final defaultImageWidth = imageWidth ?? (screenWidth - 32);
final defaultTextColor = textColor ?? Colors.black87;
final defaultFontSize = fontSize ?? 16.0;
diff --git a/test/core/widgets/marketing_bottom_sheet_test.dart b/test/core/widgets/marketing_bottom_sheet_test.dart
index 32e92e7b..a54d3e14 100644
--- a/test/core/widgets/marketing_bottom_sheet_test.dart
+++ b/test/core/widgets/marketing_bottom_sheet_test.dart
@@ -29,6 +29,7 @@ void main() {
const MarketingBottomSheet(),
),
);
+ await tester.pumpAndSettle();
expect(find.byType(MarketingBottomSheet), findsOneWidget);
});
@@ -59,6 +60,7 @@ void main() {
),
);
+ await tester.pump();
await tester.tap(find.text('Show'));
await tester.pumpAndSettle();
diff --git a/test/core/widgets/option_widget_test.dart b/test/core/widgets/option_widget_test.dart
index cf8a3cf9..6a70eb22 100644
--- a/test/core/widgets/option_widget_test.dart
+++ b/test/core/widgets/option_widget_test.dart
@@ -24,6 +24,7 @@ void main() {
testWidgets('returns SizedBox.shrink when option is null', (tester) async {
await tester.pumpWidget(createTestWidget(const OptionWidget(option: null, duration: 7)));
+ await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
expect(find.byType(SizedBox), findsWidgets);
@@ -33,6 +34,7 @@ void main() {
const option = PacketOptions(items: ['Item 1', 'Item 2'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
+ await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
expect(find.text('Short'), findsOneWidget);
@@ -43,6 +45,7 @@ void main() {
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: true);
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
+ await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
});
@@ -51,6 +54,7 @@ void main() {
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7, disableDuration: true)));
+ await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
});
diff --git a/test/core/widgets/show_error_dialog_test.dart b/test/core/widgets/show_error_dialog_test.dart
index d56c7fc0..c1c6c533 100644
--- a/test/core/widgets/show_error_dialog_test.dart
+++ b/test/core/widgets/show_error_dialog_test.dart
@@ -31,6 +31,7 @@ void main() {
),
);
+ await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
@@ -68,6 +69,7 @@ void main() {
),
);
+ await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
@@ -103,6 +105,7 @@ void main() {
),
);
+ await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
@@ -134,6 +137,7 @@ void main() {
),
);
+ await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
diff --git a/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart b/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart
index dbd269f3..0ef9081a 100644
--- a/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart
+++ b/test/features/diary/presentation/widgets/chosen_diet_widget_content_test.dart
@@ -34,6 +34,7 @@ void main() {
),
),
);
+ await tester.pumpAndSettle();
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
expect(find.text('Test Diet'), findsOneWidget);
@@ -50,6 +51,7 @@ void main() {
),
),
);
+ await tester.pumpAndSettle();
expect(find.byType(ChosenDietWidgetContent), findsOneWidget);
});
@@ -65,6 +67,7 @@ void main() {
),
),
);
+ await tester.pumpAndSettle();
expect(find.text('My Diet'), findsOneWidget);
});
diff --git a/test/features/diary/presentation/widgets/chosen_plan_widget_content_test.dart b/test/features/diary/presentation/widgets/chosen_plan_widget_content_test.dart
index d5f8d9cf..9050dcd3 100644
--- a/test/features/diary/presentation/widgets/chosen_plan_widget_content_test.dart
+++ b/test/features/diary/presentation/widgets/chosen_plan_widget_content_test.dart
@@ -37,6 +37,7 @@ void main() {
planName: 'Test Plan',
planDuration: 14,
));
+ await tester.pumpAndSettle();
expect(find.byType(ChosenPlanWidgetContent), findsOneWidget);
expect(find.text('Test Plan'), findsOneWidget);
@@ -48,6 +49,7 @@ void main() {
planName: 'My Plan',
planDuration: 7,
));
+ await tester.pumpAndSettle();
expect(find.byType(ChosenPlanWidgetContent), findsOneWidget);
expect(find.textContaining('3'), findsOneWidget);
@@ -60,6 +62,7 @@ void main() {
planName: 'Long Plan',
planDuration: 30,
));
+ await tester.pumpAndSettle();
expect(find.byType(ChosenPlanWidgetContent), findsOneWidget);
expect(find.text('Long Plan'), findsOneWidget);
diff --git a/test/features/feed/presentation/widgets/comments_widget_test.dart b/test/features/feed/presentation/widgets/comments_widget_test.dart
index 185e0157..48974de6 100644
--- a/test/features/feed/presentation/widgets/comments_widget_test.dart
+++ b/test/features/feed/presentation/widgets/comments_widget_test.dart
@@ -78,6 +78,7 @@ void main() {
),
),
);
+ await tester.pumpAndSettle();
expect(find.byType(CommentsWidget), findsOneWidget);
});
diff --git a/test/features/registration_v2/presentation/widgets/show_successful_registration_bottom_sheet_test.dart b/test/features/registration_v2/presentation/widgets/show_successful_registration_bottom_sheet_test.dart
index 6a9945f4..e55692f5 100644
--- a/test/features/registration_v2/presentation/widgets/show_successful_registration_bottom_sheet_test.dart
+++ b/test/features/registration_v2/presentation/widgets/show_successful_registration_bottom_sheet_test.dart
@@ -63,6 +63,7 @@ void main() {
// Act
await tester.pumpWidget(createTestWidget(const SizedBox(), mockCubit));
+ await tester.pump();
await tester.tap(find.text('Show Bottom Sheet'));
await tester.pumpAndSettle();
@@ -107,6 +108,7 @@ void main() {
// Act
await tester.pumpWidget(createTestWidgetError(const SizedBox(), mockCubit));
+ await tester.pump();
await tester.tap(find.text('Show Bottom Sheet'));
await tester.pumpAndSettle();
diff --git a/test/features/settings/presentation/pages/change_password_screen_test.dart b/test/features/settings/presentation/pages/change_password_screen_test.dart
index b0ada6ec..fe576e3b 100644
--- a/test/features/settings/presentation/pages/change_password_screen_test.dart
+++ b/test/features/settings/presentation/pages/change_password_screen_test.dart
@@ -54,6 +54,7 @@ void main() {
home: ChangePasswordScreen(settingsEntity: settingsEntity),
),
);
+ await tester.pumpAndSettle();
expect(find.byType(ChangePasswordScreen), findsOneWidget);
expect(find.text('Смена пароля'), findsOneWidget);
@@ -80,6 +81,7 @@ void main() {
home: ChangePasswordScreen(settingsEntity: settingsEntity),
),
);
+ await tester.pumpAndSettle();
expect(find.byType(AppBar), findsOneWidget);
expect(find.text('Смена пароля'), findsOneWidget);