Home > front end >  How to use showcase plugin for first string in flutter?
How to use showcase plugin for first string in flutter?

Time:08-05

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.

CodePudding user response:

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()),
      ),
    );
  }
  • Related