|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | +import 'package:jusicool_design_system/jusicool_design_system.dart'; |
| 4 | + |
| 5 | +class StockCards extends StatelessWidget { |
| 6 | + final String companyName; |
| 7 | + final String logoUrl; |
| 8 | + final String price; |
| 9 | + final String priceChange; |
| 10 | + final String share; |
| 11 | + final bool isPositive; |
| 12 | + |
| 13 | + const StockCards({ |
| 14 | + super.key, |
| 15 | + required this.companyName, |
| 16 | + required this.logoUrl, |
| 17 | + required this.price, |
| 18 | + required this.priceChange, |
| 19 | + required this.share, |
| 20 | + this.isPositive = true, |
| 21 | + }); |
| 22 | + |
| 23 | + @override |
| 24 | + Widget build(BuildContext context) { |
| 25 | + return Container( |
| 26 | + decoration: BoxDecoration( |
| 27 | + color: JusicoolColor.white, |
| 28 | + borderRadius: BorderRadius.circular(12.r), |
| 29 | + ), |
| 30 | + child: Row( |
| 31 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 32 | + children: [ |
| 33 | + Row( |
| 34 | + spacing: 14.w, |
| 35 | + children: [ |
| 36 | + SizedBox( |
| 37 | + width: 40.w, |
| 38 | + height: 40.h, |
| 39 | + child: ClipRRect( |
| 40 | + borderRadius: BorderRadius.circular(20.r), |
| 41 | + child: Image.network(logoUrl, fit: BoxFit.cover), |
| 42 | + ), |
| 43 | + ), |
| 44 | + Column( |
| 45 | + spacing: 2.h, |
| 46 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 47 | + children: [ |
| 48 | + Text(companyName, style: JusicoolTypography.bodyMedium), |
| 49 | + Text( |
| 50 | + share, |
| 51 | + style: JusicoolTypography.label.copyWith( |
| 52 | + color: JusicoolColor.gray500, |
| 53 | + ), |
| 54 | + ), |
| 55 | + ], |
| 56 | + ), |
| 57 | + ], |
| 58 | + ), |
| 59 | + Column( |
| 60 | + spacing: 2.h, |
| 61 | + crossAxisAlignment: CrossAxisAlignment.end, |
| 62 | + children: [ |
| 63 | + Text(price, style: JusicoolTypography.bodyMedium), |
| 64 | + Text( |
| 65 | + priceChange, |
| 66 | + style: JusicoolTypography.label.copyWith( |
| 67 | + color: isPositive ? JusicoolColor.main : JusicoolColor.error, |
| 68 | + ), |
| 69 | + ), |
| 70 | + ], |
| 71 | + ), |
| 72 | + ], |
| 73 | + ), |
| 74 | + ); |
| 75 | + } |
| 76 | +} |
0 commit comments