Compare commits
3 Commits
step/impro
...
add-homepa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc41ad389c | ||
|
|
150046115d | ||
|
|
4bfb4f5e8c |
BIN
app_petty_cash/images/background_card.png
Normal file
BIN
app_petty_cash/images/background_card.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.0 KiB |
BIN
app_petty_cash/images/pizza_icon.png
Normal file
BIN
app_petty_cash/images/pizza_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -535,6 +535,14 @@ class Constant {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//homepage
|
||||||
|
static TextStyle titleH6_700({required BuildContext context}) {
|
||||||
|
return TextStyle(
|
||||||
|
fontSize: Constant.getActualYPhone(context: context, y: 18),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// pendaftaran pasien
|
// pendaftaran pasien
|
||||||
static TextStyle titleH5_600({required BuildContext context}) {
|
static TextStyle titleH5_600({required BuildContext context}) {
|
||||||
return TextStyle(
|
return TextStyle(
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:app_petty_cash/screen/home/homepage_screen.dart';
|
||||||
|
|
||||||
import '../screen/change_company/change_company.dart';
|
import '../screen/change_company/change_company.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@@ -98,7 +100,8 @@ class AppRoute {
|
|||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
child: HomeScreen(),
|
// child: HomeScreen(),
|
||||||
|
child: HomePageScreen(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,12 @@ class MyApp extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
initialRoute: loginRoute,
|
// initialRoute: loginRoute,
|
||||||
// initialRoute: splashScreen,
|
// initialRoute: splashScreen,
|
||||||
// initialRoute: transaksiRoute,
|
// initialRoute: transaksiRoute,
|
||||||
// initialRoute: reportRoute,
|
// initialRoute: reportRoute,
|
||||||
// initialRoute: testFilePickerRoute,
|
// initialRoute: testFilePickerRoute,
|
||||||
|
initialRoute: homeRoute,
|
||||||
onGenerateRoute: AppRoute.generateRoute,
|
onGenerateRoute: AppRoute.generateRoute,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,34 +121,4 @@ class TransaksiRepository extends BaseRepository {
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete transaksi
|
|
||||||
Future<String> deleteTransaksi(
|
|
||||||
String id,
|
|
||||||
String userid,
|
|
||||||
) async {
|
|
||||||
|
|
||||||
final service =
|
|
||||||
"${Constant.baseUrlDevone}transaction/deletetransaction/?id=$id&userid=$userid";
|
|
||||||
final resp = await get(
|
|
||||||
// param: {
|
|
||||||
// "": "",
|
|
||||||
// },
|
|
||||||
service: service,
|
|
||||||
);
|
|
||||||
|
|
||||||
print("url delete transaksi : $service");
|
|
||||||
|
|
||||||
// final result = List<ListCategory>.empty(growable: true);
|
|
||||||
// resp['data'].forEach((e) {
|
|
||||||
// final model = ListCategory.fromJson(e);
|
|
||||||
// result.add(model);
|
|
||||||
// });
|
|
||||||
|
|
||||||
if(resp['status'] != "OK"){
|
|
||||||
return resp['message'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp['status'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
279
app_petty_cash/lib/screen/home/homepage_screen.dart
Normal file
279
app_petty_cash/lib/screen/home/homepage_screen.dart
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
import 'package:app_petty_cash/model/history_transaksi_model.dart';
|
||||||
|
import 'package:app_petty_cash/widget/homepage_row_transaksi.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/route.dart';
|
||||||
|
import '../../provider/current_user_provider.dart';
|
||||||
|
import '../../widget/custom_drawer.dart';
|
||||||
|
|
||||||
|
class HomePageScreen extends HookConsumerWidget {
|
||||||
|
const HomePageScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final listSearchHistory = useState<List<HistoryTransaksiModel>>(
|
||||||
|
List.empty(
|
||||||
|
growable: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
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 Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(
|
||||||
|
'Home Screen',
|
||||||
|
style: TextStyle(color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
backgroundColor: Constant.pcBtnBackgroundColor,
|
||||||
|
iconTheme: IconThemeData(
|
||||||
|
color: Constant.textWhite,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
drawer: CustomDrawer(),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: Constant.getActualYPhone(context: context, y: 36),
|
||||||
|
left: Constant.getActualXPhone(context: context, x: 34),
|
||||||
|
right: Constant.getActualXPhone(context: context, x: 34),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
width: Constant.getActualXPhone(context: context, x: 390),
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 844),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: Constant.getActualXPhone(context: context, x: 332),
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 173),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
// color: Colors.black12,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('images/background_card.png'),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Color.fromRGBO(145, 158, 171, 0.16),
|
||||||
|
offset: Offset(0, 24),
|
||||||
|
blurRadius: 48,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
//Isi Card
|
||||||
|
child: Container(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
// Text1 & Text2
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: Constant.getActualYPhone(
|
||||||
|
context: context, y: 17),
|
||||||
|
left: Constant.getActualXPhone(
|
||||||
|
context: context, x: 81),
|
||||||
|
right: Constant.getActualXPhone(
|
||||||
|
context: context, x: 81),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Account Balance',
|
||||||
|
style: Constant.body1(context: context)
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Rp. 1,440,000',
|
||||||
|
style: Constant.H4_700V2(context: context)
|
||||||
|
.copyWith(
|
||||||
|
fontSize: Constant.getActualYPhone(
|
||||||
|
context: context, y: 24),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(
|
||||||
|
context: context, y: 27),
|
||||||
|
),
|
||||||
|
|
||||||
|
//Debit dan Kredit
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment
|
||||||
|
.center, // Menengahkan secara horizontal
|
||||||
|
children: [
|
||||||
|
// Spasi di sebelah kiri "Check In"
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: Constant.getActualXPhone(
|
||||||
|
context: context, x: 20),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Debit',
|
||||||
|
style: Constant.body1(context: context)
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Rp. 2,000,000',
|
||||||
|
style: Constant.titleH6_700(
|
||||||
|
context: context)
|
||||||
|
.copyWith(
|
||||||
|
color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
width: Constant.getActualXPhone(
|
||||||
|
context: context, x: 51),
|
||||||
|
),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
right: Constant.getActualXPhone(
|
||||||
|
context: context, x: 28),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Credit',
|
||||||
|
style: Constant.body1(context: context)
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Rp. 560,000',
|
||||||
|
style: Constant.titleH6_700(
|
||||||
|
context: context)
|
||||||
|
.copyWith(
|
||||||
|
color: Constant.textWhite),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(
|
||||||
|
context: context, y: 17),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//Card
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 36),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 44),
|
||||||
|
),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: Constant.getActualXPhone(context: context, x: 20),
|
||||||
|
right: Constant.getActualXPhone(context: context, x: 20),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
// color: Colors.amber,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
|
||||||
|
child: Column(children: [
|
||||||
|
Text(
|
||||||
|
'Transaksi Terkini',
|
||||||
|
style: Constant.titleH5_600(context: context)
|
||||||
|
.copyWith(color: Constant.textBlack),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height:
|
||||||
|
Constant.getActualYPhone(context: context, y: 24),
|
||||||
|
),
|
||||||
|
// Expanded(
|
||||||
|
// child: ListView.builder(
|
||||||
|
// itemCount: listSearchHistory.value.length,
|
||||||
|
// itemBuilder: (context, idx) {
|
||||||
|
// return Padding(
|
||||||
|
// padding: EdgeInsets.only(
|
||||||
|
// bottom: Constant.getActualYPhone(
|
||||||
|
// context: context,
|
||||||
|
// y: 10,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// child: Card(
|
||||||
|
// elevation: 2.0,
|
||||||
|
// child: Padding(
|
||||||
|
// padding: EdgeInsets.all(10),
|
||||||
|
// child: Column(
|
||||||
|
// // crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// // mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
// // atas
|
||||||
|
// HomepageRowTransaksiWidget(
|
||||||
|
// icon_category_id: listSearchHistory
|
||||||
|
// .value[idx].kategoriid
|
||||||
|
// .toString(),
|
||||||
|
// icon_category_name: listSearchHistory
|
||||||
|
// .value[idx].kategoriname
|
||||||
|
// .toString(),
|
||||||
|
// amount: listSearchHistory
|
||||||
|
// .value[idx].amount
|
||||||
|
// .toString(),
|
||||||
|
// tglTransaksi: listSearchHistory
|
||||||
|
// .value[idx].tanggaltransaksi
|
||||||
|
// .toString(),
|
||||||
|
// tipe: listSearchHistory.value[idx].tipe
|
||||||
|
// .toString(),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
||||||
|
|
||||||
import '../../repository/transaksi_repository.dart';
|
|
||||||
import '../../provider/dio_provider.dart';
|
|
||||||
import '../../repository/base_repository.dart';
|
|
||||||
import 'search_history_transaksi_provider.dart';
|
|
||||||
|
|
||||||
abstract class DeleteTransaksiState extends Equatable {
|
|
||||||
final DateTime date;
|
|
||||||
const DeleteTransaksiState(this.date);
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [date];
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeleteTransaksiStateInit extends DeleteTransaksiState {
|
|
||||||
DeleteTransaksiStateInit() : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeleteTransaksiStateLoading extends DeleteTransaksiState {
|
|
||||||
DeleteTransaksiStateLoading() : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeleteTransaksiStateError extends DeleteTransaksiState {
|
|
||||||
final String message;
|
|
||||||
DeleteTransaksiStateError({
|
|
||||||
required this.message,
|
|
||||||
}) : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeleteTransaksiStateDone extends DeleteTransaksiState {
|
|
||||||
// final List<ListType> model;
|
|
||||||
final String resp;
|
|
||||||
DeleteTransaksiStateDone({
|
|
||||||
required this.resp,
|
|
||||||
}) : super(DateTime.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
//notifier
|
|
||||||
class DeleteTransaksiNotifier extends StateNotifier<DeleteTransaksiState> {
|
|
||||||
final Ref ref;
|
|
||||||
DeleteTransaksiNotifier({
|
|
||||||
required this.ref,
|
|
||||||
}) : super(DeleteTransaksiStateInit());
|
|
||||||
|
|
||||||
void deleteTransaksi(
|
|
||||||
String id,
|
|
||||||
String userid,
|
|
||||||
String companyid,
|
|
||||||
String tglAwal,
|
|
||||||
String tglAkhir,
|
|
||||||
String categoryid,
|
|
||||||
) async {
|
|
||||||
try {
|
|
||||||
state = DeleteTransaksiStateLoading();
|
|
||||||
final dio = ref.read(dioProvider);
|
|
||||||
final resp = await TransaksiRepository(dio: dio).deleteTransaksi(
|
|
||||||
id,
|
|
||||||
userid,
|
|
||||||
);
|
|
||||||
state = DeleteTransaksiStateDone(resp: resp);
|
|
||||||
|
|
||||||
// search lagi buat get data
|
|
||||||
ref.read(searchHistoryTransaksiProvider.notifier).searchHistoryTransaksi(
|
|
||||||
companyid,
|
|
||||||
tglAwal,
|
|
||||||
tglAkhir,
|
|
||||||
categoryid,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
if (e is BaseRepositoryException) {
|
|
||||||
state = DeleteTransaksiStateError(message: e.message.toString());
|
|
||||||
} else {
|
|
||||||
state = DeleteTransaksiStateError(message: e.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//provider
|
|
||||||
final deleteTransaksiProvider =
|
|
||||||
StateNotifierProvider<DeleteTransaksiNotifier, DeleteTransaksiState>(
|
|
||||||
(ref) => DeleteTransaksiNotifier(ref: ref),
|
|
||||||
);
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:app_petty_cash/screen/transaksi/delete_transaksi_provider.dart';
|
|
||||||
import 'package:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
|
import 'package:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
|
||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -42,8 +41,7 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// String M_CompanyID = "0";
|
String M_CompanyID = "0";
|
||||||
final M_CompanyID = useState<String>("0");
|
|
||||||
String formattedDate = DateFormat('dd-MM-yyyy').format(DateTime.now());
|
String formattedDate = DateFormat('dd-MM-yyyy').format(DateTime.now());
|
||||||
final ctrlTglAwal = useTextEditingController(text: formattedDate);
|
final ctrlTglAwal = useTextEditingController(text: formattedDate);
|
||||||
|
|
||||||
@@ -140,27 +138,6 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// delete transaksi
|
|
||||||
ref.listen(
|
|
||||||
deleteTransaksiProvider,
|
|
||||||
(previous, next) {
|
|
||||||
if (next is DeleteTransaksiStateLoading) {
|
|
||||||
searchHistoryIsLoading.value = true;
|
|
||||||
} else if (next is DeleteTransaksiStateError) {
|
|
||||||
// print(next.message);
|
|
||||||
searchHistoryIsLoading.value = false;
|
|
||||||
SanckbarWidget(context, next.message, snackbarType.error);
|
|
||||||
} else if (next is DeleteTransaksiStateDone) {
|
|
||||||
// print(jsonEncode(next.model));
|
|
||||||
// print(next.model.length);
|
|
||||||
// listSearchHistory.value = next.model;
|
|
||||||
SanckbarWidget(
|
|
||||||
context, 'Data Berhasil Dihapus', snackbarType.success);
|
|
||||||
searchHistoryIsLoading.value = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Future<String> getCompanyID() async {
|
Future<String> getCompanyID() async {
|
||||||
final shared = await SharedPreferences.getInstance();
|
final shared = await SharedPreferences.getInstance();
|
||||||
String M_CompanyID = "0";
|
String M_CompanyID = "0";
|
||||||
@@ -203,7 +180,7 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
// list category provider
|
// list category provider
|
||||||
ref.read(listCategoryProvider.notifier).getListCategory();
|
ref.read(listCategoryProvider.notifier).getListCategory();
|
||||||
|
|
||||||
M_CompanyID.value = await getCompanyID();
|
M_CompanyID = await getCompanyID();
|
||||||
|
|
||||||
DateTime parsedDate = DateFormat('dd-MM-yyyy').parse(
|
DateTime parsedDate = DateFormat('dd-MM-yyyy').parse(
|
||||||
ctrlTglAwal.value.text.toString(),
|
ctrlTglAwal.value.text.toString(),
|
||||||
@@ -222,100 +199,11 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
ref
|
ref
|
||||||
.read(searchHistoryTransaksiProvider.notifier)
|
.read(searchHistoryTransaksiProvider.notifier)
|
||||||
.searchHistoryTransaksi(
|
.searchHistoryTransaksi(
|
||||||
M_CompanyID.value,
|
M_CompanyID, formattedDateAwal, formattedDateAkhir, categoryid);
|
||||||
formattedDateAwal,
|
|
||||||
formattedDateAkhir,
|
|
||||||
categoryid,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
return () {};
|
return () {};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// delete alert
|
|
||||||
Future<void> showDeleteConfirmationDialog(
|
|
||||||
BuildContext context,
|
|
||||||
String id,
|
|
||||||
String userid,
|
|
||||||
String companyid,
|
|
||||||
String tglAwal,
|
|
||||||
String tglAkhir,
|
|
||||||
String categoryid,
|
|
||||||
) async {
|
|
||||||
return showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text('Konfirmasi Hapus'),
|
|
||||||
content: Text('Apakah anda yakin menghapus data ini?'),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop(); // Tutup dialog
|
|
||||||
},
|
|
||||||
child: Text('Batal'),
|
|
||||||
),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
print('Deleted id $id , userid $userid');
|
|
||||||
DateTime parsedDate = DateFormat('dd-MM-yyyy').parse(
|
|
||||||
ctrlTglAwal.value.text.toString(),
|
|
||||||
);
|
|
||||||
String formattedDateAwal =
|
|
||||||
DateFormat('yyyy-MM-dd').format(parsedDate);
|
|
||||||
|
|
||||||
DateTime parsedDateAkhir = DateFormat('dd-MM-yyyy').parse(
|
|
||||||
ctrlTglAkhir.value.text.toString(),
|
|
||||||
);
|
|
||||||
String formattedDateAkhir =
|
|
||||||
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
|
|
||||||
ref.read(deleteTransaksiProvider.notifier).deleteTransaksi(
|
|
||||||
id,
|
|
||||||
userid,
|
|
||||||
companyid,
|
|
||||||
formattedDateAwal,
|
|
||||||
formattedDateAkhir,
|
|
||||||
categoryid,
|
|
||||||
);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'Hapus Data',
|
|
||||||
style: Constant.body1_600(context: context).copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: Constant.textWhite,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor:
|
|
||||||
MaterialStateColor.resolveWith((st) => Constant.textRed),
|
|
||||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
|
||||||
RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
side: BorderSide(
|
|
||||||
color: Constant.textRed,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
|
|
||||||
elevation: MaterialStateProperty.all(4.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _closeKeyboard() {
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
final FocusNode focusNodetglAwal = useFocusNode();
|
|
||||||
final tglAwalHasFocus = useState(false);
|
|
||||||
|
|
||||||
final FocusNode focusNodetglAkhir = useFocusNode();
|
|
||||||
final tglAkhirHasFocus = useState(false);
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: Constant.getActualYPhone(context: context, y: 30),
|
top: Constant.getActualYPhone(context: context, y: 30),
|
||||||
@@ -350,91 +238,80 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
// Tanggal Awal
|
// Tanggal Awal
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: TextField(
|
||||||
onTap: () {
|
controller: ctrlTglAwal,
|
||||||
focusNodetglAwal.unfocus();
|
decoration: InputDecoration(
|
||||||
// _closeKeyboard();
|
hintStyle:
|
||||||
},
|
Constant.body2_400(context: context).copyWith(
|
||||||
child: TextField(
|
color: Constant.textGreyv2,
|
||||||
enableInteractiveSelection: false,
|
|
||||||
showCursor: (tglAwalHasFocus.value) ? true : false,
|
|
||||||
controller: ctrlTglAwal,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
labelStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
labelText: "Tanggal Awal",
|
|
||||||
hintText: 'Tanggal Awal',
|
|
||||||
// suffixIcon: isLoadingFilterScope.value
|
|
||||||
// ? SizedBox(
|
|
||||||
// width: Constant.getActualXPhone(
|
|
||||||
// context: context,
|
|
||||||
// x: 4,
|
|
||||||
// ),
|
|
||||||
// height: Constant.getActualYPhone(
|
|
||||||
// context: context,
|
|
||||||
// y: 4,
|
|
||||||
// ),
|
|
||||||
// child: CircularProgressIndicator(
|
|
||||||
// color: Constant.textRed,
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// : Icon(
|
|
||||||
// Icons.calendar_month_sharp,
|
|
||||||
// color: Constant.colorIconDate,
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
onTap: () async {
|
labelStyle:
|
||||||
final selectedDateAwal = await showDatePicker(
|
Constant.body2_400(context: context).copyWith(
|
||||||
// locale: const Locale("en-CA"),
|
color: Constant.textGreyv2,
|
||||||
// locale: ,
|
),
|
||||||
context: context,
|
border: OutlineInputBorder(
|
||||||
initialEntryMode:
|
borderSide: BorderSide(
|
||||||
DatePickerEntryMode.calendarOnly,
|
color: Colors.orange,
|
||||||
firstDate: DateTime(2000),
|
width: 1,
|
||||||
lastDate: DateTime(2100),
|
),
|
||||||
|
),
|
||||||
initialDate: (ctrlTglAwal.text.isEmpty)
|
focusedBorder: OutlineInputBorder(
|
||||||
? DateTime.now()
|
borderSide: BorderSide(
|
||||||
: tglAwal.value,
|
color: Constant.textGreyv2,
|
||||||
);
|
width: 1,
|
||||||
|
),
|
||||||
if (selectedDateAwal != null) {
|
),
|
||||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
labelText: "Tanggal Awal",
|
||||||
.format(selectedDateAwal);
|
hintText: 'Tanggal Awal',
|
||||||
// ctrlTglAwal.text =
|
// suffixIcon: isLoadingFilterScope.value
|
||||||
// selectedDateAwal.toString().split(' ')[0];
|
// ? SizedBox(
|
||||||
ctrlTglAwal.text = formattedDate;
|
// width: Constant.getActualXPhone(
|
||||||
tglAwal.value = selectedDateAwal;
|
// context: context,
|
||||||
tglAwalTmp.value = selectedDateAwal.toString();
|
// x: 4,
|
||||||
}
|
// ),
|
||||||
|
// height: Constant.getActualYPhone(
|
||||||
if (selectedDateAwal == null) {
|
// context: context,
|
||||||
print('cancel button');
|
// y: 4,
|
||||||
return;
|
// ),
|
||||||
}
|
// child: CircularProgressIndicator(
|
||||||
|
// color: Constant.textRed,
|
||||||
// focusNodetglAwal.unfocus();
|
// ),
|
||||||
// _closeKeyboard();
|
// )
|
||||||
},
|
// : Icon(
|
||||||
|
// Icons.calendar_month_sharp,
|
||||||
|
// color: Constant.colorIconDate,
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
|
onTap: () async {
|
||||||
|
final selectedDateAwal = await showDatePicker(
|
||||||
|
// locale: const Locale("en-CA"),
|
||||||
|
// locale: ,
|
||||||
|
context: context,
|
||||||
|
initialEntryMode:
|
||||||
|
DatePickerEntryMode.calendarOnly,
|
||||||
|
firstDate: DateTime(2000),
|
||||||
|
lastDate: DateTime(2100),
|
||||||
|
|
||||||
|
initialDate: (ctrlTglAwal.text.isEmpty)
|
||||||
|
? DateTime.now()
|
||||||
|
: tglAwal.value,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (selectedDateAwal != null) {
|
||||||
|
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||||
|
.format(selectedDateAwal);
|
||||||
|
// ctrlTglAwal.text =
|
||||||
|
// selectedDateAwal.toString().split(' ')[0];
|
||||||
|
ctrlTglAwal.text = formattedDate;
|
||||||
|
tglAwal.value = selectedDateAwal;
|
||||||
|
tglAwalTmp.value = selectedDateAwal.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedDateAwal == null) {
|
||||||
|
print('cancel button');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -444,89 +321,80 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
// Tanggal Akhir
|
// Tanggal Akhir
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: TextField(
|
||||||
onTap: () {
|
controller: ctrlTglAkhir,
|
||||||
focusNodetglAkhir.unfocus();
|
decoration: InputDecoration(
|
||||||
// _closeKeyboard();
|
hintStyle:
|
||||||
},
|
Constant.body2_400(context: context).copyWith(
|
||||||
child: TextField(
|
color: Constant.textGreyv2,
|
||||||
enableInteractiveSelection: false,
|
|
||||||
showCursor: (tglAwalHasFocus.value) ? true : false,
|
|
||||||
controller: ctrlTglAkhir,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
labelStyle:
|
|
||||||
Constant.body2_400(context: context).copyWith(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.orange,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
labelText: "Tanggal Akhir",
|
|
||||||
hintText: 'Tanggal Akhir',
|
|
||||||
// suffixIcon: isLoadingFilterScope.value
|
|
||||||
// ? SizedBox(
|
|
||||||
// width: Constant.getActualXPhone(
|
|
||||||
// context: context,
|
|
||||||
// x: 4,
|
|
||||||
// ),
|
|
||||||
// height: Constant.getActualYPhone(
|
|
||||||
// context: context,
|
|
||||||
// y: 4,
|
|
||||||
// ),
|
|
||||||
// child: CircularProgressIndicator(
|
|
||||||
// color: Constant.textRed,
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// : Icon(
|
|
||||||
// Icons.calendar_month_sharp,
|
|
||||||
// color: Constant.colorIconDate,
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
onTap: () async {
|
labelStyle:
|
||||||
final selectedDateAkhir = await showDatePicker(
|
Constant.body2_400(context: context).copyWith(
|
||||||
// locale: const Locale("en-CA"),
|
color: Constant.textGreyv2,
|
||||||
// locale: ,
|
),
|
||||||
context: context,
|
border: OutlineInputBorder(
|
||||||
initialEntryMode:
|
borderSide: BorderSide(
|
||||||
DatePickerEntryMode.calendarOnly,
|
color: Colors.orange,
|
||||||
firstDate: DateTime(2000),
|
width: 1,
|
||||||
lastDate: DateTime(2100),
|
),
|
||||||
|
),
|
||||||
initialDate: (ctrlTglAkhir.text.isEmpty)
|
focusedBorder: OutlineInputBorder(
|
||||||
? DateTime.now()
|
borderSide: BorderSide(
|
||||||
: tglAkhir.value,
|
color: Constant.textGreyv2,
|
||||||
);
|
width: 1,
|
||||||
|
),
|
||||||
if (selectedDateAkhir != null) {
|
),
|
||||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
labelText: "Tanggal Akhir",
|
||||||
.format(selectedDateAkhir);
|
hintText: 'Tanggal Akhir',
|
||||||
// ctrlTglAkhir.text =
|
// suffixIcon: isLoadingFilterScope.value
|
||||||
// selectedDateAkhir.toString().split(' ')[0];
|
// ? SizedBox(
|
||||||
ctrlTglAkhir.text = formattedDate;
|
// width: Constant.getActualXPhone(
|
||||||
tglAkhir.value = selectedDateAkhir;
|
// context: context,
|
||||||
tglAkhirTmp.value =
|
// x: 4,
|
||||||
selectedDateAkhir.toString();
|
// ),
|
||||||
}
|
// height: Constant.getActualYPhone(
|
||||||
|
// context: context,
|
||||||
if (selectedDateAkhir == null) {
|
// y: 4,
|
||||||
print('cancel button');
|
// ),
|
||||||
return;
|
// child: CircularProgressIndicator(
|
||||||
}
|
// color: Constant.textRed,
|
||||||
},
|
// ),
|
||||||
|
// )
|
||||||
|
// : Icon(
|
||||||
|
// Icons.calendar_month_sharp,
|
||||||
|
// color: Constant.colorIconDate,
|
||||||
|
// ),
|
||||||
),
|
),
|
||||||
|
onTap: () async {
|
||||||
|
final selectedDateAkhir = await showDatePicker(
|
||||||
|
// locale: const Locale("en-CA"),
|
||||||
|
// locale: ,
|
||||||
|
context: context,
|
||||||
|
initialEntryMode:
|
||||||
|
DatePickerEntryMode.calendarOnly,
|
||||||
|
firstDate: DateTime(2000),
|
||||||
|
lastDate: DateTime(2100),
|
||||||
|
|
||||||
|
initialDate: (ctrlTglAkhir.text.isEmpty)
|
||||||
|
? DateTime.now()
|
||||||
|
: tglAkhir.value,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (selectedDateAkhir != null) {
|
||||||
|
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||||
|
.format(selectedDateAkhir);
|
||||||
|
// ctrlTglAkhir.text =
|
||||||
|
// selectedDateAkhir.toString().split(' ')[0];
|
||||||
|
ctrlTglAkhir.text = formattedDate;
|
||||||
|
tglAkhir.value = selectedDateAkhir;
|
||||||
|
tglAkhirTmp.value = selectedDateAkhir.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedDateAkhir == null) {
|
||||||
|
print('cancel button');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -720,11 +588,11 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
M_CompanyID.value = await getCompanyID();
|
M_CompanyID = await getCompanyID();
|
||||||
ref
|
ref
|
||||||
.read(searchHistoryTransaksiProvider.notifier)
|
.read(searchHistoryTransaksiProvider.notifier)
|
||||||
.searchHistoryTransaksi(
|
.searchHistoryTransaksi(
|
||||||
M_CompanyID.value,
|
M_CompanyID,
|
||||||
ctrlTglAwal.text,
|
ctrlTglAwal.text,
|
||||||
ctrlTglAkhir.text,
|
ctrlTglAkhir.text,
|
||||||
selectedListCategory.value.categoryid ?? "0",
|
selectedListCategory.value.categoryid ?? "0",
|
||||||
@@ -886,7 +754,6 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
tipe: listSearchHistory
|
tipe: listSearchHistory
|
||||||
.value[idx].tipe
|
.value[idx].tipe
|
||||||
.toString(),
|
.toString(),
|
||||||
// searchHistoryIsLoading.value
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// bawah
|
// bawah
|
||||||
@@ -907,15 +774,15 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: Constant
|
color:
|
||||||
.bgTextChipConfirmed),
|
Constant.bgChipConfirmed),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(
|
BorderRadius.circular(
|
||||||
50,
|
50,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: Constant
|
backgroundColor:
|
||||||
.bgTextChipConfirmed,
|
Constant.bgChipConfirmed,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -932,28 +799,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
MainAxisAlignment.end,
|
MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () {
|
||||||
final userID = ref
|
print('Deleted');
|
||||||
.read(
|
|
||||||
currentUserProvider)
|
|
||||||
?.model
|
|
||||||
.M_UserID ??
|
|
||||||
"0";
|
|
||||||
// print('Deleted');
|
|
||||||
showDeleteConfirmationDialog(
|
|
||||||
context,
|
|
||||||
listSearchHistory
|
|
||||||
.value[idx].id
|
|
||||||
.toString(),
|
|
||||||
userID,
|
|
||||||
M_CompanyID.value,
|
|
||||||
ctrlTglAwal.text.toString(),
|
|
||||||
ctrlTglAkhir.text
|
|
||||||
.toString(),
|
|
||||||
selectedListCategory
|
|
||||||
.value.categoryid
|
|
||||||
.toString(),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
child: Chip(
|
child: Chip(
|
||||||
label: Text(
|
label: Text(
|
||||||
@@ -964,8 +811,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: Constant
|
color:
|
||||||
.bgTextChipDelete),
|
Constant.bgTextChipDelete),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(
|
BorderRadius.circular(
|
||||||
50,
|
50,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
@@ -13,12 +12,9 @@ import '../provider/current_user_provider.dart';
|
|||||||
import '../screen/login/logout_provider.dart';
|
import '../screen/login/logout_provider.dart';
|
||||||
|
|
||||||
class CustomDrawer extends HookConsumerWidget {
|
class CustomDrawer extends HookConsumerWidget {
|
||||||
// final String userCompany;
|
|
||||||
|
|
||||||
const CustomDrawer({
|
const CustomDrawer({
|
||||||
Key? key,
|
super.key,
|
||||||
// required this.userCompany,
|
});
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@@ -26,26 +22,6 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
final isLoading = useState(false);
|
final isLoading = useState(false);
|
||||||
final errorMessage = useState("");
|
final errorMessage = useState("");
|
||||||
final successMessage = useState("");
|
final successMessage = useState("");
|
||||||
final M_CompanyName = useState("-");
|
|
||||||
|
|
||||||
Future<String> getCompanyName() async {
|
|
||||||
final shared = await SharedPreferences.getInstance();
|
|
||||||
String M_CompanyName = "-";
|
|
||||||
|
|
||||||
if (shared != null) {
|
|
||||||
final bearerString = shared.get(Constant.bearerName).toString();
|
|
||||||
final xmodel = jsonDecode(bearerString);
|
|
||||||
if (xmodel != null) {
|
|
||||||
M_CompanyName = xmodel["model"]["M_CompanyName"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (M_CompanyName == "0") {
|
|
||||||
// throw BaseRepositoryException(message: 'Invalid Company ID');
|
|
||||||
}
|
|
||||||
|
|
||||||
return M_CompanyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
@@ -58,7 +34,6 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
// Navigator.popAndPushNamed(context, loginRoute);
|
// Navigator.popAndPushNamed(context, loginRoute);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
M_CompanyName.value = await getCompanyName();
|
|
||||||
});
|
});
|
||||||
return () {};
|
return () {};
|
||||||
}, []);
|
}, []);
|
||||||
@@ -94,229 +69,152 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
final currentMenu = ref.read(currentPageProvider);
|
final currentMenu = ref.read(currentPageProvider);
|
||||||
|
|
||||||
return Drawer(
|
return Drawer(
|
||||||
elevation: 0,
|
child: ListView(
|
||||||
shape: RoundedRectangleBorder(
|
// padding: EdgeInsets.only(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(0))
|
// top: Constant.getActualYPhone(context: context, y: 10),
|
||||||
),
|
// ),
|
||||||
|
children: [
|
||||||
child: Container(
|
DrawerHeader(
|
||||||
child: ListView(
|
decoration: BoxDecoration(
|
||||||
// padding: EdgeInsets.only(
|
color: Colors.blue,
|
||||||
// top: Constant.getActualYPhone(context: context, y: 10),
|
|
||||||
// ),
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// border: Border(bottom: BorderSide(color: Colors.transparent)) // <--- use the global theme to change the dividerColor property
|
|
||||||
// ),
|
|
||||||
child:
|
|
||||||
Image(image: AssetImage('images/logo_sismedika_landscape.png')),
|
|
||||||
),
|
),
|
||||||
|
child: Text(
|
||||||
SizedBox(
|
'Drawer Header',
|
||||||
height: Constant.getActualYPhone(context: context, y: 8),
|
style: TextStyle(
|
||||||
),
|
color: Colors.white,
|
||||||
|
fontSize: 24,
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: Constant.getActualYPhone(context: context, y: 10),
|
|
||||||
bottom: Constant.getActualYPhone(context: context, y: 10),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 24),
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 24),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
width: Constant.getActualXPhone(context: context, x: 300),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Expanded(
|
ListTile(
|
||||||
child: Padding(
|
title: Text(
|
||||||
padding: EdgeInsets.only(
|
'Home',
|
||||||
left: Constant.getActualXPhone(context: context, x: 24),
|
style: TextStyle(
|
||||||
right: Constant.getActualXPhone(context: context, x: 71),
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
color: Constant.textGrey.withOpacity(0.16),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: Constant.getActualXPhone(context: context, x: 8),
|
|
||||||
right: Constant.getActualXPhone(context: context, x: 8),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
M_CompanyName.value,
|
|
||||||
style: Constant.body3(context: context).copyWith(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Constant.textGreyv2,
|
|
||||||
backgroundColor: Constant.textGrey.withOpacity(0.16),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(
|
|
||||||
Icons.home,
|
|
||||||
color: (currentMenu == 0)
|
color: (currentMenu == 0)
|
||||||
? Constant.pcBtnBackgroundColor
|
? Constant.textWhite
|
||||||
: Constant.textGreyv2,
|
: Constant.textBlack,
|
||||||
),
|
),
|
||||||
title: Text(
|
|
||||||
'Home',
|
|
||||||
style: TextStyle(
|
|
||||||
color: (currentMenu == 0)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// tileColor: (currentMenu == 0)
|
|
||||||
// ? Constant.pcBtnBackgroundColor
|
|
||||||
// : Colors.transparent,
|
|
||||||
onTap: () {
|
|
||||||
// Handle navigation to Home screen
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 0);
|
|
||||||
Navigator.pushNamed(context, homeRoute);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
ListTile(
|
tileColor: (currentMenu == 0)
|
||||||
leading: Icon(
|
? Constant.pcBtnBackgroundColor
|
||||||
Icons.money,
|
: Colors.transparent,
|
||||||
|
onTap: () {
|
||||||
|
// Handle navigation to Home screen
|
||||||
|
Navigator.pop(context);
|
||||||
|
ref.read(currentPageProvider.state).update((state) => 0);
|
||||||
|
Navigator.pushNamed(context, homeRoute);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
'Transaksi',
|
||||||
|
style: TextStyle(
|
||||||
color: (currentMenu == 1)
|
color: (currentMenu == 1)
|
||||||
? Constant.pcBtnBackgroundColor
|
? Constant.textWhite
|
||||||
: Constant.textGreyv2,
|
: Constant.textBlack,
|
||||||
),
|
),
|
||||||
title: Text(
|
|
||||||
'Transaksi',
|
|
||||||
style: TextStyle(
|
|
||||||
color: (currentMenu == 1)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// tileColor: (currentMenu == 1)
|
|
||||||
// ? Constant.pcBtnBackgroundColor
|
|
||||||
// : Colors.transparent,
|
|
||||||
onTap: () {
|
|
||||||
// Handle navigation to Transaksi screen
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 1);
|
|
||||||
Navigator.pushNamed(context, transaksiRoute);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
ListTile(
|
tileColor: (currentMenu == 1)
|
||||||
leading: Icon(
|
? Constant.pcBtnBackgroundColor
|
||||||
Icons.history,
|
: Colors.transparent,
|
||||||
|
onTap: () {
|
||||||
|
// Handle navigation to Transaksi screen
|
||||||
|
Navigator.pop(context);
|
||||||
|
ref.read(currentPageProvider.state).update((state) => 1);
|
||||||
|
Navigator.pushNamed(context, transaksiRoute);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
'History Transaksi',
|
||||||
|
style: TextStyle(
|
||||||
color: (currentMenu == 2)
|
color: (currentMenu == 2)
|
||||||
? Constant.pcBtnBackgroundColor
|
? Constant.textWhite
|
||||||
: Constant.textGreyv2,
|
: Constant.textBlack,
|
||||||
),
|
),
|
||||||
title: Text(
|
|
||||||
'History Transaksi',
|
|
||||||
style: TextStyle(
|
|
||||||
color: (currentMenu == 2)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// tileColor: (currentMenu == 2)
|
|
||||||
// ? Constant.pcBtnBackgroundColor
|
|
||||||
// : Colors.transparent,
|
|
||||||
onTap: () {
|
|
||||||
// Handle navigation to User screen
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 2);
|
|
||||||
Navigator.pushNamed(context, historyTransaksiRoute);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
ListTile(
|
tileColor: (currentMenu == 2)
|
||||||
leading: Icon(
|
? Constant.pcBtnBackgroundColor
|
||||||
Icons.feed,
|
: Colors.transparent,
|
||||||
|
onTap: () {
|
||||||
|
// Handle navigation to User screen
|
||||||
|
Navigator.pop(context);
|
||||||
|
ref.read(currentPageProvider.state).update((state) => 2);
|
||||||
|
Navigator.pushNamed(context, historyTransaksiRoute);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
'Report',
|
||||||
|
style: TextStyle(
|
||||||
color: (currentMenu == 3)
|
color: (currentMenu == 3)
|
||||||
? Constant.pcBtnBackgroundColor
|
? Constant.textWhite
|
||||||
: Constant.textGreyv2,
|
: Constant.textBlack,
|
||||||
),
|
),
|
||||||
title: Text(
|
|
||||||
'Report',
|
|
||||||
style: TextStyle(
|
|
||||||
color: (currentMenu == 3)
|
|
||||||
? Constant.pcBtnBackgroundColor
|
|
||||||
: Constant.textGreyv2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// tileColor: (currentMenu == 3)
|
|
||||||
// ? Constant.pcBtnBackgroundColor
|
|
||||||
// : Colors.transparent,
|
|
||||||
onTap: () {
|
|
||||||
// Handle navigation to Transaksi screen
|
|
||||||
Navigator.pop(context);
|
|
||||||
ref.read(currentPageProvider.state).update((state) => 3);
|
|
||||||
Navigator.pushNamed(context, reportRoute);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
// ListTile(
|
tileColor: (currentMenu == 3)
|
||||||
// title: Text(
|
? Constant.pcBtnBackgroundColor
|
||||||
// 'User',
|
: Colors.transparent,
|
||||||
// style: TextStyle(
|
onTap: () {
|
||||||
// color: (currentMenu == 4)
|
// Handle navigation to Transaksi screen
|
||||||
// ? Constant.textWhite
|
Navigator.pop(context);
|
||||||
// : Constant.textBlack,
|
ref.read(currentPageProvider.state).update((state) => 3);
|
||||||
// ),
|
Navigator.pushNamed(context, reportRoute);
|
||||||
// ),
|
},
|
||||||
// tileColor: (currentMenu == 4)
|
),
|
||||||
// ? Constant.pcBtnBackgroundColor
|
// ListTile(
|
||||||
// : Colors.transparent,
|
// title: Text(
|
||||||
// onTap: () {
|
// 'User',
|
||||||
// // Handle navigation to User screen
|
// style: TextStyle(
|
||||||
// Navigator.pop(context);
|
// color: (currentMenu == 4)
|
||||||
// ref.read(currentPageProvider.state).update((state) => 4);
|
// ? Constant.textWhite
|
||||||
// Navigator.pushNamed(context, userRoute);
|
// : Constant.textBlack,
|
||||||
// },
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ListTile(
|
// tileColor: (currentMenu == 4)
|
||||||
// title: Text(
|
// ? Constant.pcBtnBackgroundColor
|
||||||
// 'Change Company',
|
// : Colors.transparent,
|
||||||
// style: TextStyle(
|
// onTap: () {
|
||||||
// color: (currentMenu == 5)
|
// // Handle navigation to User screen
|
||||||
// ? Constant.textWhite
|
// Navigator.pop(context);
|
||||||
// : Constant.textBlack,
|
// ref.read(currentPageProvider.state).update((state) => 4);
|
||||||
// ),
|
// Navigator.pushNamed(context, userRoute);
|
||||||
// ),
|
// },
|
||||||
// tileColor: (currentMenu == 5)
|
// ),
|
||||||
// ? Constant.pcBtnBackgroundColor
|
// ListTile(
|
||||||
// : Colors.transparent,
|
// title: Text(
|
||||||
// onTap: () {
|
// 'Change Company',
|
||||||
// // Handle navigation to User screen
|
// style: TextStyle(
|
||||||
// Navigator.pop(context);
|
// color: (currentMenu == 5)
|
||||||
// ref.read(currentPageProvider.state).update((state) => 5);
|
// ? Constant.textWhite
|
||||||
// Navigator.pushNamed(context, changeCompanyRoute);
|
// : Constant.textBlack,
|
||||||
// },
|
// ),
|
||||||
// ),
|
// ),
|
||||||
ListTile(
|
// tileColor: (currentMenu == 5)
|
||||||
leading: Icon(
|
// ? Constant.pcBtnBackgroundColor
|
||||||
Icons.logout,
|
// : Colors.transparent,
|
||||||
color: Constant.textGreyv2,
|
// onTap: () {
|
||||||
),
|
// // Handle navigation to User screen
|
||||||
title: Text(
|
// Navigator.pop(context);
|
||||||
'Logout',
|
// ref.read(currentPageProvider.state).update((state) => 5);
|
||||||
style: TextStyle(color: Constant.textGreyv2),
|
// Navigator.pushNamed(context, changeCompanyRoute);
|
||||||
),
|
// },
|
||||||
onTap: () {
|
// ),
|
||||||
// di set ke 0 lagi
|
ListTile(
|
||||||
ref.read(currentPageProvider.state).update((state) => 0);
|
title: Text(
|
||||||
ref.read(logoutProvider.notifier).logout(
|
'Logout',
|
||||||
M_UserID: selectedUser?.model.M_UserID ?? "",
|
// style: TextStyle(color: Constant.textWhite),
|
||||||
M_UserUsername: selectedUser?.model.M_UserUsername ?? "",
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
onTap: () {
|
||||||
),
|
// di set ke 0 lagi
|
||||||
|
ref.read(currentPageProvider.state).update((state) => 0);
|
||||||
|
ref.read(logoutProvider.notifier).logout(
|
||||||
|
M_UserID: selectedUser?.model.M_UserID ?? "",
|
||||||
|
M_UserUsername: selectedUser?.model.M_UserUsername ?? "",
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
import '../app/constant.dart';
|
import '../app/constant.dart';
|
||||||
|
|
||||||
@@ -13,7 +12,6 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
final String amount;
|
final String amount;
|
||||||
final String tipe;
|
final String tipe;
|
||||||
final String tglTransaksi;
|
final String tglTransaksi;
|
||||||
// final ValueNotifier<bool> searchHistoryIsLoading;
|
|
||||||
|
|
||||||
const HistoryRowAtasWidget({
|
const HistoryRowAtasWidget({
|
||||||
Key? key,
|
Key? key,
|
||||||
@@ -22,11 +20,11 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
required this.amount,
|
required this.amount,
|
||||||
required this.tipe,
|
required this.tipe,
|
||||||
required this.tglTransaksi,
|
required this.tglTransaksi,
|
||||||
// required this.searchHistoryIsLoading,
|
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|
||||||
// check file exist
|
// check file exist
|
||||||
Future<Widget> checkFileExistence(String fileUrl) async {
|
Future<Widget> checkFileExistence(String fileUrl) async {
|
||||||
try {
|
try {
|
||||||
@@ -64,24 +62,6 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fungsi tanggal
|
|
||||||
String formatDateString(String inputDate) {
|
|
||||||
try {
|
|
||||||
// Parsing tanggal dari string input
|
|
||||||
DateTime date = DateFormat('dd-MM-yyyy').parse(inputDate);
|
|
||||||
|
|
||||||
// Format tanggal ke '30 Des 2023'
|
|
||||||
String formattedDate = DateFormat('dd MMM yyyy', '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 Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
// kiri
|
// kiri
|
||||||
@@ -96,8 +76,7 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
// child: Text('s'),
|
// child: Text('s'),
|
||||||
child: FutureBuilder<Widget>(
|
child: FutureBuilder<Widget>(
|
||||||
future: checkFileExistence(
|
future: checkFileExistence('https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg'),
|
||||||
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg'),
|
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return CircularProgressIndicator();
|
return CircularProgressIndicator();
|
||||||
@@ -107,7 +86,8 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return snapshot.data ?? Container();
|
return snapshot.data ??
|
||||||
|
Container();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -183,7 +163,7 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
formatDateString(tglTransaksi),
|
tglTransaksi,
|
||||||
style: Constant.body1_600(context: context).copyWith(
|
style: Constant.body1_600(context: context).copyWith(
|
||||||
fontWeight: FontWeight.w600, color: Constant.textGreyv2),
|
fontWeight: FontWeight.w600, color: Constant.textGreyv2),
|
||||||
),
|
),
|
||||||
|
|||||||
177
app_petty_cash/lib/widget/homepage_row_transaksi.dart
Normal file
177
app_petty_cash/lib/widget/homepage_row_transaksi.dart
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
import 'package:app_petty_cash/widget/sankbar_widget.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
|
import '../app/constant.dart';
|
||||||
|
|
||||||
|
class HomepageRowTransaksiWidget extends HookConsumerWidget {
|
||||||
|
final String icon_category_id;
|
||||||
|
final String icon_category_name;
|
||||||
|
final String amount;
|
||||||
|
final String tipe;
|
||||||
|
final String tglTransaksi;
|
||||||
|
|
||||||
|
const HomepageRowTransaksiWidget({
|
||||||
|
Key? key,
|
||||||
|
required this.icon_category_id,
|
||||||
|
required this.icon_category_name,
|
||||||
|
required this.amount,
|
||||||
|
required this.tipe,
|
||||||
|
required this.tglTransaksi,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|
||||||
|
// check file exist
|
||||||
|
Future<Widget> checkFileExistence(String fileUrl) async {
|
||||||
|
try {
|
||||||
|
final dio = Dio();
|
||||||
|
final response = await dio.head(fileUrl);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return SvgPicture.network(
|
||||||
|
fileUrl,
|
||||||
|
semanticsLabel: 'Icon pizza',
|
||||||
|
placeholderBuilder: (BuildContext context) => Container(
|
||||||
|
padding: const EdgeInsets.all(30.0),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return SvgPicture.network(
|
||||||
|
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg',
|
||||||
|
semanticsLabel: 'Icon pizza',
|
||||||
|
placeholderBuilder: (BuildContext context) => Container(
|
||||||
|
padding: const EdgeInsets.all(30.0),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// print('Error checking file existence: $e');
|
||||||
|
return SvgPicture.network(
|
||||||
|
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg',
|
||||||
|
semanticsLabel: 'Icon pizza',
|
||||||
|
placeholderBuilder: (BuildContext context) => Container(
|
||||||
|
padding: const EdgeInsets.all(30.0),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
// kiri
|
||||||
|
Container(
|
||||||
|
width: Constant.getActualXPhone(context: context, x: 38),
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 38),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color.fromRGBO(241, 90, 41, 0.08),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(8.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// child: Text('s'),
|
||||||
|
child: FutureBuilder<Widget>(
|
||||||
|
future: checkFileExistence('https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg'),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return snapshot.data ??
|
||||||
|
Container();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// tengah
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: Constant.getActualYPhone(context: context, y: 20),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
icon_category_name,
|
||||||
|
style: Constant.body2_600(context: context).copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.textBlack,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(
|
||||||
|
context: context,
|
||||||
|
y: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
amount,
|
||||||
|
style: Constant.body1_600(context: context).copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.pcBtnBackgroundColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// kanan
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
right: Constant.getActualYPhone(context: context, y: 8),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
// width: Constant.getActualXPhone(context: context, x: 32),
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 19),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Constant.bgIconHistory,
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(6.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(2.0),
|
||||||
|
child: Text(
|
||||||
|
tipe,
|
||||||
|
style: Constant.body1_600(context: context).copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.pcBtnBackgroundColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(
|
||||||
|
context: context,
|
||||||
|
y: 8,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
tglTransaksi,
|
||||||
|
style: Constant.body1_600(context: context).copyWith(
|
||||||
|
fontWeight: FontWeight.w600, color: Constant.textGreyv2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user