Advertisement
Hitesh_jadhav

Flutter-horizontal_listview

Feb 20th, 2022
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2. import 'package:flutter/material.dart';
  3.  
  4. class horizonatallist extends StatelessWidget {
  5. const horizonatallist({Key? key}) : super(key: key);
  6.  
  7. @override
  8. Widget build(BuildContext context) {
  9. return Container(
  10. // height: 80,
  11. // width: 80,
  12. child: ListView(
  13. scrollDirection: Axis.horizontal,
  14. children: <Widget>[
  15. Category(
  16. image_caption: 'accessories',
  17. image_location: 'images/cats/accessories.png')
  18. ],
  19. ),
  20. );
  21. }
  22. }
  23.  
  24. class Category extends StatelessWidget {
  25. final String image_location;
  26. final String image_caption;
  27.  
  28. const Category({required this.image_caption, required this.image_location});
  29.  
  30. @override
  31. Widget build(BuildContext context) {
  32. return Padding(
  33. padding: const EdgeInsets.all(2),
  34. child: InkWell(
  35. onTap: () {},
  36. child: ListTile(
  37. title: Image.asset(image_location),
  38. subtitle: Text(image_caption),
  39. ),
  40. ),
  41. );
  42. }
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement