Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 39 additions & 36 deletions mobile-app/lib/ui/views/learn/block/templates/grid/grid_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,46 +113,49 @@ class BlockGridView extends StatelessWidget {
],
),
if (isOpen)
Row(
children: [
Container(
padding: const EdgeInsets.all(8),
height: 195,
width: MediaQuery.of(context).size.width - 34,
child: ScrollShadow(
child: GridView.builder(
padding: const EdgeInsets.all(0),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 6,
mainAxisSpacing: 3,
crossAxisSpacing: 3,
),
itemCount: block.challenges.length,
itemBuilder: (context, step) {
final challenge = block.challengeTiles[step];
Container(
padding: const EdgeInsets.all(8),
constraints: BoxConstraints(
maxHeight: 300,
),
child: Builder(builder: (context) {
final tiles = block.challengeTiles.length;

// challenge.name follows the "Step 1", "Step 2" format
// so we extract the step number here
final match =
RegExp(r'\d+').firstMatch(challenge.name);
final stepNumber = match != null
? int.parse(match.group(0)!)
: step + 1;
final isScrollable = tiles > 24;

return ChallengeTile(
block: block,
model: model,
step: stepNumber,
challengeId: challenge.id,
isDownloaded: false,
);
},
return ScrollShadow(
child: GridView.builder(
shrinkWrap: true,
padding: const EdgeInsets.all(0),
physics: isScrollable
? const AlwaysScrollableScrollPhysics()
: const NeverScrollableScrollPhysics(),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 6,
mainAxisSpacing: 3,
crossAxisSpacing: 3,
),
itemCount: block.challenges.length,
itemBuilder: (context, step) {
final challenge = block.challengeTiles[step];
final match = RegExp(r'\d+').firstMatch(challenge.name);
final stepNumber = match != null
? int.parse(match.group(0)!)
: step + 1;

return ChallengeTile(
block: block,
model: model,
step: stepNumber,
challengeId: challenge.id,
isDownloaded: false,
);
},
),
),
],
),
);
}),
)
],
),
),
Expand Down
Loading