Last active
March 20, 2024 03:19
-
-
Save sixtusagbo/bce417166786a8d9cd7f8120c4741e0d to your computer and use it in GitHub Desktop.
Rajvis Infinite size issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: MyCardWorkout(), | |
); | |
} | |
} | |
class MyCardWorkout extends StatelessWidget { | |
final List<Map<String, dynamic>> niveaux = [ | |
{"difficulty": "Simple", "nbExercices": 8}, | |
{"difficulty": "hebdos", "nbExercices": 10}, | |
{"difficulty": "My complete program", "nbExercices": 30} | |
]; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('My Workouts'), | |
), | |
body: Column( | |
children: [ | |
Expanded( | |
child: ListView.builder( | |
itemCount: niveaux.length, | |
itemBuilder: (context, index) { | |
final niveau = niveaux[index]; | |
return SizedBox( | |
height: MediaQuery.of(context).size.height * .16, | |
child: Card( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(12), | |
), | |
elevation: 3, | |
color: Color(0xFFdde2f1), | |
child: Padding( | |
padding: const EdgeInsets.all(4.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Flexible( | |
// Wrap Column in Flexible for potential complex content | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text( | |
niveau['difficulty'], | |
style: TextStyle(fontWeight: FontWeight.bold), | |
), | |
Text( | |
'${niveau['nbExercices']} services', | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
color: Color(0XFFa5a1a1), | |
), | |
), | |
// Add more content here... (if applicable) | |
], | |
), | |
), | |
Spacer(), | |
Icon(Icons.more_horiz_rounded), | |
], | |
), | |
), | |
), | |
); | |
}, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment