0

So I am not looking for filters but I am looking for scroll widget. I have tried generating listview items abd getting position of listview to give items ratio but I wasn't able to get any functionality while in certain index position. Any help would be helpfull. Naming of the widget or special widgets that can make me do this etc. instagram photo filter screen buttons

Yusuf gndz
  • 137
  • 10

2 Answers2

0

You can use ListView or ListView.builder to do that, but with circle-shaped widgets as the children.

You can check out this tutorial to do the horizontal list. And you can check out this StackOverflow question, to create a circle button. Or instead of a button, you want to use the CircleAvatar (to add an image in it), you can check out this official doc.

hisam
  • 1,566
  • 1
  • 7
  • 21
  • I have no problems doing listview. but problem is onswipe actions that I don't know enough. thank you for help. – Yusuf gndz Jul 09 '20 at 17:12
0
int _index = 0;
List<String> filters = [
    ImageConstant.imgEllipse14,
    ImageConstant.imgEllipse13,
    ImageConstant.imgEllipse12,
    ImageConstant.imgEllipse16,
    ImageConstant.imgEllipse15,
    ImageConstant.imgEllipse14,
    ImageConstant.imgEllipse13,
    ImageConstant.imgEllipse12,
    ImageConstant.imgEllipse16,
    ImageConstant.imgEllipse15,
  ];

Widget Scroller =
PageView.builder(
  itemCount: filters.length, // filters is a string array of image paths
  controller: PageController(viewportFraction: 0.22),
  onPageChanged: (int index) => setState(() => _index = index),
  itemBuilder: (_, i) {
     return Padding(
       padding: EdgeInsets.only(
           left: 13,
           top: 18,
           right: 13,
           bottom: 20),
       child: Transform.scale(
           scale: i == _index ? 2 : 1,
           child: Container(
           child: CircleAvatar(
              child: CustomImageView(
              imagePath: filters[i],
              radius: BorderRadius.circular(getHorizontalSize(21)),
              margin: getMargin(top: 20, bottom: 20),
           ),
         ),
       ),
     ),
   );
 },
);

You could use this technique or you could also use ScrollSnapList package https://pub.dev/packages/scroll_snap_list .

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 03 '23 at 10:59