step 17 : extract widget field row history transaksi
This commit is contained in:
@@ -23,6 +23,8 @@ class AuthRepository extends BaseRepository {
|
|||||||
// "doctor_id": "2891",
|
// "doctor_id": "2891",
|
||||||
// "password": "3"
|
// "password": "3"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
print(param);
|
||||||
// final service = "${Constant.baseUrlDevone}xauth/login";
|
// final service = "${Constant.baseUrlDevone}xauth/login";
|
||||||
final service = "${Constant.baseUrlDevone}auth/login";
|
final service = "${Constant.baseUrlDevone}auth/login";
|
||||||
print('url login $service');
|
print('url login $service');
|
||||||
|
|||||||
@@ -1,13 +1,31 @@
|
|||||||
import 'package:flutter/material.dart';
|
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/constant.dart';
|
||||||
|
import '../../app/route.dart';
|
||||||
|
import '../../provider/current_user_provider.dart';
|
||||||
import '../../widget/custom_drawer.dart';
|
import '../../widget/custom_drawer.dart';
|
||||||
|
|
||||||
class ChangeCompanyScreen extends StatelessWidget {
|
class ChangeCompanyScreen extends HookConsumerWidget {
|
||||||
const ChangeCompanyScreen({super.key});
|
const ChangeCompanyScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: Constant.getActualYPhone(context: context, y: 30),
|
top: Constant.getActualYPhone(context: context, y: 30),
|
||||||
|
|||||||
@@ -276,7 +276,8 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(states) => Colors.white),
|
(states) => Colors.white),
|
||||||
@@ -315,11 +316,11 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Constant.getActualXPhone(
|
width: Constant.getActualXPhone(
|
||||||
context: context, x: 8),
|
context: context, x: 6),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Download Report (xls) ',
|
'Excel',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
@@ -329,8 +330,9 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
M_CompanyID = await getCompanyID();
|
M_CompanyID = await getCompanyID();
|
||||||
if(M_CompanyID == "0"){
|
if (M_CompanyID == "0") {
|
||||||
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
|
SanckbarWidget(
|
||||||
|
context, 'Invalid Company', snackbarType.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Awal
|
// Awal
|
||||||
@@ -359,9 +361,15 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
// https://devone.aplikasi.web.id/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=2023-11-01&PEndDate=2023-12-30&PCompanyID=0&username=adminsas%20&tm=1701327096267
|
// https://devone.aplikasi.web.id/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=2023-11-01&PEndDate=2023-12-30&PCompanyID=0&username=adminsas%20&tm=1701327096267
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
width: Constant.getActualXPhone(context: context, x: 10),
|
||||||
|
),
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
ElevatedButton(
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(st) => Constant.pcBtnBackgroundColor),
|
(st) => Constant.pcBtnBackgroundColor),
|
||||||
@@ -394,11 +402,11 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: Constant.getActualXPhone(
|
width: Constant.getActualXPhone(
|
||||||
context: context, x: 8),
|
context: context, x: 6),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Download Report (PDF)',
|
'PDF',
|
||||||
style: Constant.body1(context: context).copyWith(
|
style: Constant.body1(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Constant.white),
|
color: Constant.white),
|
||||||
@@ -407,8 +415,9 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
M_CompanyID = await getCompanyID();
|
M_CompanyID = await getCompanyID();
|
||||||
if(M_CompanyID == "0"){
|
if (M_CompanyID == "0") {
|
||||||
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
|
SanckbarWidget(
|
||||||
|
context, 'Invalid Company', snackbarType.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Awal
|
// Awal
|
||||||
@@ -436,6 +445,7 @@ class ReportScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,14 +1,33 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
import '../../app/constant.dart';
|
import '../../app/constant.dart';
|
||||||
|
import '../../app/route.dart';
|
||||||
|
import '../../provider/current_user_provider.dart';
|
||||||
import '../../widget/custom_drawer.dart';
|
import '../../widget/custom_drawer.dart';
|
||||||
|
import '../../widget/field_row_history_transaksi.dart';
|
||||||
|
|
||||||
class HistoryTransaksiScreen extends HookConsumerWidget {
|
class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||||
const HistoryTransaksiScreen({super.key});
|
const HistoryTransaksiScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
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(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: Constant.getActualYPhone(context: context, y: 30),
|
top: Constant.getActualYPhone(context: context, y: 30),
|
||||||
@@ -28,33 +47,74 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
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(
|
child: Container(
|
||||||
height: MediaQuery.of(context).size.height - 10,
|
height: MediaQuery.of(context).size.height - 10,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
// Card looping transaksi
|
||||||
Card(
|
Card(
|
||||||
margin: EdgeInsets.all(16.0),
|
margin: EdgeInsets.all(16.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: EdgeInsets.all(16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('Tipe Catatan: DEBIT'),
|
FieldRowHistoryTransaksi(
|
||||||
|
label: "Tipe",
|
||||||
|
value: "DEBIT",
|
||||||
|
),
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
Text('Tanggal: 15-12-2023'),
|
FieldRowHistoryTransaksi(
|
||||||
|
label: "Tanggal",
|
||||||
|
value: "15-12-2023",
|
||||||
|
),
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
Text('Nominal: 100.000'),
|
FieldRowHistoryTransaksi(
|
||||||
|
label: "Nominal",
|
||||||
|
value: "100.000",
|
||||||
|
),
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
Text('Kategori: Jumat Sehat'),
|
FieldRowHistoryTransaksi(
|
||||||
|
label: "Kategori",
|
||||||
|
value: "Jumat Sehat",
|
||||||
|
),
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
Chip(
|
Chip(
|
||||||
label: Text('Verify'),
|
label: Text(
|
||||||
backgroundColor: Constant.green_600,
|
'Verify',
|
||||||
labelStyle: TextStyle(color: Colors.white),
|
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(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@@ -64,9 +124,7 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Delete',
|
'Delete',
|
||||||
style: TextStyle(
|
style: TextStyle(color: Constant.textWhite),
|
||||||
color: Constant.textWhite
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors
|
backgroundColor: Colors
|
||||||
|
|||||||
42
app_petty_cash/lib/widget/field_row_history_transaksi.dart
Normal file
42
app_petty_cash/lib/widget/field_row_history_transaksi.dart
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
|
import '../app/constant.dart';
|
||||||
|
|
||||||
|
class FieldRowHistoryTransaksi extends HookConsumerWidget {
|
||||||
|
final String label;
|
||||||
|
final String value;
|
||||||
|
const FieldRowHistoryTransaksi({
|
||||||
|
Key? key,
|
||||||
|
required this.label,
|
||||||
|
required this.value,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 10),
|
||||||
|
child: SizedBox(
|
||||||
|
width: Constant.getActualXPhone(context: context, x: 100),
|
||||||
|
child: Text(label),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Text(':'),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(right: 10),
|
||||||
|
child: Text(
|
||||||
|
value,
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user