Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:flutter_svg/flutter_svg.dart';
- class BookInfoTile extends StatelessWidget {
- final String bookCoverImageURL;
- final String bookTitle;
- final String authorName;
- final int bookLength;
- final onClick;
- const BookInfoTile(
- {Key key,
- @required this.bookCoverImageURL,
- @required this.bookTitle,
- @required this.authorName,
- @required this.bookLength,
- @required this.onClick})
- : super(key: key);
- @override
- Widget build(BuildContext context) {
- Size size = MediaQuery.of(context).size;
- return GestureDetector(
- onTap: onClick,
- child: Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(25.0),
- child: Image.asset(
- bookCoverImageURL,
- fit: BoxFit.fill,
- alignment: Alignment.centerLeft,
- height: size.height * 0.22,
- width: size.width * 0.40,
- ),
- ),
- SizedBox(width: 16),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- bookTitle,
- overflow: TextOverflow.fade,
- style: TextStyle(
- fontWeight: FontWeight.bold,
- color: Colors.black,
- ),
- ),
- const SizedBox(
- height: 10,
- ),
- Text(
- 'by $authorName',
- style: TextStyle(
- fontSize: 15,
- fontWeight: FontWeight.normal,
- color: Color(0xFF767676),
- ),
- ),
- const SizedBox(
- height: 8,
- ),
- RichText(
- text: TextSpan(
- children: [
- WidgetSpan(
- alignment: PlaceholderAlignment.middle,
- child: SvgPicture.asset(
- 'assets/svg/circle-fill.svg',
- color: Color(0xFFffe564),
- height: 10,
- alignment: Alignment.topCenter,
- ),
- ),
- TextSpan(
- text: " $bookLength",
- ),
- ],
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- );
- }
- }
Add Comment
Please, Sign In to add comment