Widget buildContent()

in lib/ui/aliplayer_top_bar_widget.dart [48:135]


  Widget buildContent(BuildContext context) {
    return Container(
      height: kToolbarHeight,
      color: Colors.black.withOpacity(0.3),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          // 返回按钮
          IconButton(
            icon: const Icon(
              Icons.arrow_back,
              color: Colors.white,
            ),
            onPressed: onBackPressed,
          ),

          // 标题
          Expanded(
            child: title == null || title!.isEmpty
                ? const SizedBox.shrink()
                : Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 8),
                    child: Text(
                      title!,
                      textAlign: TextAlign.left,
                      maxLines: 1,
                      overflow: TextOverflow.ellipsis,
                      style: const TextStyle(
                        fontSize: 16,
                        color: Colors.white,
                      ),
                    ),
                  ),
          ),

          // 下载按钮,可选
          if (isDownload != null && onDownloadPressed != null) ...[
            const SizedBox(width: 4),
            IconButton(
              icon: Icon(
                isDownload!
                    ? Icons.download_done_rounded
                    : Icons.download_rounded,
                color: Colors.white,
              ),
              onPressed: () => onDownloadPressed?.call(isDownload!),
            ),
          ],

          // 截图按钮,可选
          if (onSnapshotPressed != null) ...[
            const SizedBox(width: 4),
            IconButton(
              icon: const Icon(
                Icons.camera_alt_rounded,
                color: Colors.white,
              ),
              onPressed: onSnapshotPressed,
            )
          ],

          // PIP 按钮,可选
          if (onPIPPressed != null) ...[
            const SizedBox(width: 4),
            IconButton(
              icon: const Icon(
                Icons.picture_in_picture_alt_rounded,
                color: Colors.white,
              ),
              onPressed: onPIPPressed,
            )
          ],

          // 设置按钮,仅当 onSettingsPressed 不为空时显示
          if (onSettingsPressed != null) ...[
            const SizedBox(width: 4),
            IconButton(
              icon: const Icon(
                Icons.settings,
                color: Colors.white,
              ),
              onPressed: onSettingsPressed,
            ),
          ],
        ],
      ),
    );
  }