// pangolin_logo.dart — 品牌标 / 字标 / App 图标(SVG)
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../pangolin_theme.dart';

const String _base = 'assets';

/// 仅标记(行走穿山甲)。深色主题自动用反白版。
class PangolinMark extends StatelessWidget {
  const PangolinMark({super.key, this.size = 28, this.forceLight, this.forceDark});
  final double size;
  final bool? forceLight;
  final bool? forceDark;

  @override
  Widget build(BuildContext context) {
    final isDark = forceDark ?? (forceLight == true ? false : Theme.of(context).brightness == Brightness.dark);
    final asset = isDark ? '$_base/logo-mark-white.svg' : '$_base/logo-mark.svg';
    return SvgPicture.asset(asset, width: size, height: size);
  }
}

/// 横版字标锁版(浅背景)
class PangolinWordmark extends StatelessWidget {
  const PangolinWordmark({super.key, this.height = 28});
  final double height;
  @override
  Widget build(BuildContext context) => SvgPicture.asset('$_base/logo-wordmark.svg', height: height);
}

/// App 图标(clay 渐变圆角方 + 白色穿山甲)
class PangolinAppIcon extends StatelessWidget {
  const PangolinAppIcon({super.key, this.size = 64});
  final double size;
  @override
  Widget build(BuildContext context) {
    return ClipRRect(
      borderRadius: BorderRadius.circular(size * 0.22),
      child: SvgPicture.asset('$_base/app-icon.svg', width: size, height: size),
    );
  }
}

/// 顶栏品牌锁版:标记 + 品牌名(文案由 l10n 传入,单显)
class PangolinBrandLockup extends StatelessWidget {
  const PangolinBrandLockup({super.key, required this.brand, this.markSize = 26});
  final String brand;
  final double markSize;
  @override
  Widget build(BuildContext context) {
    final c = context.pangolin;
    return Row(mainAxisSize: MainAxisSize.min, children: [
      PangolinMark(size: markSize),
      const SizedBox(width: 9),
      Text(brand, style: PangolinText.h3.copyWith(color: c.fg1, fontWeight: FontWeight.w700)),
    ]);
  }
}
