hot_part.dart 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_note/routers/application.dart';
  3. import 'package:flutter_note/model/hot_goods_model.dart';
  4. import 'package:flutter_note/routers/routers.dart';
  5. /// 火爆专区标题
  6. class HotGoodsTitle extends StatelessWidget {
  7. @override
  8. Widget build(BuildContext context) {
  9. return SliverToBoxAdapter(
  10. child: Container(
  11. alignment: Alignment.center,
  12. child: Text('火爆专区', style: TextStyle(color: Colors.black)),
  13. padding: const EdgeInsets.symmetric(vertical: 8.0),
  14. ),
  15. );
  16. }
  17. }
  18. /// 火爆专区
  19. class HotItem extends StatelessWidget {
  20. final HotGoodsData hot;
  21. HotItem({Key key, this.hot}) : super(key: key);
  22. @override
  23. Widget build(BuildContext context) {
  24. return InkWell(
  25. onTap: () {
  26. Application.router.navigateTo(
  27. context, Routers.generateDetailsRouterPath(hot.goodsId));
  28. },
  29. child: Container(
  30. color: Colors.white,
  31. alignment: Alignment.center,
  32. margin: const EdgeInsets.only(left: 4.0, right: 4.0, bottom: 8.0),
  33. padding: const EdgeInsets.all(4.0),
  34. child: Column(
  35. mainAxisAlignment: MainAxisAlignment.center,
  36. children: <Widget>[
  37. Image.network(hot.image),
  38. Text(hot.name, textAlign: TextAlign.center, maxLines: 1),
  39. Row(
  40. mainAxisAlignment: MainAxisAlignment.spaceAround,
  41. children: <Widget>[
  42. Text('¥${hot.mallPrice}'),
  43. Text('¥${hot.price}',
  44. style: TextStyle(
  45. color: Colors.black45,
  46. decoration: TextDecoration.lineThrough))
  47. ],
  48. )
  49. ],
  50. ),
  51. ),
  52. );
  53. }
  54. }