home_novel_cover_view.dart 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import 'package:flutter/material.dart';
  2. import 'package:shuqi/public.dart';
  3. class HomeNovelCoverView extends StatelessWidget {
  4. final Novel novel;
  5. HomeNovelCoverView(this.novel);
  6. @override
  7. Widget build(BuildContext context) {
  8. var width = (Screen.width - 15 * 2 - 15 * 3) / 4;
  9. return GestureDetector(
  10. onTap: () {
  11. AppNavigator.pushNovelDetail(context, novel);
  12. },
  13. child: Container(
  14. width: width,
  15. child: Column(
  16. crossAxisAlignment: CrossAxisAlignment.start,
  17. children: <Widget>[
  18. NovelCoverImage(novel.imgUrl, width: width, height: width / 0.75),
  19. SizedBox(height: 5),
  20. Text(
  21. novel.name,
  22. overflow: TextOverflow.ellipsis,
  23. style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
  24. maxLines: 1,
  25. ),
  26. SizedBox(height: 3),
  27. Text(
  28. novel.author,
  29. style: TextStyle(fontSize: 12, color: SQColor.gray),
  30. maxLines: 1,
  31. ),
  32. ],
  33. ),
  34. ),
  35. );
  36. }
  37. }