So i have TabBar and i make resuable Tab or custom widget TabBarPage
inside the TabBarView
.
my question is does my approach like this code below do affect bad perfomance or is it the same if i not make any custom widget inside custom widget ?
TabBarView(
children: [
TabBarPage(
child: NowPlaying(),
),
TabBarPage(
child: Upcoming(),
),
TabBarPage(
child: Popular(),
),
],
),
inside TabBarPage i have final Widget child;
that is filled with NowPlaying, Upcoming, or Popular and this three child have the same code but different provider
Container(
padding: EdgeInsets.fromLTRB(18.w, 0, 18.w, 0),
child: SingleChildScrollView(
child: this.widget.child,
),
),
and in NowPlaying, Upcoming, or Popular i have my 2 another custom widget (TabLoading, TabContent)
class NowPlaying extends StatelessWidget {
const NowPlaying({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Consumer<NowPlayingProvider>(
builder: (context, data, child) {
if (data.isLoading == true) return TabLoading();
return TabContent(data: data.nowPlaying);
},
);
}
}
CodePudding user response:
Obviously No, By creating multiple custom stateless widgets inside another custom widget there is no effect on performance, go through this