Skip to content

Commit

Permalink
fix: tabview state (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo authored May 30, 2023
1 parent aaf2c9e commit f1c8c4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- feat: add `NesIcons.zoomOut`
- feat: add `NesIcons.yamlFile`
- feat: add `NesIcons.xmlFile`
- fix: `NesTabView` didn't keept state on tab change.

# 0.6.0

Expand Down
24 changes: 10 additions & 14 deletions lib/src/widgets/nes_tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,18 @@ class _NesTabViewState extends State<NesTabView> {
),
),
Expanded(
child: Stack(
child: IndexedStack(
index: _selectedIndex,
children: [
for (var i = 0; i < widget.tabs.length; i++)
Positioned.fill(
child: Visibility(
visible: _selectedIndex == i,
child: CustomPaint(
painter: _NesTabViewPainter(
color: textStyle.color ?? Colors.black,
pixelSize: nesTheme.pixelSize.toDouble(),
),
child: Padding(
padding: EdgeInsets.all(nesTheme.pixelSize.toDouble()),
child: widget.tabs[i].child,
),
),
CustomPaint(
painter: _NesTabViewPainter(
color: textStyle.color ?? Colors.black,
pixelSize: nesTheme.pixelSize.toDouble(),
),
child: Padding(
padding: EdgeInsets.all(nesTheme.pixelSize.toDouble()),
child: widget.tabs[i].child,
),
),
],
Expand Down

0 comments on commit f1c8c4e

Please sign in to comment.