Fix episode list scroll on anime detail

This commit is contained in:
Moe Poi ~ 2020-09-07 23:03:58 +07:00
parent 430345f9b7
commit edcb747a1b

View file

@ -30,9 +30,7 @@ class AnimeDetail extends StatelessWidget {
return Text(error.toString());
},
renderSuccess: ({data}) {
return Center(
child: ListView(
children: [
var allWidgets = [
Row(
children: [
Flexible(
@ -43,17 +41,17 @@ class AnimeDetail extends StatelessWidget {
borderRadius: BorderRadius.circular(8.0),
child: CachedNetworkImage(
imageUrl: data['image'],
placeholder: (context, url) => CupertinoActivityIndicator(),
errorWidget: (context, url, error) => Image.asset('lib/assets/image-error.jpg'),
placeholder: (context, url) =>
CupertinoActivityIndicator(),
errorWidget: (context, url, error) =>
Image.asset('lib/assets/image-error.jpg'),
fadeOutDuration: Duration(milliseconds: 5),
imageBuilder: (context, imageProvider) => Container(
width: 120,
height: 160,
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover
),
image: imageProvider, fit: BoxFit.cover),
),
),
),
@ -78,31 +76,31 @@ class AnimeDetail extends StatelessWidget {
child: Text(data['description']),
),
),
];
final totalEps = data['episode_title'].length;
for (var x=0; x < totalEps; x++) {
allWidgets.add(
Container(
height: 542,
padding: EdgeInsets.all(8),
child: ListView.builder(
itemCount: data['episode_title'].length,
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.all(8),
child: CupertinoButton.filled(
child: Text(data['episode_title'][index]),
child: Text(data['episode_title'][x]),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => EpisodeDetail(),
settings: RouteSettings(arguments: {
'title': data['episode_title'][index],
'url': data['episode_url'][index]
'title': data['episode_title'][x],
'url': data['episode_url'][x]
})));
},
),
)
)
);
}),
),
],
}
return Center(
child: ListView(
children: allWidgets
));
}),
),