pparth602

Untitled

Oct 15th, 2020 (edited)
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.76 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_svg/flutter_svg.dart';
  3.  
  4. class BookInfoTile extends StatelessWidget {
  5.   final String bookCoverImageURL;
  6.   final String bookTitle;
  7.   final String authorName;
  8.   final int bookLength;
  9.   final onClick;
  10.  
  11.   const BookInfoTile(
  12.       {Key key,
  13.       @required this.bookCoverImageURL,
  14.       @required this.bookTitle,
  15.       @required this.authorName,
  16.       @required this.bookLength,
  17.       @required this.onClick})
  18.       : super(key: key);
  19.   @override
  20.   Widget build(BuildContext context) {
  21.     Size size = MediaQuery.of(context).size;
  22.     return GestureDetector(
  23.       onTap: onClick,
  24.       child: Expanded(
  25.         child: Row(
  26.           mainAxisAlignment: MainAxisAlignment.start,
  27.           crossAxisAlignment: CrossAxisAlignment.center,
  28.           children: [
  29.             ClipRRect(
  30.               borderRadius: BorderRadius.circular(25.0),
  31.               child: Image.asset(
  32.                 bookCoverImageURL,
  33.                 fit: BoxFit.fill,
  34.                 alignment: Alignment.centerLeft,
  35.                 height: size.height * 0.22,
  36.                 width: size.width * 0.40,
  37.               ),
  38.             ),
  39.             SizedBox(width: 16),
  40.             Column(
  41.               crossAxisAlignment: CrossAxisAlignment.start,
  42.               children: [
  43.                 Text(
  44.                   bookTitle,
  45.                   overflow: TextOverflow.fade,
  46.                   style: TextStyle(
  47.                     fontWeight: FontWeight.bold,
  48.                     color: Colors.black,
  49.                   ),
  50.                 ),
  51.                 const SizedBox(
  52.                   height: 10,
  53.                 ),
  54.                 Text(
  55.                   'by $authorName',
  56.                   style: TextStyle(
  57.                     fontSize: 15,
  58.                     fontWeight: FontWeight.normal,
  59.                     color: Color(0xFF767676),
  60.                   ),
  61.                 ),
  62.                 const SizedBox(
  63.                   height: 8,
  64.                 ),
  65.                 RichText(
  66.                   text: TextSpan(
  67.                     children: [
  68.                       WidgetSpan(
  69.                         alignment: PlaceholderAlignment.middle,
  70.                         child: SvgPicture.asset(
  71.                           'assets/svg/circle-fill.svg',
  72.                           color: Color(0xFFffe564),
  73.                           height: 10,
  74.                           alignment: Alignment.topCenter,
  75.                         ),
  76.                       ),
  77.                       TextSpan(
  78.                         text: " $bookLength",
  79.                       ),
  80.                     ],
  81.                   ),
  82.                 ),
  83.               ],
  84.             ),
  85.           ],
  86.         ),
  87.       ),
  88.     );
  89.   }
  90. }
  91.  
Add Comment
Please, Sign In to add comment