fix(home): 调整搜索栏右侧入口样式
This commit is contained in:
1 parent
acae05d354
commit
909762ac3b
5 files changed
+66
-8
No files matched your search
@@ -1115,6 +1115,7 @@ $ flutter test
|
||||
- 四类卡片去底板/描边,封面统一 3:4、8 圆角、行距 10、封底标题间距 6;状态角标为右上角紧凑异形丝带。
|
||||
- 标题下方恢复左对齐题材文字,使用 `|` 分隔、灰色小字,与封面状态角标保持独立。
|
||||
- 首页搜索栏到一级、一级到二级、二级到网格间距为 8/8/10;非精选 tab 直接以 10 衔接网格。
|
||||
- 搜索框右侧皇冠与礼物改为 40 热区、24 彩色图标,透明背景、间距 12,保留礼物角标。
|
||||
- 播放量贴封面右下角(底 2、右 6),火焰图标 11 + 12/w400 纯文字,间距 4,并保留极淡底部渐变。
|
||||
- 修复二级 chip 运行时颜色误用 `const TextStyle` 的编译错误,并校正相关测试 Finder 类型。
|
||||
- 全部短剧的地区、字幕、配音筛选 UI 已占位;以下接口待补:地区、字幕/配音筛选数据。
|
||||
@@ -39,6 +39,8 @@ abstract final class AppColors {
|
||||
/// 金币与奖励。
|
||||
static const gold = Color(0xFFF3B34C);
|
||||
static const goldDeep = Color(0xFFD9A23A);
|
||||
static const homeCrownGold = Color(0xFFF5C451);
|
||||
static const homeGiftPink = Color(0xFFFF4D8D);
|
||||
static const vipGoldStart = Color(0xFFF5D9A0);
|
||||
static const vipGoldEnd = Color(0xFFE8B65A);
|
||||
static const vipBadgeSurface = Color(0x1F3D2408);
|
||||
|
||||
@@ -124,8 +124,10 @@ abstract final class AppDimens {
|
||||
static const double homeSearchPrimaryGap = 8;
|
||||
static const double homePrimarySecondaryGap = 8;
|
||||
static const double homeSecondaryGridGap = 10;
|
||||
static const double homeIconSlot = 44;
|
||||
static const double homeHeaderIcon = 22;
|
||||
static const double homeActionSlot = 40;
|
||||
static const double homeActionIcon = 24;
|
||||
static const double homeActionGap = 12;
|
||||
|
||||
/// 推荐分区。
|
||||
static const double recommendSectionTitle = 17;
|
||||
|
||||
@@ -143,13 +143,15 @@ class HomeGridHeader extends StatelessWidget {
|
||||
_headerAction(
|
||||
key: const Key('home-vip-entry'),
|
||||
icon: Icons.workspace_premium_outlined,
|
||||
color: AppColors.homeCrownGold,
|
||||
tooltip: l10n.vipMembership,
|
||||
onTap: callbacks.onOpenVip,
|
||||
),
|
||||
const SizedBox(width: AppDimens.spaceXs),
|
||||
const SizedBox(width: AppDimens.homeActionGap),
|
||||
_headerAction(
|
||||
key: const Key('home-wallet-entry'),
|
||||
icon: Icons.card_giftcard_rounded,
|
||||
color: AppColors.homeGiftPink,
|
||||
tooltip: l10n.wallet,
|
||||
onTap: callbacks.onOpenWallet,
|
||||
badge: walletBadge,
|
||||
@@ -162,12 +164,13 @@ class HomeGridHeader extends StatelessWidget {
|
||||
Widget _headerAction({
|
||||
required Key key,
|
||||
required IconData icon,
|
||||
required Color color,
|
||||
required String tooltip,
|
||||
required VoidCallback onTap,
|
||||
int? badge,
|
||||
}) {
|
||||
return SizedBox.square(
|
||||
dimension: AppDimens.homeIconSlot,
|
||||
dimension: AppDimens.homeActionSlot,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
@@ -175,16 +178,14 @@ class HomeGridHeader extends StatelessWidget {
|
||||
child: Tooltip(
|
||||
message: tooltip,
|
||||
child: Material(
|
||||
color: AppColors.contentSurface,
|
||||
borderRadius: BorderRadius.circular(AppDimens.inputRadius),
|
||||
color: AppColors.transparent,
|
||||
child: InkWell(
|
||||
key: key,
|
||||
borderRadius: BorderRadius.circular(AppDimens.inputRadius),
|
||||
onTap: onTap,
|
||||
child: Icon(
|
||||
icon,
|
||||
size: AppDimens.homeHeaderIcon,
|
||||
color: AppColors.navSelected,
|
||||
size: AppDimens.homeActionIcon,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:fruitshorts/core/data/repositories/favorite_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/playback_repository.dart';
|
||||
import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart';
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/theme/app_dimens.dart';
|
||||
import 'package:fruitshorts/core/widgets/app_bottom_nav.dart';
|
||||
import 'package:fruitshorts/pages/following/following_page.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
@@ -50,6 +51,57 @@ void main() {
|
||||
}
|
||||
expect(find.byKey(const Key('home-wallet-entry')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-wallet-badge')), findsOneWidget);
|
||||
final searchEntry = find.byKey(const Key('home-search-entry'));
|
||||
final vipEntry = find.byKey(const Key('home-vip-entry'));
|
||||
final walletEntry = find.byKey(const Key('home-wallet-entry'));
|
||||
expect(
|
||||
tester.getSize(vipEntry),
|
||||
const Size.square(AppDimens.homeActionSlot),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(walletEntry),
|
||||
const Size.square(AppDimens.homeActionSlot),
|
||||
);
|
||||
expect(
|
||||
tester.getCenter(vipEntry).dy,
|
||||
closeTo(tester.getCenter(searchEntry).dy, 0.1),
|
||||
);
|
||||
expect(
|
||||
tester.getCenter(walletEntry).dy,
|
||||
closeTo(tester.getCenter(searchEntry).dy, 0.1),
|
||||
);
|
||||
expect(
|
||||
tester.getTopLeft(walletEntry).dx - tester.getTopRight(vipEntry).dx,
|
||||
AppDimens.homeActionGap,
|
||||
);
|
||||
expect(
|
||||
tester.getTopRight(walletEntry).dx,
|
||||
closeTo(390 - AppDimens.feedPageHorizontal, 0.1),
|
||||
);
|
||||
final crown = tester.widget<Icon>(
|
||||
find.descendant(
|
||||
of: vipEntry,
|
||||
matching: find.byIcon(Icons.workspace_premium_outlined),
|
||||
),
|
||||
);
|
||||
final gift = tester.widget<Icon>(
|
||||
find.descendant(
|
||||
of: walletEntry,
|
||||
matching: find.byIcon(Icons.card_giftcard_rounded),
|
||||
),
|
||||
);
|
||||
expect(crown.size, AppDimens.homeActionIcon);
|
||||
expect(crown.color, AppColors.homeCrownGold);
|
||||
expect(gift.size, AppDimens.homeActionIcon);
|
||||
expect(gift.color, AppColors.homeGiftPink);
|
||||
expect(
|
||||
tester
|
||||
.widget<Material>(
|
||||
find.ancestor(of: vipEntry, matching: find.byType(Material)).first,
|
||||
)
|
||||
.color,
|
||||
AppColors.transparent,
|
||||
);
|
||||
expect(find.byKey(const Key('mine-mini-player')), findsNothing);
|
||||
expect(find.byType(FloatingActionButton), findsNothing);
|
||||
for (final key in _keys.skip(1)) {
|
||||
|
||||
Reference in new issue
Block a user