我有下面的代碼。我需要讓 StorySwipeList、_SearchBar 和 SizedBoxes 與頁面的其余部分一起滾動。Listview Builder 滾動沒有問題。但是頂部的 StorySwipeList、Sizedboxes 和 _searchBar 不想與它們一起滾動。
我在滾動視圖和串列視圖中添加了一個已洗掉的 Neverscroll 物理,我用一列替換了第一個串列視圖并反轉,添加了始終可滾動的物理等。似乎沒有什么可以使那部分小部件移動。
有誰知道如何做到這一點?
return SafeArea(
child: Scaffold(
extendBody: false,
extendBodyBehindAppBar: false,
backgroundColor: HexColor('#0A0928'),
body: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
child: ListView(
shrinkWrap: true,
children: [
StorySwipeList(
latestProTracks: pageManager.latestProTracksNotifier.value),
SizedBox(
height: 10,
),
_searchBar(),
SizedBox(
height: 10,
),
ValueListenableBuilder<List<MediaItem>>(
valueListenable: pageManager.filteredMainPlaylistNotifier,
builder: (context, playlist, _) {
TestLog.log('HOME PAGE: playlist size ${playlist.length}');
return SizedBox(
height: MediaQuery.of(context).size.height * 0.7,
child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: playlist.length,
itemBuilder: (context, index) {
return PlaylistTrack(
index: index,
playlist: playlist,
track: playlist[index],
currentUserId: currentUserId,
playlistName: 'Main',
);
uj5u.com熱心網友回復:
嘗試primary: true,在主 ListView 中設定。您可以將其設定為false其他內部。
uj5u.com熱心網友回復:
移除 Sized Box 的高度限制似乎可以解決問題。
height: MediaQuery.of(context).size.height * 0.7,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/412806.html
標籤:
