Так что, как вы можете в прикрепленном видео, есть проблема с прокруткой. Это должно быть похоже на бесконечное представление прокрутки (как в новостной ленте приложения в Facebook)
Проблема в том, что внутри родительского ListView, похоже, есть "вложенная" прокрутка. Как я могу это исправить? Пожалуйста, помогите
ВИДЕО ЗДЕСЬ (я не знаю, как прикрепить видео здесь, поэтому я положил его на YouTube)
код моей домашней страницы, где больше предложений секция должна просто непрерывно генерировать данные из бэкэнда Firebase, как в новостной ленте Facebook:
@override
Widget build(BuildContext context) {
width = MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
backgroundColor: Color(0xFF0d192a),
appBar: CustomAppBar(height: 60),
// appBar: CustomAppBar(height: 70),
drawer: DrawerNiVlad(),
body: ListView(
//vlad
children: <Widget>[
// some widgets here
ArlTitleText('More Offers'),
MoreOffers(), <= The widget that has a "nested scroll"
sb5,
код виджета MoreOffers
Widget build(BuildContext context) {
return StreamBuilder(
initialData: List<DiscountEntity>(),
stream: _moreOffersBloc.listDiscounts3Flux,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (!snapshot.hasData) return Container(height: 1, width: 1);
return ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 5.0),
scrollDirection: Axis.vertical,
itemCount: snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
DiscountEntity discount =
snapshot.data[index] as DiscountEntity;
return Container(
decoration: BoxDecoration(
// border: Border(bottom: BorderSide()),
),
child: Card(
color: Color(0xFF0d192a),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5.0, vertical: 5.0),
child: Stack(
children: <Widget>[
InkWell(
onTap: () {
print('123123');
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DetailsDiscountPage(
discount: discount,
),
),
);
}, // button pressed
child: Container(
width: 100.0,
height: 100.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(5.0)),
color: Colors.black,
),
child: Image.network(
// 'asdkmnajhkalskca',
discount.imageUrl.Url,
fit: BoxFit.cover,
loadingBuilder: (BuildContext context,
Widget child,
ImageChunkEvent loadingProgress) {
if (loadingProgress == null) return child;
return Center(
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor:
AlwaysStoppedAnimation<Color>(
goldColor),
value: loadingProgress
.expectedTotalBytes !=
null
? loadingProgress
.cumulativeBytesLoaded /
loadingProgress
.expectedTotalBytes
: null,
),
);
},
),
),
),
Positioned(
left: 110,
top: 1,
child: InkWell(
onTap: () {
print('asdasdasdas');
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DetailsDiscountPage(
discount: discount,
),
),
);
}, // button pressed
child: Container(
child: Text(
discount.name,
style: TextStyle(
color: goldColor,
fontSize: 15,
letterSpacing: 1,
fontFamily: 'Lato',
fontWeight: FontWeight.bold),
),
),
),
),
Positioned(
left: 110,
top: 17,
child: Container(
child: Text(
// discount.type,
'category',
style: TextStyle(
color: Color(0xff7a7a7a),
fontSize: 15,
letterSpacing: 1,
fontFamily: 'Lato',
fontWeight: FontWeight.normal),
),
),
),
Positioned(
left: 110,
top: 35,
child: Container(
child: Row(
children: <Widget>[
Icon(
Icons.calendar_today,
color: Color(0xff7a7a7a),
size: 15,
),
Text(
'Jan 1, 2020 - Dec 1, 2020',
style: TextStyle(
color: Color(0xff7a7a7a),
fontSize: 15,
letterSpacing: 1,
fontFamily: 'Lato',
fontWeight: FontWeight.normal),
),
],
)),
),
],
),
)),
);
},
);
});