step 17 : extract widget field row history transaksi
This commit is contained in:
@@ -1,14 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../app/route.dart';
|
||||
import '../../provider/current_user_provider.dart';
|
||||
import '../../widget/custom_drawer.dart';
|
||||
import '../../widget/field_row_history_transaksi.dart';
|
||||
|
||||
class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
const HistoryTransaksiScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
||||
if (userID == "0") {
|
||||
//not login
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil(loginRoute, (route) => true);
|
||||
|
||||
// Navigator.popAndPushNamed(context, loginRoute);
|
||||
return;
|
||||
}
|
||||
});
|
||||
return () {};
|
||||
}, []);
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualYPhone(context: context, y: 30),
|
||||
@@ -28,33 +47,74 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualYPhone(context: context, y: 10),
|
||||
left: Constant.getActualXPhone(context: context, x: 8),
|
||||
right: Constant.getActualXPhone(context: context, x: 8),
|
||||
),
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height - 10,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Card looping transaksi
|
||||
Card(
|
||||
margin: EdgeInsets.all(16.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Tipe Catatan: DEBIT'),
|
||||
FieldRowHistoryTransaksi(
|
||||
label: "Tipe",
|
||||
value: "DEBIT",
|
||||
),
|
||||
SizedBox(height: 8.0),
|
||||
Text('Tanggal: 15-12-2023'),
|
||||
FieldRowHistoryTransaksi(
|
||||
label: "Tanggal",
|
||||
value: "15-12-2023",
|
||||
),
|
||||
SizedBox(height: 8.0),
|
||||
Text('Nominal: 100.000'),
|
||||
FieldRowHistoryTransaksi(
|
||||
label: "Nominal",
|
||||
value: "100.000",
|
||||
),
|
||||
SizedBox(height: 8.0),
|
||||
Text('Kategori: Jumat Sehat'),
|
||||
FieldRowHistoryTransaksi(
|
||||
label: "Kategori",
|
||||
value: "Jumat Sehat",
|
||||
),
|
||||
SizedBox(height: 8.0),
|
||||
Chip(
|
||||
label: Text('Verify'),
|
||||
backgroundColor: Constant.green_600,
|
||||
labelStyle: TextStyle(color: Colors.white),
|
||||
label: Text(
|
||||
'Verify',
|
||||
style: TextStyle(color: Constant.green_600),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Constant.green_600,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 6),
|
||||
),
|
||||
Chip(
|
||||
label: Text(
|
||||
'Not Verify',
|
||||
style: TextStyle(color: Constant.textGreyv2),
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(4.0),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
@@ -64,9 +124,7 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
child: Text(
|
||||
'Delete',
|
||||
style: TextStyle(
|
||||
color: Constant.textWhite
|
||||
),
|
||||
style: TextStyle(color: Constant.textWhite),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors
|
||||
|
||||
Reference in New Issue
Block a user