-
-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the waterfall slides, it will be stuck. #13
Comments
Hi @donghuawei321. If you want me to debug the code, I will need to have access to all the code since I don't know what is |
Closing since no response from the OP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, the situation I encountered is such that the waterfall will slip and shake when it slides to some position. I hope to get your help, The code is as follows:
StaggeredGridView:
return Scaffold(
appBar: _getAppBar(),
body: RefreshLayout(
canloading: isMore,
child: StaggeredGridView.countBuilder(
primary: false,
physics: _isScroll ? ScrollPhysics() : NeverScrollableScrollPhysics(),
padding: EdgeInsets.all(3.0),
itemCount: _list.length,
crossAxisCount: 2,
itemBuilder: (context, index) => SquareItem(index, _list),
staggeredTileBuilder: (index) => StaggeredTile.fit(1),
),
item:
class SquareItem extends StatefulWidget {
SquareItem(this._index, this._list);
final List _list;
final int _index;
@OverRide
_SquareItemState createState() => _SquareItemState(_index, _list);
}
class _SquareItemState extends State {
_SquareItemState(this._index, this._list);
final List _list;
final int _index;
Widget _getImgNumGroup() {
return Align(
alignment: Alignment.topRight,
child: Container(
alignment: Alignment.center,
height: 20.0,
width: 51.0,
margin: EdgeInsets.only(right: 8.0, top: 4.0),
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.all(Radius.circular(10.0),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Image.asset(Images.image_num),
Text(
'${_list[_index]['imageNum']}张',
style: TextStyle(
color: Colors.white,
fontSize: 11.0,
),
),
],
),
),
);
}
Widget _getAvatarGroup() {
String avatarUrl = _list[_index]['avatorUrl'];
return Container(
alignment: Alignment.bottomLeft,
margin: EdgeInsets.only(left: 5.0),
child: Row(
children: [
Container(
width: 30.0,
height: 30.0,
child: CircleAvatar(
backgroundImage: avatarUrl != '' && avatarUrl != null ?
CachedNetworkImageProvider(avatarUrl) : AssetImage(Images.head_img),
),
),
],
),
);
}
Widget _getImgBottom() {
bool isShowLive = _list[_index]['livingChannelId'] == 0;
return Container(
margin: EdgeInsets.only(left: 40.0),
alignment: Alignment.bottomCenter,
child: Row(
children: [
Expanded(
child: Text(
_list[_index]['nickName'],
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 13.0),
),
),
}
Widget _getImgGroup() {
return IntrinsicHeight(
child: Stack(
children: [
Container(
margin: EdgeInsets.only(bottom: 20.0),
child: CachedNetworkImage(
imageUrl: _list[_index]['showImgUrl'],
placeholder: Image.asset(Images.item_placeholder),
errorWidget: Container(
alignment: Alignment.center,
height: 200.0,
child: Icon(Icons.error),
),
),
),
_getImgNumGroup(),
_getAvatarGroup(),
_getImgBottom(),
],
),
);
}
Widget _getContentGroup() {
return Padding(
padding: EdgeInsets.only(left: 5.0, top: 5.0),
child: Text(
widget._list[widget._index]['content'],
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0,
color: Color(0xff999999),
),
),
);
}
Widget _getBottomGroup() {
return Container(
margin: EdgeInsets.only(left: 5.0, bottom: 3.0),
child: Row(
children: [
Image.asset(Images.follow_num),
Padding(padding: EdgeInsets.only(left: 5.0, right: 10.0), child: Text(_list[_index]['followNum'].toString()),),
Image.asset(Images.playing_num),
Padding(padding: EdgeInsets.only(left: 5.0), child: Text('${_list[_index]['playingNum']}'),),
],
),
);
}
@OverRide
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => SquareDetail(_list[_index]['id'])));
},
child: Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_getImgGroup(),
_getContentGroup(),
_getBottomGroup(),
],
),
),
);
}
}
The text was updated successfully, but these errors were encountered: