fix: continued product view

This commit is contained in:
Prajna Prayoga 2024-02-06 21:45:25 +07:00
parent 96c676ac4c
commit 81231505b1
4 changed files with 81 additions and 21 deletions

View File

@ -9,13 +9,14 @@ class ButtonView extends StatelessWidget {
final double? height, width, widthSuffix, widthPrefix, marginVertical; final double? height, width, widthSuffix, widthPrefix, marginVertical;
final EdgeInsetsGeometry? contentPadding; final EdgeInsetsGeometry? contentPadding;
final bool isSecondaryColor, isOutlined, heightWrapContent, disabled; final bool isSecondaryColor, isOutlined, heightWrapContent, disabled;
final Color? backgroundColor, textColor; final Color? backgroundColor, textColor, borderColor;
final MainAxisAlignment? mainAxisAlignmentContent; final MainAxisAlignment? mainAxisAlignmentContent;
// final _widthBtn = SizeConfig.screenWidth / 1.5; // final _widthBtn = SizeConfig.screenWidth / 1.5;
final _widthBtn = SizeConfig.width * .9; final _widthBtn = SizeConfig.width * .9;
// final _heightBtn = SizeConfig.screenHeight / 12; // final _heightBtn = SizeConfig.screenHeight / 12;
final _heightBtn = SizeConfig.height * .07; final _heightBtn = SizeConfig.height * .07;
final FontWeight textWeight; final FontWeight textWeight;
final TextAlign textAlign;
final double? textSize, sizeBorderRadius; final double? textSize, sizeBorderRadius;
final int? maxLines; final int? maxLines;
@ -31,9 +32,11 @@ class ButtonView extends StatelessWidget {
this.width, this.width,
this.contentPadding, this.contentPadding,
this.backgroundColor, this.backgroundColor,
this.borderColor,
this.textColor, this.textColor,
this.textWeight = FontWeight.bold, this.textWeight = FontWeight.bold,
this.textSize, this.textSize,
this.textAlign = TextAlign.center,
this.mainAxisAlignmentContent, this.mainAxisAlignmentContent,
this.disabled = false, this.disabled = false,
this.heightWrapContent = false, this.heightWrapContent = false,
@ -74,11 +77,11 @@ class ButtonView extends StatelessWidget {
borderRadius: BorderRadius.circular(sizeBorderRadius ?? 48), borderRadius: BorderRadius.circular(sizeBorderRadius ?? 48),
side: isOutlined side: isOutlined
? BorderSide( ? BorderSide(
color: disabled color: borderColor ?? (disabled
? color.surface ? color.surface
: isSecondaryColor : isSecondaryColor
? ColorPalette.greyBorder ? ColorPalette.greyBorder
: ColorPalette.primary, : ColorPalette.primary),
) )
: BorderSide.none, : BorderSide.none,
), ),
@ -100,7 +103,7 @@ class ButtonView extends StatelessWidget {
Flexible( Flexible(
child: Text( child: Text(
name, name,
textAlign: TextAlign.center, textAlign: textAlign,
maxLines: maxLines, maxLines: maxLines,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(

View File

@ -83,6 +83,7 @@ class ColorPalette {
static const Color slate800 = Color(0xFF1E293B); static const Color slate800 = Color(0xFF1E293B);
static const Color purple100 = Color(0xFFEDE9FE); static const Color purple100 = Color(0xFFEDE9FE);
static const Color purple500 = Color(0xFF8B5CF6); static const Color purple500 = Color(0xFF8B5CF6);
static const Color orange50 = Color(0xFFFFF7ED);
static const Color orange100 = Color(0xFFFFEDD5); static const Color orange100 = Color(0xFFFFEDD5);
static const Color orange500 = Color(0xFFF97316); static const Color orange500 = Color(0xFFF97316);
static const Color cyan100 = Color(0xFFCFFAFE); static const Color cyan100 = Color(0xFFCFFAFE);

View File

@ -53,7 +53,7 @@ class _InvestTypeViewState extends State<InvestTypeView> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
ButtonBack(), const ButtonBack(),
TextTitle(title: widget.title, color: Colors.white), TextTitle(title: widget.title, color: Colors.white),
SizedBox( SizedBox(
width: SizeConfig.width * 0.1, width: SizeConfig.width * 0.1,
@ -104,9 +104,9 @@ class _InvestTypeViewState extends State<InvestTypeView> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
segmentFilter(const Icon(Icons.filter_alt_outlined), 'Filter', () { }), segmentFilter(const Icon(Icons.filter_alt_outlined, color: ColorPalette.slate400,), 'Filter', () { }),
segmentFilter(const RotatedBox(quarterTurns: 1, child: Icon(Icons.compare_arrows)), 'Sort', () { }), segmentFilter(const RotatedBox(quarterTurns: 1, child: Icon(Icons.compare_arrows, color: ColorPalette.slate400)), 'Sort', () { }),
segmentFilter(const Icon(Icons.dashboard_outlined), 'Compare', () { }), segmentFilter(const Icon(Icons.dashboard_outlined, color: ColorPalette.slate400), 'Compare', () { }),
], ],
), ),
); );
@ -153,13 +153,13 @@ class _InvestTypeViewState extends State<InvestTypeView> {
Row( Row(
children: [ children: [
ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,), ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,),
SizedBox( const SizedBox(
width: 8, width: 8,
), ),
Expanded( Expanded(
child: Text( child: Text(
product.name, product.name,
style: TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 18 fontSize: 18
), ),
@ -176,34 +176,34 @@ class _InvestTypeViewState extends State<InvestTypeView> {
children: [ children: [
Column( Column(
children: [ children: [
Text('Yield', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),), const Text('Yield', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
Row( Row(
children: [ children: [
Text( Text(
'${product.yield.toString()}%', '${product.yield.toString()}%',
style: TextStyle( style: const TextStyle(
color: ColorPalette.green400, color: ColorPalette.green400,
fontWeight: FontWeight.w600 fontWeight: FontWeight.w600
), ),
), ),
Text('/'), const Text('/'),
Text('3year', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),) const Text('3year', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),)
], ],
) )
], ],
), ),
Column( Column(
children: [ children: [
Text('Price/unit', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),), const Text('Price/unit', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
Row( Row(
children: [ children: [
Icon(Icons.trending_up_outlined, size: 18, color: ColorPalette.green400,), const Icon(Icons.trending_up_outlined, size: 18, color: ColorPalette.green400,),
SizedBox( const SizedBox(
width: 2, width: 2,
), ),
Text( Text(
NumberFormatter.numberCurrency(product.priceUnit, 'Rp', 'id_ID'), NumberFormatter.numberCurrency(product.priceUnit, 'Rp', 'id_ID'),
style: TextStyle( style: const TextStyle(
fontWeight: FontWeight.w600 fontWeight: FontWeight.w600
), ),
), ),
@ -213,12 +213,12 @@ class _InvestTypeViewState extends State<InvestTypeView> {
), ),
Column( Column(
children: [ children: [
Text('Managed funds', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),), const Text('Managed funds', style: TextStyle(color: ColorPalette.slate400, fontWeight: FontWeight.w600),),
Row( Row(
children: [ children: [
Text( Text(
NumberFormatter.compactCurrency(product.funds, 'Rp ', 'id_ID'), NumberFormatter.compactCurrency(product.funds, 'Rp ', 'id_ID'),
style: TextStyle( style: const TextStyle(
fontWeight: FontWeight.w600 fontWeight: FontWeight.w600
), ),
), ),

View File

@ -164,7 +164,7 @@ class _ProductViewState extends State<ProductView> {
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12,), ImageView(image: PathAssets.imgProduct, width: SizeConfig.width * .12),
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(
@ -269,6 +269,10 @@ class _ProductViewState extends State<ProductView> {
const SizedBox( const SizedBox(
height: 24, height: 24,
), ),
moreAction(),
const SizedBox(
height: 24,
),
cardInformation('Time Machine', timeMachine()), cardInformation('Time Machine', timeMachine()),
const SizedBox( const SizedBox(
height: 24, height: 24,
@ -509,6 +513,58 @@ class _ProductViewState extends State<ProductView> {
); );
} }
Widget moreAction() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
children: [
Expanded(
child: ButtonView(
onPressed: () {
},
prefixIcon: Icon(Icons.space_dashboard_sharp),
backgroundColor: ColorPalette.blue50,
sizeBorderRadius: 8,
isSecondaryColor: false,
width: SizeConfig.width * .5,
heightWrapContent: true,
isOutlined: true,
widthPrefix: 10,
name: 'Routine Savings',
textSize: 14,
textAlign: TextAlign.start,
contentPadding: EdgeInsets.all(12),
)
),
SizedBox(
width: 16,
),
Expanded(
child: ButtonView(
onPressed: () {
},
prefixIcon: Icon(Icons.space_dashboard_sharp, color: ColorPalette.orange500),
widthPrefix: 10,
name: 'Compare Mutual Funds',
width: SizeConfig.width * .5,
heightWrapContent: true,
backgroundColor: ColorPalette.orange50,
sizeBorderRadius: 8,
isOutlined: true,
borderColor: ColorPalette.orange500,
textSize: 14,
textAlign: TextAlign.start,
textColor: ColorPalette.orange500,
contentPadding: EdgeInsets.all(12),
)
),
],
),
);
}
Widget timeMachine() { Widget timeMachine() {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,