@@ -118,46 +118,49 @@ class BlockGridView extends StatelessWidget {
118118 ],
119119 ),
120120 if (isOpen)
121- Row (
122- children: [
123- Container (
124- padding: const EdgeInsets .all (8 ),
125- height: 195 ,
126- width: MediaQuery .of (context).size.width - 34 ,
127- child: ScrollShadow (
128- child: GridView .builder (
129- padding: const EdgeInsets .all (0 ),
130- gridDelegate:
131- const SliverGridDelegateWithFixedCrossAxisCount (
132- crossAxisCount: 6 ,
133- mainAxisSpacing: 3 ,
134- crossAxisSpacing: 3 ,
135- ),
136- itemCount: block.challenges.length,
137- itemBuilder: (context, step) {
138- final challenge = block.challengeTiles[step];
121+ Container (
122+ padding: const EdgeInsets .all (8 ),
123+ constraints: BoxConstraints (
124+ maxHeight: 300 ,
125+ ),
126+ child: Builder (builder: (context) {
127+ final tiles = block.challengeTiles.length;
139128
140- // challenge.name follows the "Step 1", "Step 2" format
141- // so we extract the step number here
142- final match =
143- RegExp (r'\d+' ).firstMatch (challenge.name);
144- final stepNumber = match != null
145- ? int .parse (match.group (0 )! )
146- : step + 1 ;
129+ final isScrollable = tiles > 24 ;
147130
148- return ChallengeTile (
149- block: block,
150- model: model,
151- step: stepNumber,
152- challengeId: challenge.id,
153- isDownloaded: false ,
154- );
155- },
131+ return ScrollShadow (
132+ child: GridView .builder (
133+ shrinkWrap: true ,
134+ padding: const EdgeInsets .all (0 ),
135+ physics: isScrollable
136+ ? const AlwaysScrollableScrollPhysics ()
137+ : const NeverScrollableScrollPhysics (),
138+ gridDelegate:
139+ const SliverGridDelegateWithFixedCrossAxisCount (
140+ crossAxisCount: 6 ,
141+ mainAxisSpacing: 3 ,
142+ crossAxisSpacing: 3 ,
156143 ),
144+ itemCount: block.challenges.length,
145+ itemBuilder: (context, step) {
146+ final challenge = block.challengeTiles[step];
147+ final match = RegExp (r'\d+' ).firstMatch (challenge.name);
148+ final stepNumber = match != null
149+ ? int .parse (match.group (0 )! )
150+ : step + 1 ;
151+
152+ return ChallengeTile (
153+ block: block,
154+ model: model,
155+ step: stepNumber,
156+ challengeId: challenge.id,
157+ isDownloaded: false ,
158+ );
159+ },
157160 ),
158- ),
159- ] ,
160- ),
161+ );
162+ }) ,
163+ )
161164 ],
162165 ),
163166 ),
0 commit comments