1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import 'package:flutter/material.dart';
- import 'package:shuqi/public.dart';
- class NovelCell extends StatelessWidget {
- final Novel novel;
- NovelCell(this.novel);
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- AppNavigator.pushNovelDetail(context, novel);
- },
- child: Container(
- padding: EdgeInsets.all(15),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- NovelCoverImage(novel.imgUrl, width: 70, height: 93),
- SizedBox(width: 15),
- Expanded(
- child: buildRight(),
- ),
- ],
- ),
- ),
- );
- }
- Widget buildRight() {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- novel.name,
- style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),
- ),
- SizedBox(height: 5),
- Text(
- novel.introduction,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 14,
- color: SQColor.gray,
- ),
- ),
- SizedBox(height: 5),
- Row(
- children: <Widget>[
- Text(
- novel.author,
- style: TextStyle(fontSize: 14, color: SQColor.gray),
- ),
- Expanded(child: Container()),
- buildTag(novel.status, novel.statusColor()),
- SizedBox(width: 5),
- buildTag(novel.type, SQColor.gray),
- ],
- )
- ],
- );
- }
- Widget buildTag(String title, Color color) {
- return Container(
- padding: EdgeInsets.fromLTRB(5, 2, 5, 3),
- decoration: BoxDecoration(
- border: Border.all(color: Color.fromARGB(99, color.red, color.green, color.blue), width: 0.5),
- borderRadius: BorderRadius.circular(3),
- ),
- child: Text(
- title,
- style: TextStyle(fontSize: 11, color: color),
- ),
- );
- }
- }
|