import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; const Color scHomeShellBackgroundColor = Color(0xFF051711); const Color scHomeShellAccentColor = Color(0xFF18F2B1); const Color scHomeShellGoldColor = Color(0xFFE9B455); const LinearGradient scHomeShellGoldTextGradient = LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0xFFFCFBD9), Color(0xFFDC9D3A)], ); const String scHomeShellBackgroundAsset = 'sc_images/index/sc_home_shell_bg.png'; class SCHomeShellBackground extends StatelessWidget { const SCHomeShellBackground({super.key}); @override Widget build(BuildContext context) { return DecoratedBox( decoration: const BoxDecoration(color: scHomeShellBackgroundColor), child: Image.asset( scHomeShellBackgroundAsset, width: double.infinity, height: double.infinity, fit: BoxFit.cover, alignment: Alignment.topCenter, errorBuilder: (context, error, stackTrace) => const ColoredBox(color: scHomeShellBackgroundColor), ), ); } } class SCHomeShellGradientText extends StatelessWidget { const SCHomeShellGradientText( this.text, { super.key, required this.style, this.maxLines, this.overflow, this.textAlign, }); final String text; final TextStyle style; final int? maxLines; final TextOverflow? overflow; final TextAlign? textAlign; @override Widget build(BuildContext context) { final gradientText = ShaderMask( blendMode: BlendMode.srcIn, shaderCallback: scHomeShellGoldTextGradient.createShader, child: _buildText(style.copyWith(color: Colors.white, shadows: null)), ); if (style.shadows == null || style.shadows!.isEmpty) { return gradientText; } return Stack( clipBehavior: Clip.none, children: [ ExcludeSemantics( child: _buildText(style.copyWith(color: Colors.transparent)), ), gradientText, ], ); } Widget _buildText(TextStyle textStyle) { return Text( text, maxLines: maxLines, overflow: overflow, textAlign: textAlign, style: textStyle, ); } } TextStyle scHomeShellTitleStyle({double? fontSize}) { return TextStyle( color: scHomeShellGoldColor, fontSize: (fontSize ?? 28).sp, fontWeight: FontWeight.w900, fontStyle: FontStyle.italic, shadows: const [ Shadow(color: Color(0xB3000000), offset: Offset(0, 1), blurRadius: 1), ], ); }