-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: state restorationRestorationManager and related APIsRestorationManager and related APIsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 2.2Found to occur in 2.2Found to occur in 2.2found in release: 2.6Found to occur in 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on
Description
Simple Code
import 'package:flutter/material.dart';
void main() {
runApp(A());
}
class A extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _AState();
}
}
class _AState extends State<A> {
double size = 100.0;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: 3,
child: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
if (size == 100) {
size = 0;
} else {
size = 100;
}
});
},
),
appBar: AppBar(
bottom: TabBar(
tabs: [
Tab(icon: Icon(Icons.directions_car)),
Tab(icon: Icon(Icons.directions_transit)),
Tab(icon: Icon(Icons.directions_bike)),
],
),
title: Text('Tabs Demo'),
),
body: SizedBox(
width: size,
height: size,
child: TabBarView(
children: [
Icon(Icons.directions_car),
Icon(Icons.directions_transit),
Icon(Icons.directions_bike),
],
),
),
),
),
);
}
}
Repro Step
1, switch tab to second or third tab
2, click the floatingActionButton to change the size to zero
3, click it again and TabBarView lose state (switch to the first page)
Metadata
Metadata
Assignees
Labels
a: state restorationRestorationManager and related APIsRestorationManager and related APIsf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 2.2Found to occur in 2.2Found to occur in 2.2found in release: 2.6Found to occur in 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work on