onboarding_illustrations.dart 2.35 KB
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:flutter/material.dart';

class ResearchCard extends StatelessWidget {
  const ResearchCard({
    super.key,
    required this.title,
    required this.isHRVup,
    required this.backgroundColor,
    required this.image,
  });

  final String title;
  final bool isHRVup;

  final Color backgroundColor;
  final String image;
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 320,
      width: 171,
      decoration: BoxDecoration(
        color: backgroundColor,
        borderRadius: BorderRadius.circular(32),
        image: DecorationImage(image: AssetImage(image), fit: BoxFit.fill),
      ),
      padding: const EdgeInsets.fromLTRB(12, 24, 12, 28),
      child: Stack(
        children: [
          Positioned(
            top: 0,
            left: 0,
            right: 0,
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text(
                  title,
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    color: context.colors.textPrimary,
                    fontSize: 18,
                    fontWeight: FontWeight.w600,
                    letterSpacing: 0,
                  ),
                ),
                const SizedBox(height: 2),
                RichText(
                    text: TextSpan(children: [
                  TextSpan(
                      text: isHRVup
                          ? context.l10n.onboardingResearchHrvUp
                          : context.l10n.onboardingResearchHrvDown,
                      style: TextStyle(
                          color: context.colors.textSecondary,
                          fontSize: 12,
                          letterSpacing: 0)),
                  WidgetSpan(
                      child: Image.asset(
                          width: 12,
                          height: 12,
                          isHRVup
                              ? 'assets/images/common/ic_arrow_green_up.png'
                              : 'assets/images/common/ic_arrow_red_down.png'),
                      alignment: PlaceholderAlignment.middle),
                ])),
              ],
            ),
          ),
        ],
      ),
    );
  }
}