Initial commit: Penyerahan final Source code Tugas Akhir
This commit is contained in:
159
lib/screens/checkout/components/course_list.dart
Normal file
159
lib/screens/checkout/components/course_list.dart
Normal file
@ -0,0 +1,159 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:initial_folder/size_config.dart';
|
||||
import 'package:initial_folder/theme.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CourseList extends StatelessWidget {
|
||||
const CourseList({
|
||||
Key? key,
|
||||
required this.idCourse,
|
||||
required this.title,
|
||||
required this.price,
|
||||
required this.discountPrice,
|
||||
required this.imageUrl,
|
||||
this.isDetailCourse,
|
||||
}) : super(key: key);
|
||||
|
||||
final String idCourse;
|
||||
final String title;
|
||||
final String price;
|
||||
final String discountPrice;
|
||||
final String imageUrl;
|
||||
final bool? isDetailCourse;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("Ini price ${price}");
|
||||
print("Ini discountPrice ${discountPrice}");
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 10,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: getProportionateScreenWidth(70),
|
||||
height: getProportionateScreenWidth(39),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(imageUrl),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(width: getProportionateScreenWidth(10)),
|
||||
Expanded(
|
||||
flex: 15,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
fontWeight: reguler,
|
||||
fontSize: getProportionateScreenWidth(12),
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Spacer(),
|
||||
Flexible(
|
||||
flex: 10,
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if (isDetailCourse == null)
|
||||
discountPrice == "0"
|
||||
? Text(
|
||||
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(price))}',
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
fontWeight: reguler,
|
||||
fontSize: getProportionateScreenWidth(11),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(price))}',
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
fontWeight: reguler,
|
||||
fontSize: getProportionateScreenWidth(11),
|
||||
),
|
||||
)
|
||||
else
|
||||
discountPrice == "0"
|
||||
? Text(
|
||||
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(price))}',
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
fontWeight: reguler,
|
||||
fontSize: getProportionateScreenWidth(11),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(price == "0" ? discountPrice : price))}',
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
fontWeight: reguler,
|
||||
fontSize: getProportionateScreenWidth(11),
|
||||
),
|
||||
),
|
||||
if (isDetailCourse == null)
|
||||
if (discountPrice != "0" && discountPrice != price)
|
||||
Text(
|
||||
'Rp ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(discountPrice))}',
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
decoration: TextDecoration.lineThrough,
|
||||
color: fourthColor,
|
||||
fontWeight: reguler,
|
||||
fontSize: SizeConfig.blockHorizontal! * 2.7,
|
||||
),
|
||||
)
|
||||
else
|
||||
SizedBox.shrink()
|
||||
else if (price != "0")
|
||||
Text(
|
||||
'Rp ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(discountPrice))}',
|
||||
style: thirdTextStyle.copyWith(
|
||||
letterSpacing: 0.5,
|
||||
decoration: TextDecoration.lineThrough,
|
||||
color: fourthColor,
|
||||
fontWeight: reguler,
|
||||
fontSize: SizeConfig.blockHorizontal! * 2.7,
|
||||
),
|
||||
)
|
||||
else
|
||||
SizedBox.shrink(),
|
||||
SizedBox(height: getProportionateScreenHeight(2)),
|
||||
discountPrice != "0" && discountPrice != price
|
||||
? SizedBox()
|
||||
: SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: getProportionateScreenHeight(10)),
|
||||
Divider(color: fourthColor),
|
||||
SizedBox(height: getProportionateScreenHeight(5)),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user