Group Group Group Group Group Group Group Group Group

Flutter Apprentice - Chapter 2 - Section `Add GestureDetector`

Easy time i add this to where i think it should be the code afterwards gets greyed out.

Can someone please assist me with this placement error?

Thank you.

1 Like
class _MyHomePageState extends State<MyHomePage> {
  Widget build(BuildContext context) {
    // 1: A Scaffold provides the high-level structure for a screen.
    // In this case, you’re using two properties.
    return Scaffold(
      // 2: AppBar gets a title property by using a Text widget that has a title passed in from
      // home: MyHomePage(title: 'Recipe Calculator') in the previous step.
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the method, and use it to set our appbar title.
        title: Text(widget.title),
      // 3: body has SafeArea, which keeps the app from getting too close
      // to the operating system interfaces such as the notch or
      // interactive areas like the Home Indicator at the bottom of
      // some iOS screens.
      body: SafeArea(
        // 4: SafeArea has a child widget, Builds a list using ListView.
        child: ListView.builder(
          // 5: itemCount determines the number of rows the list has.
          // In this case, length is the number of objects in the Recipe.samples list.
          itemCount: Recipe.samples.length,
          // 6: itemBuilder builds the widget tree for each row.
          itemBuilder: (BuildContext context, int index) {
            // 7 A Text widget displays the name of the recipe.
            // TODO: Update to return Recipe card
            return Text(Recipe.samples[index].label);
```  this is where i am so far...

The GestureDetector goes inside the itemBuilder as its return value


Thank you… I managed to figure it out with much google searching, stackoverflow research etc.

I appreciate your reply :ok_hand:

@aifx4intel :ok_hand:
Remember that you can always use the final project as a reference when you stumble upon unclear issues.

1 Like

I thought of that - yet that way will not help me learn (troubleshooting is the best way as far as i understand things) :pray: :v: