-
Notifications
You must be signed in to change notification settings - Fork 19
fix: 应用页搜索框吸顶及颜色一致性 #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -344,24 +344,61 @@ class WhitelistPageState extends State<WhitelistPage> { | |||||
| ], | ||||||
| ), | ||||||
|
|
||||||
| // 说明 + 搜索栏 | ||||||
| // 说明文本(随列表滚动,不吸顶) | ||||||
| SliverToBoxAdapter( | ||||||
| child: Container( | ||||||
| child: Padding( | ||||||
| padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), | ||||||
| child: AppListSearchHeader( | ||||||
| countText: _ctrl.showSystemApps | ||||||
| child: Text( | ||||||
| _ctrl.showSystemApps | ||||||
| ? l10n.enabledAppsCountWithSystem(enabledCount) | ||||||
| : l10n.enabledAppsCount(enabledCount), | ||||||
| showCountText: true, | ||||||
| searchController: _searchCtrl, | ||||||
| searchFocusNode: _searchFocus, | ||||||
| hintText: l10n.searchApps, | ||||||
| onChanged: _ctrl.setSearch, | ||||||
| onClear: _clearSearch, | ||||||
| style: Theme.of( | ||||||
| context, | ||||||
| ).textTheme.bodyMedium?.copyWith(color: cs.onSurfaceVariant), | ||||||
| ), | ||||||
| ), | ||||||
| ), | ||||||
|
|
||||||
| // 搜索栏(仅搜索框吸顶) | ||||||
| SliverPersistentHeader( | ||||||
| pinned: true, | ||||||
| delegate: FixedSliverHeaderDelegate( | ||||||
| height: 60, | ||||||
| minHeight: 60, | ||||||
| builder: (context, overlapsContent, collapseProgress) { | ||||||
| final appBarTheme = Theme.of(context).appBarTheme; | ||||||
| final elevation = appBarTheme.scrolledUnderElevation ?? 3.0; | ||||||
| final pinnedBg = overlapsContent | ||||||
| ? ElevationOverlay.applySurfaceTint( | ||||||
| cs.surface, | ||||||
| cs.surfaceTint, | ||||||
| elevation, | ||||||
| ) | ||||||
| : cs.surface; | ||||||
| return Material( | ||||||
| color: pinnedBg, | ||||||
| surfaceTintColor: Theme.of(context).colorScheme.surfaceTint, | ||||||
| elevation: 0, | ||||||
| child: Container( | ||||||
| padding: const EdgeInsets.fromLTRB(16, 0, 16, 12), | ||||||
| child: AppListSearchHeader( | ||||||
| countText: '', | ||||||
| showCountText: false, | ||||||
| searchController: _searchCtrl, | ||||||
| searchFocusNode: _searchFocus, | ||||||
| hintText: l10n.searchApps, | ||||||
| searchBarBackgroundColor: overlapsContent | ||||||
| ? Colors.white | ||||||
|
||||||
| ? Colors.white | |
| ? cs.surfaceContainerHighest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surfaceTintColoris provided on thisMaterial, butelevationis always0, so the tint will not be applied byMaterial(and the actual background tinting is already handled viaElevationOverlay.applySurfaceTint). Consider removingsurfaceTintColorto avoid confusion, or setelevationto match the intended scrolled-under behavior and letMaterialhandle tinting.