step 8 : add ui homescreen
This commit is contained in:
25
lib/widget/real_date.dart
Normal file
25
lib/widget/real_date.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:absensi_sas_flutter/app/constant.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
||||
class RealTimeFormattedDate extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final currentTime = useState<DateTime>(DateTime.now());
|
||||
|
||||
// Format waktu menjadi tanggal yang diinginkan
|
||||
String formattedDate =
|
||||
DateFormat('EEEE, d MMMM y', 'id_ID').format(currentTime.value);
|
||||
|
||||
// Tampilkan widget Text dengan tanggal yang diformat
|
||||
return Text(
|
||||
formattedDate,
|
||||
style: Constant.date_600(context: context)
|
||||
.copyWith(color: Constant.textBlack),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user