banner_diy.dart 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_note/routers/application.dart';
  3. import 'package:flutter_note/model/home_page_model.dart';
  4. import 'package:flutter_note/routers/routers.dart';
  5. import 'package:flutter_swiper/flutter_swiper.dart';
  6. class BannerDiy extends StatelessWidget {
  7. final List<Slides> bannerImages;
  8. BannerDiy({Key key, @required this.bannerImages}) : super(key: key);
  9. @override
  10. Widget build(BuildContext context) {
  11. return SliverToBoxAdapter(
  12. child: Container(
  13. height: 180.0,
  14. child: Swiper(
  15. itemCount: bannerImages.length,
  16. itemBuilder: (context, int index) => InkWell(
  17. child: Image.network('${bannerImages[index].image}',
  18. fit: BoxFit.fill),
  19. onTap: () => Application.router.navigateTo(
  20. context,
  21. Routers.generateDetailsRouterPath(
  22. bannerImages[index].goodsId)),
  23. ),
  24. pagination: SwiperPagination(),
  25. autoplay: true,
  26. ),
  27. ),
  28. );
  29. }
  30. }