Skip to content

Tutorial code mistakes #13073

@rscambler

Description

@rscambler

Page URL

https://docs.flutter.dev/learn/pathway/tutorial/listenable-builder

Page source

https://github.com/flutter/website/blob/main/src/content/learn/pathway/tutorial/listenable-builder.md

Describe the problem

I've noticed 2 mistakes while trying to follow this tutorial.

  1. The onPressed callback on the ArticlePage button should be 'onPressed'
  2. Remove the Flexible widget from within the SingleChildScrollView

Note: I am using a web server to test.

Expected fix

class ArticlePage extends StatelessWidget {
  const ArticlePage({
    super.key,
    required this.summary,
    required this.onPressed,
  });

  final Summary summary;
  final VoidCallback onPressed;

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: [
          ArticleWidget(
            summary: summary,
          ),
          ElevatedButton(
            onPressed: onPressed,
            child: Text('Next random article'),
          ),
        ],
      ),
    );
  }
}

Additional context

No response

I would like to fix this problem.

  • I will try and fix this problem on docs.flutter.dev.

Metadata

Metadata

Assignees

Labels

a.tut.tutorialRelates to the Tutorial section of docs.flutter.deve0-minutesEffort: < 60 minfrom.page-issueReported in a reader-filed concernp2-mediumNecessary but not urgent concern. Resolve when possible.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions