fix: Corrected shimmer
This commit is contained in:
@@ -312,12 +312,14 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
children: List.generate(
|
children: List.generate(
|
||||||
25,
|
25,
|
||||||
(i) {
|
(i) {
|
||||||
|
if (widget.crossAxisCount == 1) {
|
||||||
if (i % 2 != 0) {
|
if (i % 2 != 0) {
|
||||||
if (widget.separatorBuilder != null) {
|
if (widget.separatorBuilder != null) {
|
||||||
return widget.separatorBuilder(context, i);
|
return widget.separatorBuilder(context, i);
|
||||||
}
|
}
|
||||||
return _separatorBuilder(context, i);
|
return _separatorBuilder(context, i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return _buildLoadingItem();
|
return _buildLoadingItem();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -325,6 +327,38 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Shimmer _buildLoadingItem() {
|
Shimmer _buildLoadingItem() {
|
||||||
|
if (widget.crossAxisCount > 1) {
|
||||||
|
return Shimmer.fromColors(
|
||||||
|
baseColor: Color(0xffE5E5E5),
|
||||||
|
highlightColor: Color(0xffffffff),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 4.0,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
for (int i = 0; i < widget.crossAxisCount; i++)
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
constraints: BoxConstraints.tightFor(
|
||||||
|
height: 70,
|
||||||
|
width: 70,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 16.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
return Shimmer.fromColors(
|
return Shimmer.fromColors(
|
||||||
baseColor: Color(0xffE5E5E5),
|
baseColor: Color(0xffE5E5E5),
|
||||||
highlightColor: Color(0xffffffff),
|
highlightColor: Color(0xffffffff),
|
||||||
@@ -383,6 +417,7 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildErrorWidget(
|
Widget _buildErrorWidget(
|
||||||
AsyncSnapshot<List<Channel>> snapshot,
|
AsyncSnapshot<List<Channel>> snapshot,
|
||||||
|
|||||||
Reference in New Issue
Block a user