I made a listview on flutter but it goes up and down when I scroll it
things I already tried:
- Changing the expanded to a container with a limited height
- add the shrinkwrap parameter
https://drive.google.com/file/d/1OwFkEd-zqk5z5wF1eBUsjlpSWmbql3vZ/view?usp=sharing
// ignore_for_file: library_private_types_in_public_api
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
final List<String> exercises;
const HomePage({Key? key, required this.exercises}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
const Text(
'Fisioterapia rj',
style: TextStyle(
fontSize: 42
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(top: 20, bottom: 20, right: 30, left: 30),
child: ListView.builder(
shrinkWrap: false,
itemBuilder: (BuildContext context, int index) {
return Container(
color: Colors.black,
child: ListTile(
title: Text(
widget.exercises[index],
style: const TextStyle(
color: Colors.white,
),
),
),
);
},
itemCount: widget.exercises.length,
),
),
),
],
),
),
);
}
}