tutorial_coach_mark icon indicating copy to clipboard operation
tutorial_coach_mark copied to clipboard

Can't use Animated List Item as target with Key

Open Wizzel1 opened this issue 4 years ago • 0 comments

I am trying to target the first item of an AnimatedList like this:

final GlobalKey targetKey = GlobalKey();

       return  Container(
                       key :  index == 0 ? targetKey : null,
                       onTapped: ()  {},
                        );

and add it as target :

TargetFocus(
        identify: "Target 1",
        shape: ShapeLightFocus.RRect,
        radius: 15,
        keyTarget: targetKey ,
        contents: [
          TargetContent(
              align: ContentAlign.bottom,
              child: Container(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      "Titulo lorem ipsum",
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          color: Colors.white,
                          fontSize: 20.0),
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 10.0),
                      child: Text(
                        "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin pulvinar tortor eget maximus iaculis.",
                        style: TextStyle(color: Colors.white),
                      ),
                    )
                  ],
                ),
              ))
        ],
      )

Wizzel1 avatar Mar 15 '21 20:03 Wizzel1