mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-10 11:30:41 +00:00
74 lines
2.7 KiB
Dart
74 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:mangayomi/models/model_manga.dart';
|
|
import 'package:mangayomi/utils/cached_network.dart';
|
|
import 'package:mangayomi/utils/colors.dart';
|
|
import 'package:mangayomi/views/widgets/bottom_text_widget.dart';
|
|
import 'package:mangayomi/views/widgets/cover_view_widget.dart';
|
|
import 'package:mangayomi/views/widgets/gridview_widget.dart';
|
|
|
|
class LibraryGridViewWidget extends StatelessWidget {
|
|
final bool isCoverOnlyGrid;
|
|
final bool isComfortableGrid;
|
|
final List<ModelManga> entriesManga;
|
|
const LibraryGridViewWidget(
|
|
{super.key,
|
|
required this.entriesManga,
|
|
required this.isCoverOnlyGrid,
|
|
this.isComfortableGrid = false});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GridViewWidget(
|
|
mainAxisExtent: isComfortableGrid ? 310 : 280,
|
|
itemCount: entriesManga.length,
|
|
itemBuilder: (context, index) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
context.push('/manga-reader/detail', extra: entriesManga[index]);
|
|
},
|
|
child: CoverViewWidget(
|
|
bottomTextWidget: BottomTextWidget(
|
|
text: entriesManga[index].name!,
|
|
isComfortableGrid: isComfortableGrid,
|
|
),
|
|
isComfortableGrid: isComfortableGrid,
|
|
children: [
|
|
Stack(
|
|
children: [
|
|
cachedNetworkImage(
|
|
imageUrl: entriesManga[index].imageUrl!,
|
|
width: 200,
|
|
height: 270,
|
|
fit: BoxFit.cover),
|
|
Positioned(
|
|
top: 0,
|
|
left: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(5),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(3),
|
|
color: generalColor(context),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(1),
|
|
child: Text(
|
|
entriesManga[index].chapters!.length.toString(),
|
|
style: const TextStyle(color: Colors.white),
|
|
),
|
|
),
|
|
),
|
|
))
|
|
],
|
|
),
|
|
if (!isComfortableGrid)
|
|
if (!isCoverOnlyGrid)
|
|
BottomTextWidget(text: entriesManga[index].name!)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|