0

I want to use a showcase widget on a text displayed after a result is run. This is the implementation enter image description here

I want to implement this feature for the first string of the map. when I execute it like this. The text seems to disappear. How to fix this. for example, if the map has three strings I want the showcase widget to appear on the first string only.

  • Please don't post screenshot/photo of the code instead copy and paste the entire code [reason](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question). – gretal Aug 04 '22 at 06:53

1 Answers1

0

If you want to keep your current logic, with a map on your list of Objects in order to return a list of Widgets, your only solution is to create a variable which you'll use as an index.

 @override
  Widget build(BuildContext context) {
    var index = 0;

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(children: e.phonetics.map((e){
          index++;
          if (index == 1) {
            return //Your Widget with the ShowCase
          } else {
            return //Your Widget without the ShowCase
          }
        }).toList()),
      ),
    );
  }
FDuhen
  • 4,097
  • 1
  • 15
  • 26