0
I need to add a tabbarview inside the Slivertoboxadapter, but nothing I try works. I want to generate a chart for each tab, but I can’t even insert any message. Below is my code:
class StatsScreen extends StatefulWidget {
@override
_StatsScreenState createState() => _StatsScreenState();
}
class _StatsScreenState extends State<StatsScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Palette.primaryColor,
appBar: CustomAppBar(),
// design barra superior
body: CustomScrollView(
physics: ClampingScrollPhysics(),
slivers: <Widget>[
_buildHeader(),
_buildRegionTabBar(),
],
),
);
}
SliverPadding _buildHeader() {
return SliverPadding(
padding: const EdgeInsets.all(20.0),
sliver: SliverToBoxAdapter(
child: Text(
'Estatisticas',
style: const TextStyle(
color: Colors.white,
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
)),
);
}
SliverToBoxAdapter _buildRegionTabBar() {
return SliverToBoxAdapter(
child: DefaultTabController(
length: 2,
child: TabBar(
tabs:[
Tab(text: 'Brasil'),
Tab(text: 'Mundo'),
],
),
),
);
}
}