Wrap EnteLoadingWidget with RepaintBoundary to avoid unnecessary repaints

This commit is contained in:
ashilkn
2025-05-15 08:39:47 +05:30
parent f4531ef088
commit c56d9b312d
4 changed files with 18 additions and 24 deletions

View File

@@ -22,10 +22,12 @@ class EnteLoadingWidget extends StatelessWidget {
padding: EdgeInsets.all(padding),
child: SizedBox.fromSize(
size: Size.square(size),
child: CircularProgressIndicator(
strokeWidth: 2,
color: color ?? getEnteColorScheme(context).strokeBase,
strokeCap: StrokeCap.round,
child: RepaintBoundary(
child: CircularProgressIndicator(
strokeWidth: 2,
color: color ?? getEnteColorScheme(context).strokeBase,
strokeCap: StrokeCap.round,
),
),
),
),

View File

@@ -192,13 +192,11 @@ class _AddLocationSheetState extends State<AddLocationSheet> {
builder: (context, int? value, _) {
Widget widget;
if (value == null) {
widget = RepaintBoundary(
child: EnteLoadingWidget(
size: 14,
color: colorScheme.strokeMuted,
alignment: Alignment.centerLeft,
padding: 3,
),
widget = EnteLoadingWidget(
size: 14,
color: colorScheme.strokeMuted,
alignment: Alignment.centerLeft,
padding: 3,
);
} else {
widget = Column(

View File

@@ -184,13 +184,11 @@ class _EditLocationSheetState extends State<EditLocationSheet> {
builder: (context, int? value, _) {
Widget widget;
if (value == null) {
widget = RepaintBoundary(
child: EnteLoadingWidget(
size: 14,
color: colorScheme.strokeMuted,
alignment: Alignment.centerLeft,
padding: 3,
),
widget = EnteLoadingWidget(
size: 14,
color: colorScheme.strokeMuted,
alignment: Alignment.centerLeft,
padding: 3,
);
} else {
widget = Column(

View File

@@ -911,13 +911,9 @@ class _EmailSectionState extends State<_EmailSection> {
"Error getting isMeAssigned",
snapshot.error,
);
return const RepaintBoundary(
child: EnteLoadingWidget(),
);
return const EnteLoadingWidget();
} else {
return const RepaintBoundary(
child: EnteLoadingWidget(),
);
return const EnteLoadingWidget();
}
},
),