Skip to content

Commit

Permalink
[Test] try fix impeller empty padding
Browse files Browse the repository at this point in the history
[Update] update dependencies
[Test] try fix ios safe area

[Test] fix ios navigation bar
  • Loading branch information
canxin121 committed Nov 2, 2024
1 parent 8575017 commit ddba101
Show file tree
Hide file tree
Showing 47 changed files with 2,108 additions and 1,903 deletions.
262 changes: 142 additions & 120 deletions lib/common_pages/db_music_agg_listview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,136 +130,158 @@ class DbMusicContainerListPageState extends State<DbMusicContainerListPage>
final double screenWidth = MediaQuery.of(context).size.width;

return CupertinoPageScaffold(
backgroundColor: backgroundColor,
navigationBar: CupertinoNavigationBar(
padding: const EdgeInsetsDirectional.only(end: 16),
backgroundColor: backgroundColor,
leading: CupertinoButton(
padding: const EdgeInsets.all(0),
child: Icon(CupertinoIcons.back, color: activeIconRed),
onPressed: () {
popPage(context, isDesktop);
},
),
middle: Text(
playlist.name,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: getTextColor(isDarkMode),
).useSystemChineseFont(),
),
trailing: DbMusicListChoicMenu(
isDesktop: widget.isDesktop,
builder: (context, showMenu) => CupertinoButton(
padding: const EdgeInsets.all(0),
onPressed: showMenu,
child: Text(
'选项',
style: TextStyle(color: activeIconRed).useSystemChineseFont(),
backgroundColor: backgroundColor,
child: Column(
children: [
CupertinoNavigationBar(
padding: const EdgeInsetsDirectional.only(end: 16),
backgroundColor: backgroundColor,
leading: CupertinoButton(
padding: const EdgeInsets.all(0),
child: Icon(CupertinoIcons.back, color: activeIconRed),
onPressed: () {
popPage(context, isDesktop);
},
),
middle: Text(
playlist.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: getTextColor(isDarkMode),
).useSystemChineseFont(),
),
trailing: DbMusicListChoicMenu(
isDesktop: widget.isDesktop,
builder: (context, showMenu) => CupertinoButton(
padding: const EdgeInsets.all(0),
onPressed: showMenu,
child: Text(
'选项',
style: TextStyle(color: activeIconRed)
.useSystemChineseFont(),
)),
playlist: playlist,
musicAggs: musicAggs,
)),
playlist: playlist,
musicAggs: musicAggs,
)),
child: CustomScrollView(
slivers: <Widget>[
MobilePlaylistHeader(
playlist: playlist,
musicAggregators: musicAggs,
isDarkMode: isDarkMode),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
bool isFirst = index == 0;
bool isLastItem = index == musicAggs.length - 1;
Expanded(
child: CustomScrollView(
slivers: <Widget>[
MobilePlaylistHeader(
playlist: playlist,
musicAggregators: musicAggs,
isDarkMode: isDarkMode),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
bool isFirst = index == 0;
bool isLastItem = index == musicAggs.length - 1;

final musicAgg = musicAggs[index];
return Column(
children: [
if (isFirst)
const Padding(padding: EdgeInsets.only(top: 5)),
Padding(
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: MobileMusicAggregatorListItem(
key: ValueKey(musicAgg.identity()),
musicAgg: musicAgg,
playlist: widget.playlist,
cacheCover: globalConfig.storageConfig.saveCover,
),
),
if (!isLastItem)
Center(
child: SizedBox(
width: screenWidth * 0.85,
child: Divider(
color: dividerColor,
height: 0.5,
final musicAgg = musicAggs[index];
return Column(
children: [
if (isFirst)
const Padding(padding: EdgeInsets.only(top: 5)),
Padding(
padding: const EdgeInsets.only(top: 5, bottom: 5),
child: MobileMusicAggregatorListItem(
key: ValueKey(musicAgg.identity()),
musicAgg: musicAgg,
playlist: widget.playlist,
cacheCover: globalConfig.storageConfig.saveCover,
),
),
),
)
],
);
},
childCount: musicAggs.length,
),
),
const SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.only(top: 200),
),
),
],
),
);
if (!isLastItem)
Center(
child: SizedBox(
width: screenWidth * 0.85,
child: Divider(
color: dividerColor,
height: 0.5,
),
),
)
],
);
},
childCount: musicAggs.length,
),
),
const SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.only(top: 200),
),
),
],
)),
],
));
}

Widget _buildDesktopLayout(bool isDarkMode, bool isDesktop) {
final double screenWidth = MediaQuery.of(context).size.width;

return CupertinoPageScaffold(
backgroundColor: getPrimaryBackgroundColor(isDarkMode),
navigationBar: CupertinoNavigationBar(
padding: const EdgeInsetsDirectional.only(end: 16),
backgroundColor: getPrimaryBackgroundColor(isDarkMode),
leading: CupertinoButton(
padding: const EdgeInsets.all(0),
child: Icon(CupertinoIcons.back, color: activeIconRed),
onPressed: () {
popPage(context, isDesktop);
},
),
trailing: DbMusicListChoicMenu(
isDesktop: widget.isDesktop,
builder: (context, showMenu) => CupertinoButton(
padding: const EdgeInsets.all(0),
onPressed: showMenu,
child: Text(
'选项',
style: TextStyle(color: activeIconRed).useSystemChineseFont(),
backgroundColor: getPrimaryBackgroundColor(isDarkMode),
child: Column(
children: [
CupertinoNavigationBar(
padding: const EdgeInsetsDirectional.only(end: 16),
backgroundColor: getPrimaryBackgroundColor(isDarkMode),
middle: Text(
playlist.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: getTextColor(isDarkMode),
).useSystemChineseFont(),
),
leading: CupertinoButton(
padding: const EdgeInsets.all(0),
child: Icon(CupertinoIcons.back, color: activeIconRed),
onPressed: () {
popPage(context, isDesktop);
},
),
trailing: DbMusicListChoicMenu(
isDesktop: widget.isDesktop,
builder: (context, showMenu) => CupertinoButton(
padding: const EdgeInsets.all(0),
onPressed: showMenu,
child: Text(
'选项',
style: TextStyle(color: activeIconRed)
.useSystemChineseFont(),
)),
playlist: playlist,
musicAggs: musicAggs,
)),
playlist: playlist,
musicAggs: musicAggs,
)),
child: CustomScrollView(
slivers: <Widget>[
MusicListHeader(
playlist: playlist,
musicAggregators: musicAggs,
isDarkMode: isDarkMode,
screenWidth: screenWidth,
cacheCover: globalConfig.storageConfig.saveCover,
),
const SliverToBoxAdapter(
child: SizedBox(height: 20),
),
MusicAggregatorList(
musicAggs: musicAggs,
playlist: playlist,
cacheCover: globalConfig.storageConfig.saveCover,
),
],
),
);
Expanded(
child: CustomScrollView(
slivers: <Widget>[
MusicListHeader(
playlist: playlist,
musicAggregators: musicAggs,
isDarkMode: isDarkMode,
screenWidth: screenWidth,
cacheCover: globalConfig.storageConfig.saveCover,
),
const SliverToBoxAdapter(
child: SizedBox(height: 20),
),
MusicAggregatorList(
musicAggs: musicAggs,
playlist: playlist,
cacheCover: globalConfig.storageConfig.saveCover,
),
],
)),
],
));
}
}

Expand Down
57 changes: 30 additions & 27 deletions lib/common_pages/db_playlist_collection_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,37 @@ class DbPlaylistCollectionPageState extends State<DbPlaylistCollectionPage>

return CupertinoPageScaffold(
backgroundColor: getPrimaryBackgroundColor(isDarkMode),
navigationBar: CupertinoNavigationBar(
backgroundColor: getNavigatorBarColor(isDarkMode),
middle: Text(
'所有歌单列表',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: getTextColor(isDarkMode),
).useSystemChineseFont(),
),
trailing: PlaylistCollectionPageMenu(
builder: (context, showMenu) => CupertinoButton(
padding: const EdgeInsets.all(0),
onPressed: showMenu,
child: Text(
'选项',
style: TextStyle(color: activeIconRed).useSystemChineseFont(),
)),
isDesktop: widget.isDesktop,
playlists:
playlistsCollections.map((e) => e.$2).expand((e) => e).toList(),
playlistCollections: playlistsCollections.map((e) => e.$1).toList(),
),
),
child: SafeArea(
child: Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CupertinoNavigationBar(
backgroundColor: getNavigatorBarColor(isDarkMode),
middle: Text(
'所有歌单列表',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: getTextColor(isDarkMode),
).useSystemChineseFont(),
),
trailing: PlaylistCollectionPageMenu(
builder: (context, showMenu) => CupertinoButton(
padding: const EdgeInsets.all(0),
onPressed: showMenu,
child: Text(
'选项',
style: TextStyle(color: activeIconRed)
.useSystemChineseFont(),
)),
isDesktop: widget.isDesktop,
playlists: playlistsCollections
.map((e) => e.$2)
.expand((e) => e)
.toList(),
playlistCollections:
playlistsCollections.map((e) => e.$1).toList(),
),
),
Expanded(
child: ListView.builder(
itemCount: playlistsCollections.length,
Expand All @@ -99,7 +102,7 @@ class DbPlaylistCollectionPageState extends State<DbPlaylistCollectionPage>
),
),
],
)));
));
}

@override
Expand Down
Loading

0 comments on commit ddba101

Please sign in to comment.