fix: issue-372, issue-227, issue-406

This commit is contained in:
misha
2026-09-02 09:32:14 +03:00
parent 10af279d87
commit c6ea1d414d
34 changed files with 1623 additions and 387 deletions

View File

@@ -0,0 +1,84 @@
import 'package:eatvio_app/features/profile/presentation/widgets/expandable_page_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('ExpandablePageView', () {
testWidgets(
'sizes itself to a child taller than the old fixed 781 height',
(tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: SingleChildScrollView(
child: ExpandablePageView(
itemCount: 1,
itemBuilder: _tallPlanCard,
),
),
),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
expect(find.text('Питание для диабетиков'), findsOneWidget);
expect(find.text('Показать ещё'), findsOneWidget);
final viewSize = tester.getSize(find.byType(ExpandablePageView));
expect(viewSize.height, greaterThan(781));
},
);
testWidgets('does not overflow a vertical Column inside a bounded parent', (
tester,
) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: SizedBox(
height: 781,
width: 402,
child: SingleChildScrollView(
child: ExpandablePageView(
itemCount: 1,
itemBuilder: _tallPlanCard,
),
),
),
),
),
);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
expect(find.text('Показать ещё'), findsOneWidget);
});
});
}
Widget _tallPlanCard(BuildContext context, int index) {
return const Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(width: 402, height: 426),
SizedBox(height: 12),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text('Питание для диабетиков'),
),
SizedBox(height: 12),
SizedBox(width: 370, height: 156),
Padding(
padding: EdgeInsets.only(left: 16, top: 8),
child: Text('Показать ещё'),
),
SizedBox(height: 16),
SizedBox(height: 72),
SizedBox(height: 16),
SizedBox(height: 32),
SizedBox(height: 12),
],
);
}

View File

@@ -257,6 +257,8 @@ void main() {
expect(find.byType(BlogPostMediaContent), findsOneWidget);
expect(find.textContaining('Галерея и видео'), findsWidgets);
expect(find.byType(CircleAvatar), findsNothing);
expect(find.text(post.author.authorName), findsNothing);
});
testWidgets('renders gallery-only media content', (tester) async {