novel_summary_view.dart 929 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:flutter/material.dart';
  2. class NovelSummaryView extends StatelessWidget {
  3. final String summary;
  4. final bool isUnfold;
  5. final VoidCallback onPressed;
  6. NovelSummaryView(this.summary, this.isUnfold, this.onPressed);
  7. @override
  8. Widget build(BuildContext context) {
  9. return GestureDetector(
  10. onTap: onPressed,
  11. child: Container(
  12. color: Colors.white,
  13. padding: EdgeInsets.fromLTRB(15, 15, 15, 15),
  14. child: Stack(
  15. alignment: AlignmentDirectional.bottomEnd,
  16. children: <Widget>[
  17. Text(
  18. summary,
  19. maxLines: isUnfold ? null : 3,
  20. style: TextStyle(fontSize: 14),
  21. ),
  22. Image.asset('assets/img/detail_fold_bg.png'),
  23. Image.asset(isUnfold
  24. ? 'assets/img/detail_up.png'
  25. : 'assets/img/detail_down.png'),
  26. ],
  27. ),
  28. ),
  29. );
  30. }
  31. }