Skip to content

Commit 021e06d

Browse files
committed
Fix some tests
Flutter 3.7 seems to need an explicit Scrollable widget
1 parent 3ee32e3 commit 021e06d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/screens/form_screen.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
import 'package:flutter/material.dart';
20+
import 'package:flutter/rendering.dart';
2021
import 'package:wger/theme/theme.dart';
2122

2223
/// Arguments passed to the form screen
@@ -59,9 +60,11 @@ class FormScreen extends StatelessWidget {
5960
backgroundColor: args.backgroundColor,
6061
appBar: AppBar(title: Text(args.title)),
6162
body: args.hasListView
62-
? Padding(
63-
padding: args.padding,
64-
child: args.widget,
63+
? Scrollable(
64+
viewportBuilder: (BuildContext context, ViewportOffset position) => Padding(
65+
padding: args.padding,
66+
child: args.widget,
67+
),
6568
)
6669
: Column(
6770
mainAxisSize: MainAxisSize.max,

test/nutrition/nutritional_meal_item_form_test.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:convert';
22

33
import 'package:flutter/material.dart';
4+
import 'package:flutter/rendering.dart';
45
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
56
import 'package:flutter_test/flutter_test.dart';
67
import 'package:flutter_typeahead/flutter_typeahead.dart';
@@ -84,7 +85,10 @@ void main() {
8485
supportedLocales: AppLocalizations.supportedLocales,
8586
navigatorKey: key,
8687
home: Scaffold(
87-
body: MealItemForm(meal, const [], null, code, test),
88+
body: Scrollable(
89+
viewportBuilder: (BuildContext context, ViewportOffset position) =>
90+
MealItemForm(meal, const [], null, code, test),
91+
),
8892
),
8993
routes: {
9094
NutritionalPlanScreen.routeName: (ctx) => NutritionalPlanScreen(),

0 commit comments

Comments
 (0)