// Author: fruit.com.cn import 'package:flutter/material.dart'; import '../../../core/theme/app_colors.dart'; import '../../../core/theme/app_dimens.dart'; import '../../../l10n/app_localizations.dart'; import 'discover_search_field.dart'; /// 剧场页页头:搜索与头像入口。 class DiscoverHeader extends StatelessWidget { const DiscoverHeader({ super.key, required this.controller, required this.focusNode, required this.onChanged, required this.loading, required this.onProfile, }); final TextEditingController controller; final FocusNode focusNode; final ValueChanged onChanged; final bool loading; final VoidCallback onProfile; @override Widget build(BuildContext context) { final l10n = AppLocalizations.of(context)!; return SizedBox( height: AppDimens.contentHeaderHeight, child: Padding( padding: const EdgeInsets.symmetric( horizontal: AppDimens.pageHorizontal, ), child: Row( children: [ Expanded( child: DiscoverSearchField( controller: controller, focusNode: focusNode, onChanged: onChanged, loading: loading, horizontalPadding: 0, ), ), const SizedBox(width: AppDimens.spaceSm), _profile(l10n), ], ), ), ); } Widget _profile(AppLocalizations l10n) { return Semantics( button: true, label: l10n.myTab, child: InkWell( key: const Key('discover-profile'), customBorder: const CircleBorder(), onTap: onProfile, child: Container( width: AppDimens.tapTarget, height: AppDimens.tapTarget, decoration: BoxDecoration( color: AppColors.card, shape: BoxShape.circle, border: Border.all(color: AppColors.border), ), child: const Icon( Icons.person_rounded, color: AppColors.onSurface, size: AppDimens.accountIcon, ), ), ), ); } }