So, I have menu in my App with category and list of meals. But when I scroll on this page it gives me an error from title. AND IT GIVES THIS ERROR:
The PrimaryScrollController is currently attached to more than one С.
CupertinoScrollbar _buildBody() {
return CupertinoScrollbar(
child: ScrollablePositionedList.builder(
physics: const BouncingScrollPhysics(),
itemScrollController: _itemScrollController,
itemPositionsListener: _itemPositionsListener,
padding: EdgeInsets.zero,
itemCount: Dummy.categories.length,
itemBuilder: (context, index) {
return Column(
children: [
CustomTextWidget(
paddingTop: 16,
paddingLeft: 16,
paddingBottom: 16,
alignment: Alignment.centerLeft,
text: Text(
Dummy.categories.elementAt(index),
style: AppConstants.textStyle(
fontWeight: FontWeight.bold, fontSize: 28),
),
),
ListView(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
children: [
GestureDetector(
onTap: () {
setState(
() {
isExpanded = !isExpanded;
},
);
},
child:
isExpanded ? const ExpandedProductCard() : const ProductCard()),
const ProductCard(),
const ProductCard(),
const ProductCard(),
const ProductCard(),
],
),
Container()
],
);
},
),
);
}
And thats a code from CustomTextWidget
import 'package:flutter/material.dart';
class CustomTextWidget extends StatelessWidget {
final Alignment? alignment;
final Widget? text;
final double? height;
final double? width;
final double paddingTop;
final double paddingBottom;
final double paddingRight;
final double paddingLeft;
const CustomTextWidget({
Key? key,
this.alignment,
this.width,
@required this.text,
this.height,
this.paddingTop = 0,
this.paddingBottom = 0,
this.paddingRight = 0,
this.paddingLeft = 0,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(
top: paddingTop,
bottom: paddingBottom,
right: paddingRight,
left: paddingLeft,
),
height: height,
width: width,
child: Align(
alignment: alignment ?? Alignment.center,
child: text,
),
);
}
}
I tried lots of solutions but it's always gives me same error( Help me to solve this, so I can normally scroll in App