Как я могу остановить прокрутку в SliverAppBar Flutter?Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Как я могу остановить прокрутку в SliverAppBar Flutter?

Сообщение Anonymous »

Панель приложения Sliver моего приложения уже окружена виджетом CustomScrollView. И на нем есть другие Щепки. Мне просто нужно было остановить прокрутку на панели приложения Sliver. Когда я нажимаю на Щепку, она прокручивает всю страницу. После добавления NeverScrollableScrollPhysics() вся страница не может прокручиваться. Но мне нужно остановить только SliverAppBar.

Код: Выделить всё

 body: CustomScrollView(
controller: _scrollController,
slivers: [
SliverAppBar(
systemOverlayStyle: SystemUiOverlayStyle.light,
backgroundColor: Theme.of(context).backgroundColor,
elevation: 1.0,
expandedHeight:
kIsWeb ? 0 : widthHeight * kProductDetail.height,
pinned: true,
floating: false,
leading: Padding(
padding: const EdgeInsets.all(8),
child: CircleAvatar(
backgroundColor: Theme.of(context)
.primaryColorLight
.withOpacity(0.7),
child: IconButton(
icon: Icon(
Icons.close,
color: Theme.of(context).primaryColor,
),
onPressed: () {
context
.read
()
.clearProductVariations();
Navigator.pop(context);
},
),
),
),
actions: [
if (widget.isLoading != true)
HeartButton(
product: product,
size: 20.0,
color: Theme.of(context).primaryColor,
),
Padding(
padding: const EdgeInsets.all(12),
child: CircleAvatar(
backgroundColor: Theme.of(context)
.primaryColorLight
.withOpacity(0.7),
child: IconButton(
icon: const Icon(Icons.more_vert, size: 19),
color: Theme.of(context).primaryColor,
onPressed: () => ProductDetailScreen.showMenu(
context,
widget.product,
isLoading: widget.isLoading,
),
),
),
),
],
flexibleSpace: kIsWeb
? const SizedBox()
: ProductImageSlider(
product: product,
onChange: (index) =>  setState(() {
_selectIndex = index;
}),
),
),
SliverList(
delegate: SliverChildListDelegate(
[
const SizedBox(height: 2),
if (kIsWeb)
ProductGallery(
product: widget.product,
selectIndex: _selectIndex,
),
Padding(
padding: const EdgeInsets.only(
top: 8.0,
bottom: 4.0,
left: 15,
right: 15,
),
child: product.type == 'grouped'
? const SizedBox()
: ProductTitle(product),
),
],
),
),
if (Services().widget.enableShoppingCart(
product.copyWith(isRestricted: false)))
renderProductInfo(),
if (!Services().widget.enableShoppingCart(
product.copyWith(isRestricted: false)) &&
product.shortDescription != null &&
product.shortDescription!.isNotEmpty)
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: ProductShortDescription(product),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(
// horizontal: 15.0,
vertical: 8.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15.0,
),
child: Column(
children: [
Services().widget.renderVendorInfo(product),
ProductDescription(product),
if (kProductDetail.showProductCategories)
ProductDetailCategories(product),
if (kProductDetail.showProductTags)
ProductTag(product),
Services()
.widget
.productReviewWidget(product.id!),
],
),
),
if (kProductDetail
.showRelatedProductFromSameStore &&
product.store?.id != null)
RelatedProductFromSameStore(product),
if (kProductDetail.showRelatedProduct)
RelatedProduct(product),
const SizedBox(height: 50),
],
),
),
),
],
),
Я просто хотел остановить всю прокрутку, когда нажимаю SliverAppBar.
Изображение


Подробнее здесь: https://stackoverflow.com/questions/739 ... ar-flutter
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»