Created
          July 10, 2024 19:03 
        
      - 
      
- 
        Save tomasbaran/dd2e5014227383d0fe89b27e60ca194c to your computer and use it in GitHub Desktop. 
    SoFiPacificMarqueePerformanceChange -> SoFiPacificMarqueePerformanceInfo
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:flutter/material.dart'; | |
| import 'package:sofi_x_package/core/constants/dimensions.dart'; | |
| import 'package:sofi_x_package/core/themes/pacific/pacific_colors.dart'; | |
| import 'package:sofi_x_package/core/themes/sofi_theme.dart'; | |
| import 'package:sofi_x_package/widgets/pacific/loaders/pacific_loading_shimmer.dart'; | |
| import 'package:sofi_x_package/widgets/sofi_divider.dart'; | |
| import 'package:sofi_x_package/widgets/utilities/theme_container.dart'; | |
| /// Design Spec: https://www.figma.com/design/PV3yXSwydvnY2whzQO0pVG/Invest---Robo?node-id=3816-341443&t=pkroMz4fKn1cEQnK-4 | |
| class SoFiPacificMarqueePerformanceInfo extends StatelessWidget { | |
| final String? leadingText; | |
| final double? percentage; | |
| final double? cashAmount; | |
| /// Whether or not the change is currently loading. Defaults to [false] | |
| final bool isLoading; | |
| const SoFiPacificMarqueePerformanceInfo({ | |
| Key? key, | |
| this.isLoading = false, | |
| this.leadingText, | |
| this.percentage, | |
| this.cashAmount, | |
| }) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| if (isLoading) { | |
| return const PacificLoadingShimmerContainer( | |
| width: 160, | |
| height: Dimensions.normal_20, | |
| borderRadius: Dimensions.small_8, | |
| ); | |
| } | |
| return PacificThemeContainer( | |
| childBuilder: (context) => Padding( | |
| padding: const EdgeInsets.only(bottom: Dimensions.normal_12), | |
| child: Row( | |
| children: [ | |
| if (leadingText != null) | |
| Expanded( | |
| child: Text( | |
| leadingText!, | |
| style: context.pacific.sofiTextTheme.bodyMedium?.copyWith(color: PacificColors.gray600.color), | |
| ), | |
| ), | |
| if (cashAmount != null) | |
| Text( | |
| '\$${cashAmount!.toStringAsFixed(2)}', | |
| style: context.pacific.sofiTextTheme.bodyMedium, | |
| softWrap: true, | |
| ), | |
| if (cashAmount != null && percentage != null) | |
| Row( | |
| children: [ | |
| const SizedBox(width: Dimensions.small_6), | |
| SofiDivider( | |
| vertical: true, | |
| length: 14, | |
| thickness: 0.5, | |
| noIndent: true, | |
| color: context.pacific.sofiTextTheme.bodyMedium?.color, | |
| ), | |
| const SizedBox(width: Dimensions.small_6), | |
| ], | |
| ), | |
| if (percentage != null) | |
| Text( | |
| '${percentage!.toStringAsFixed(2)}%', | |
| style: context.pacific.sofiTextTheme.bodyMedium, | |
| ), | |
| ], | |
| ), | |
| ), | |
| ); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment