update syntax to repair overflow error

This commit is contained in:
kicap
2023-08-18 02:30:56 +08:00
parent 7a66245b7e
commit 64668289d7
174 changed files with 534 additions and 302 deletions

View File

@ -19,7 +19,7 @@ class OtherFunction {
String timeStampConverter(int timeStamp) {
DateTime date = DateTime.fromMillisecondsSinceEpoch(timeStamp * 1000);
// day name, date and hours with am/pm
String formattedDate = DateFormat('EEEE, d MM-yyyy | HH:mm a').format(date);
String formattedDate = DateFormat('EE, d MM-yyyy | HH:mm a').format(date);
return formattedDate;
}
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stacked/stacked.dart';
import '../../../../app/themes/app_colors.dart';
@ -58,285 +59,314 @@ class TheDataWidget extends ViewModelWidget<CustomCurrencyViewModel> {
@override
Widget build(BuildContext context, CustomCurrencyViewModel viewModel) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 15,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
color: Colors.grey,
width: 2,
),
boxShadow: const [
BoxShadow(
return SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 15,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
color: Colors.grey,
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3), // changes position of shadow
width: 2,
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.asset(
'assets/flags/${viewModel.currencyInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 100,
height: 100,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return const Icon(Icons.error);
},
),
),
),
const SizedBox(
width: 10,
),
const Icon(
Icons.arrow_forward,
size: 30,
),
const SizedBox(
width: 10,
),
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
color: Colors.grey,
width: 2,
),
boxShadow: const [
BoxShadow(
color: Colors.grey,
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3), // changes position of shadow
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.asset(
'assets/flags/${viewModel.konversiInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 100,
height: 100,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return const Icon(Icons.error);
},
),
),
),
],
),
const SizedBox(
height: 20,
),
Card(
elevation: 5,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
text: 'Terakhir diperbarui : ',
style: regularTextStyle,
children: [
TextSpan(
text: viewModel.otherFunction.timeStampConverter(
viewModel
.conversionResultModel!.timeLastUpdateUnix!),
style: boldTextStyle.copyWith(
color: greenColor,
fontSize: 12,
),
),
],
),
),
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Update berikutnya : ',
style: regularTextStyle,
children: [
TextSpan(
text: viewModel.otherFunction.timeStampConverter(
viewModel
.conversionResultModel!.timeNextUpdateUnix!),
style: boldTextStyle.copyWith(
color: mainColor,
fontSize: 12,
),
),
],
),
),
const SizedBox(
height: 15,
),
Row(
children: [
const Text('Mata Uang : ', style: regularTextStyle),
const SizedBox(
width: 3,
),
Image.asset(
'assets/flags/${viewModel.currencyInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 30,
height: 30,
),
const SizedBox(
width: 5,
),
Text(
viewModel.currencyInfoModel!.entity!,
style: boldTextStyle.copyWith(
color: redColor,
),
),
const SizedBox(
width: 3,
),
Text(
'( ${viewModel.currencyInfoModel!.alphabeticCode} )',
style: italicTextStyle.copyWith(
color: redColor,
),
boxShadow: const [
BoxShadow(
color: Colors.grey,
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3), // changes position of shadow
),
],
),
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Jumlah Tukaran : ',
style: regularTextStyle,
children: [
TextSpan(
text:
'${viewModel.currencyInfoModel!.alphabeticCode} ${viewModel.otherFunction.commaFormat(int.parse(viewModel.nilaiTukaran!))}',
style: boldTextStyle.copyWith(
color: redColor,
),
),
],
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: SvgPicture.asset(
'assets/flags_svg/${viewModel.currencyInfoModel!.alphabeticCode!.toLowerCase()}.svg',
width: 100,
height: 100,
fit: BoxFit.cover,
placeholderBuilder: (context) {
return const Center(
child: CircularProgressIndicator(),
);
},
),
),
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Konversi Tukaran : ',
style: regularTextStyle,
children: [
TextSpan(
text:
'1 ${viewModel.currencyInfoModel!.alphabeticCode}',
style: boldTextStyle.copyWith(
color: redColor,
),
),
const TextSpan(
text: ' = ',
style: regularTextStyle,
),
TextSpan(
text:
'${viewModel.conversionResultModel!.conversionRate} ${viewModel.konversiInfoModel!.alphabeticCode}',
style: boldTextStyle.copyWith(
color: orangeColor,
),
),
],
),
const SizedBox(
width: 10,
),
const Icon(
Icons.arrow_forward,
size: 30,
),
const SizedBox(
width: 10,
),
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
color: Colors.grey,
width: 2,
),
),
const SizedBox(
height: 15,
),
Row(
children: [
const Text('Uang Konversi: ', style: regularTextStyle),
const SizedBox(
width: 3,
),
Image.asset(
'assets/flags/${viewModel.konversiInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 30,
height: 30,
),
const SizedBox(
width: 5,
),
Text(
viewModel.konversiInfoModel!.entity!,
style: boldTextStyle.copyWith(
color: orangeColor,
),
),
const SizedBox(
width: 3,
),
Text(
'( ${viewModel.konversiInfoModel!.alphabeticCode} )',
style: italicTextStyle.copyWith(
color: orangeColor,
),
boxShadow: const [
BoxShadow(
color: Colors.grey,
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 3), // changes position of shadow
),
],
),
const SizedBox(
height: 15,
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: SvgPicture.asset(
'assets/flags_svg/${viewModel.konversiInfoModel!.alphabeticCode!.toLowerCase()}.svg',
width: 100,
height: 100,
fit: BoxFit.cover,
placeholderBuilder: (context) {
return const Center(
child: CircularProgressIndicator(),
);
},
),
),
RichText(
text: TextSpan(
text: 'Nilai Konversi : ',
style: regularTextStyle,
),
],
),
const SizedBox(
height: 20,
),
Card(
elevation: 10,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
text: 'Terakhir diperbarui : ',
style: regularTextStyle,
children: [
TextSpan(
text: viewModel.otherFunction.timeStampConverter(
viewModel
.conversionResultModel!.timeLastUpdateUnix!),
style: boldTextStyle.copyWith(
color: greenColor,
fontSize: 12,
),
),
],
),
),
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Update berikutnya : ',
style: regularTextStyle,
children: [
TextSpan(
text: viewModel.otherFunction.timeStampConverter(
viewModel
.conversionResultModel!.timeNextUpdateUnix!),
style: boldTextStyle.copyWith(
color: mainColor,
fontSize: 12,
),
),
],
),
),
const SizedBox(
height: 15,
),
Row(
children: [
TextSpan(
text:
'${viewModel.konversiInfoModel!.alphabeticCode} ${viewModel.conversionResultModel!.conversionResult}',
style: boldTextStyle.copyWith(
color: orangeColor,
const Text('Mata Uang : ', style: regularTextStyle),
const SizedBox(
width: 3,
),
Image.asset(
'assets/flags/${viewModel.currencyInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 30,
height: 30,
errorBuilder: (context, error, stackTrace) {
return const Icon(
Icons.error,
color: redColor,
);
},
),
const SizedBox(
width: 5,
),
Expanded(
child: Text(
viewModel.currencyInfoModel!.entity!,
style: boldTextStyle.copyWith(
color: redColor,
),
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(
width: 3,
),
Expanded(
child: Text(
'( ${viewModel.currencyInfoModel!.alphabeticCode} )',
style: italicTextStyle.copyWith(
color: redColor,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
),
],
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Jumlah Tukaran : ',
style: regularTextStyle,
children: [
TextSpan(
text:
'${viewModel.currencyInfoModel!.alphabeticCode} ${viewModel.otherFunction.commaFormat(int.parse(viewModel.nilaiTukaran!))}',
style: boldTextStyle.copyWith(
color: redColor,
),
),
],
),
),
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Konversi Tukaran : ',
style: regularTextStyle,
children: [
TextSpan(
text:
'1 ${viewModel.currencyInfoModel!.alphabeticCode}',
style: boldTextStyle.copyWith(
color: redColor,
),
),
const TextSpan(
text: ' = ',
style: regularTextStyle,
),
TextSpan(
text:
'${viewModel.conversionResultModel!.conversionRate} ${viewModel.konversiInfoModel!.alphabeticCode}',
style: boldTextStyle.copyWith(
color: orangeColor,
),
),
],
),
),
const SizedBox(
height: 15,
),
Row(
children: [
const Text('Uang Konversi: ', style: regularTextStyle),
const SizedBox(
width: 3,
),
Image.asset(
'assets/flags/${viewModel.konversiInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 30,
height: 30,
errorBuilder: (context, error, stackTrace) => Icon(
Icons.error,
color: orangeColor,
size: 30,
),
),
const SizedBox(
width: 5,
),
Expanded(
child: Text(
viewModel.konversiInfoModel!.entity!,
style: boldTextStyle.copyWith(
color: orangeColor,
),
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(
width: 3,
),
Expanded(
child: Text(
'( ${viewModel.konversiInfoModel!.alphabeticCode} )',
style: italicTextStyle.copyWith(
color: orangeColor,
),
overflow: TextOverflow.ellipsis,
),
),
],
),
const SizedBox(
height: 15,
),
RichText(
text: TextSpan(
text: 'Nilai Konversi : ',
style: regularTextStyle,
children: [
TextSpan(
text:
'${viewModel.konversiInfoModel!.alphabeticCode} ${viewModel.conversionResultModel!.conversionResult}',
style: boldTextStyle.copyWith(
color: orangeColor,
),
),
],
),
),
],
),
),
),
),
const SizedBox(
height: 15,
),
const Center(
child: Text(
'Sila Klik Icon Untuk\nKonversi Tukaran Mata Uang',
textAlign: TextAlign.center,
const SizedBox(
height: 15,
),
),
],
const Center(
child: Text(
'Sila Klik Icon Untuk\nKonversi Tukaran Mata Uang',
textAlign: TextAlign.center,
),
),
],
),
);
}
}

View File

@ -45,23 +45,32 @@ class KonversiDialogViewModel extends CustomBaseViewModel {
Image.asset(
'assets/flags/${allInfoModel.alphabeticCode!.toLowerCase()}.png',
width: 30,
errorBuilder: (context, error, stackTrace) {
return const Icon(
Icons.error,
color: redColor,
);
},
),
const SizedBox(width: 15),
RichText(
text: TextSpan(
text: allInfoModel.entity,
style: regularTextStyle.copyWith(
color: greenColor,
),
children: [
TextSpan(
text: ' (${allInfoModel.alphabeticCode})',
style: italicTextStyle.copyWith(
color: greenColor,
),
),
],
)),
Expanded(
child: RichText(
overflow: TextOverflow.ellipsis,
text: TextSpan(
text: allInfoModel.entity,
style: regularTextStyle.copyWith(
color: greenColor,
),
children: [
TextSpan(
text: ' (${allInfoModel.alphabeticCode})',
style: italicTextStyle.copyWith(
color: greenColor,
),
),
],
)),
),
],
);
} else {
@ -74,34 +83,35 @@ class KonversiDialogViewModel extends CustomBaseViewModel {
// hintText = 'Tukaran ${allInfoModel.alphabeticCode}';
konversiWidget = Row(
children: [
res.data == 'all'
? const Icon(
Icons.all_inclusive,
color: redColor,
)
: Image.asset(
'assets/flags/${allInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 30,
),
Image.asset(
'assets/flags/${allInfoModel!.alphabeticCode!.toLowerCase()}.png',
width: 30,
errorBuilder: (context, error, stackTrace) {
return const Icon(
Icons.error,
color: redColor,
);
},
),
const SizedBox(width: 15),
RichText(
text: TextSpan(
text:
res.data == 'all' ? 'Semua Mata Uang' : allInfoModel!.entity,
style: regularTextStyle.copyWith(
color: redColor,
),
children: [
TextSpan(
text: res.data == 'all'
? '*'
: ' (${allInfoModel!.alphabeticCode})',
style: italicTextStyle.copyWith(
color: redColor,
),
),
],
)),
Expanded(
child: RichText(
overflow: TextOverflow.ellipsis,
text: TextSpan(
text: allInfoModel.entity,
style: regularTextStyle.copyWith(
color: greenColor,
),
children: [
TextSpan(
text: ' (${allInfoModel.alphabeticCode})',
style: italicTextStyle.copyWith(
color: greenColor,
),
),
],
)),
),
],
);
}