mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-04-27 10:47:42 -05:00
[core] Fix Index Reset for Tabs in Small Deck Layout (#93)
The index was not reset in the `DeckLayoutSmall` widget, when the user selected a new deck in the settings widget. This was caused because the `DefaultTabController` was not rebuild after a new deck was selected, so that the `initialIndex` value was not used. This is now fixed by adding a `key` to the `DefaultTabController`, which corresponds to the selected deck. This means if the user selects a new deck in the settings the widget will be rebuild and the initial selected tab will be the first one. If a user selects the same deck or switches between the small and large layout the tab will be the formerly selected one.
This commit is contained in:
@@ -149,6 +149,7 @@ class DeckLayoutSmall extends StatelessWidget {
|
||||
AppRepository app = Provider.of<AppRepository>(context, listen: true);
|
||||
|
||||
return DefaultTabController(
|
||||
key: ValueKey(app.activeDeckId),
|
||||
initialIndex: _getInitialIndex(context, app.columns.length),
|
||||
length: app.columns.length,
|
||||
child: Scaffold(
|
||||
|
||||
Reference in New Issue
Block a user