step 27 : fix homescreen, report timestamp, filter history transaksi
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:app_petty_cash/screen/home/list_transaksi_home_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
@@ -140,6 +141,25 @@ class HomeScreen extends HookConsumerWidget {
|
||||
},
|
||||
);
|
||||
|
||||
String formatDateString(String inputDate) {
|
||||
try {
|
||||
// Parsing tanggal dari string input
|
||||
DateTime date =
|
||||
DateFormat('dd-MM-yyyy HH:mm:ss', 'id').parse(inputDate);
|
||||
|
||||
// Format tanggal ke '30 Des 2023'
|
||||
String formattedDate =
|
||||
DateFormat('dd MMM yyyy HH:mm:ss', 'id').format(date);
|
||||
|
||||
return formattedDate;
|
||||
} catch (e) {
|
||||
// Tangkap kesalahan jika format tanggal tidak sesuai
|
||||
print('Error parsing date: $e');
|
||||
// return 'Format Tanggal Salah';
|
||||
return inputDate;
|
||||
}
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualYPhone(context: context, y: 30),
|
||||
@@ -400,6 +420,60 @@ class HomeScreen extends HookConsumerWidget {
|
||||
.value[idx].tipe
|
||||
.toString(),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 10),
|
||||
),
|
||||
|
||||
// catatan
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
listTransaksiHome.value[idx].note
|
||||
.toString(),
|
||||
style: Constant.body1(
|
||||
context: context)
|
||||
.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 10),
|
||||
),
|
||||
|
||||
// Tanggal Created align right
|
||||
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'created : ' +
|
||||
formatDateString(
|
||||
listTransaksiHome
|
||||
.value[idx]
|
||||
.tanggalcreated
|
||||
.toString(),
|
||||
),
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
style: Constant.body1(
|
||||
context: context)
|
||||
.copyWith(
|
||||
fontWeight:
|
||||
FontWeight.normal,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Constant.textBlack,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user