Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Joanna May <[email protected]>
  • Loading branch information
marwfair and jolexxa authored Jul 29, 2024
1 parent bd25050 commit 7e75d0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/content/docs/widgets/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void main() {
}
```

## Widgets vs helper methods
## Widgets vs Helper Methods

When you're creating a widget, sometimes you want to split the widget up into smaller pieces to make the widget reusable or improve readability.

Expand Down Expand Up @@ -149,7 +149,9 @@ class MyWidget extends StatelessWidget {
</TabItem>
</Tabs>

### Creating a new widget provides several benefits over using a helper method
### Why Create a New Widget?

Creating a new widget provides several benefits over using a helper method:

- Testability: You can write widget tests for the `MyText` widget without worrying about `MyWidget` or any of the dependencies that it might require.
- Maintainability: Smaller widgets are easier to maintain and aren't coupled to their parent widget. These widgets will also have their own BuildContext, so you don't have to worry about using the wrong or an invalid context.
Expand Down

0 comments on commit 7e75d0e

Please sign in to comment.