status_preview_card.dart 2.25 KB
import 'package:doublefeel_flutter/core/util/size_extensions.dart';
import 'package:flutter/material.dart';

import 'watch_theme_character_avatar.dart';
import 'watch_theme_colors.dart';
import 'watch_theme_section_card.dart';

class StatusPreviewCard extends StatelessWidget {
  const StatusPreviewCard({super.key});

  static const _items = [
    _StatusPreviewItem('状态优秀', WatchThemeColors.excellent,
        icon: 'assets/images/watch_theme/official_default_green.png'),
    _StatusPreviewItem('状态正常', WatchThemeColors.normal,
        icon: 'assets/images/watch_theme/official_default_blue.png'),
    _StatusPreviewItem('注意压力', WatchThemeColors.stress,
        icon: 'assets/images/watch_theme/official_default_orange.png'),
    _StatusPreviewItem('压力过载', WatchThemeColors.overload,
        icon: 'assets/images/watch_theme/official_default_red.png'),
  ];

  @override
  Widget build(BuildContext context) {
    return WatchThemeSectionCard(
      padding: EdgeInsets.fromLTRB(20.dp, 20.dp, 20.dp, 17.dp),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const WatchThemeSectionTitle('状态预览'),
          SizedBox(height: 24.dp),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              for (final item in _items)
                Column(
                  children: [
                    WatchThemeCharacterAvatar(
                      size: 60,
                      useDefaultCharacter: true,
                      backgroundColor: item.color,
                      assetPath: item.icon,
                    ),
                    SizedBox(height: 4.dp),
                    Text(
                      item.title,
                      style: TextStyle(
                        color: item.color,
                        fontSize: 12.dp,
                        fontWeight: FontWeight.w400,
                        height: 1.25,
                      ),
                    ),
                  ],
                ),
            ],
          ),
        ],
      ),
    );
  }
}

class _StatusPreviewItem {
  const _StatusPreviewItem(this.title, this.color, {required this.icon});

  final String title;
  final Color color;
  final String icon;
}