-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: dynamic_layoutsThe dynamic_layouts packageThe dynamic_layouts packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: solvedIssue is closed as solvedIssue is closed as solvedteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
Place two or more DynamicSliverGrid in a CustomScrollView.
Expected results
The CustomScrollView can scroll normally without jitter.
Actual results
The DynamicSliverGrid are shaking when CustomScrollView scrolls.
Code sample
Code sample
import 'package:dynamic_layouts/dynamic_layouts.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const StaggeredExample());
}
/// A staggered layout example. Clicking the upper-right button will change
/// between a grid with a fixed cross axis count and one with a main axis
/// extent.
class StaggeredExample extends StatefulWidget {
/// Creates a [StaggeredExample].
const StaggeredExample({super.key});
@override
State<StaggeredExample> createState() => _StaggeredExampleState();
}
class _StaggeredExampleState extends State<StaggeredExample> {
final List<Widget> children = List<Widget>.generate(
50,
(int index) => _DynamicSizedTile(index: index),
);
bool fixedCrossAxisCount = true;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Staggered Layout Example'),
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 50.0),
child: TextButton(
onPressed: () {
setState(() {
fixedCrossAxisCount = !fixedCrossAxisCount;
});
},
child: Text(
fixedCrossAxisCount ? 'FIXED' : 'MAX',
style: const TextStyle(color: Colors.white),
),
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
children.add(_DynamicSizedTile(index: children.length));
});
},
child: const Icon(Icons.plus_one),
),
body: _buildGridView(),
);
}
Widget _buildGridView() {
Widget resultWidget = CustomScrollView(
slivers: [
DynamicSliverGrid(
gridDelegate: DynamicSliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
return _DynamicSizedTile(index: index);
},
childCount: 100,
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return Container(
width: double.infinity,
height: 60,
color: Colors.red,
);
},
childCount: 10,
)),
DynamicSliverGrid(
gridDelegate: DynamicSliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 20,
),
delegate: SliverChildBuilderDelegate(
(context, index) {
return _DynamicSizedTile(index: index);
},
childCount: 100,
),
),
],
);
return resultWidget;
}
}
class _DynamicSizedTile extends StatelessWidget {
const _DynamicSizedTile({required this.index});
final int index;
@override
Widget build(BuildContext context) {
return Container(
height: index % 3 * 50 + 20,
color: Colors.amber[(index % 8 + 1) * 100],
child: Text('Index $index'),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
DynamicGridView.mov
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.2.1 22D68 darwin-arm, locale zh-Hans-CN)
• Flutter version 3.3.10 on channel stable at /Users/lxf/fvm/versions/3.3.10
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (5 months ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/lxf/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_SDK_ROOT = /Users/lxf/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode-14.2.0.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.78.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (2 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• lxf的iPhone (mobile) • 00008120-abcdabcdabcdd • ios • iOS 16.4.1 20E252
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: dynamic_layoutsThe dynamic_layouts packageThe dynamic_layouts packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: solvedIssue is closed as solvedIssue is closed as solvedteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team