skip to Main Content

I want to make the centre widget border colour Basic widget should be have active colour when i slide it Silver widget will be centre so Silver widget should be active then to purple.

enter image description here

while slider the centre widget border colour must be active constantly.what should I do?

I’m not getting the logic how to make it as active colour

2

Answers


  1. at start you must create a contoller for you page view
    after that you check current pageIndex from your controller with the index in pageBuilder
    if they are same then your condition ……

    Login or Signup to reply.
  2. From what I have understood you want to change border color of the widget containing the plan Image With Marked Area to purple if clicked on the specific plan.

    If so,

    1. Store index

    store the current index selected in the widget state and change the color accordingly.

    eg in decoration the color property will have condition:

    color: currIndex==planIndex?Colors.purple:Colors.black,
    

    where currIndex is the index currently selected and planIndex is index of the plan in list (basic:0,silver:1,etc)

    1. Add onPageChanged callback.
      like so:
    onPageChanged:(i)=> setState(()=>currIndex=i),
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search