14 Commits

Author SHA1 Message Date
Sas Andy
4b870e7bea change company 2024-01-17 16:54:54 +07:00
sindhu
abddef179d login 2024-01-17 14:17:12 +07:00
sindhu
db88512ca9 commit Merge branch 'andy/merge_camera' 2024-01-17 14:00:58 +07:00
Sas Andy
15097451d2 fix error last rebase 2024-01-17 13:57:29 +07:00
sindhu
987a5a5c3a step 25 : ganti icon apk 2024-01-17 13:54:41 +07:00
Sas Andy
01e4fccb08 Merge branch 'andy/merge_camera' of https://devone.aplikasi.web.id/gitea/sindhu/app_petikes into andy/merge_camera 2024-01-17 13:43:58 +07:00
Sas Andy
431c4f0039 upload file & revisi ui 2024-01-17 13:42:38 +07:00
Sas Andy
578e296097 penggabungan browse file & pick picture dan pemecahan file 2024-01-17 13:41:46 +07:00
Sas Andy
1235fd9e10 coba camera 2024-01-17 13:41:17 +07:00
Sas Andy
824216701a init 2024-01-17 13:30:30 +07:00
sindhu
88ad1d6584 step 24 : fix drawer, login bg color 2024-01-17 12:34:22 +07:00
sindhu
844e4c48f5 step 23 : home screen, repository, provider 2024-01-17 11:40:11 +07:00
sindhu
f3b941772b step 22 : build apk, setting logo 2024-01-17 09:47:34 +07:00
sindhu
be50c48607 step 21 : fix bug history transaksi, logo apk.png 2024-01-17 09:05:11 +07:00
68 changed files with 1865 additions and 299 deletions

View File

@@ -1,9 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application <application
android:label="app_petty_cash" android:label="PettyCash"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/launcher_icon"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
@@ -11,7 +15,9 @@
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait"
>
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues while the Flutter UI initializes. After that, this theme continues

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,7 @@
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -10,7 +10,10 @@ class Constant {
static double designWidthPhone = 390; static double designWidthPhone = 390;
static String bearerName = "petty-cash"; static String bearerName = "petty-cash";
static String version = "1.00"; // static String version = "1.00";
// NOTE VERSI HARUS SAMA DENGAN PUBSPEC.YAML
static String version = "1.0.0";
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/"; // static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";
@@ -18,9 +21,10 @@ class Constant {
static String baseUrlDevoneReport = "devone.aplikasi.web.id"; static String baseUrlDevoneReport = "devone.aplikasi.web.id";
static String baseUrlDevone = static String baseUrlDevone =
"http://devone.aplikasi.web.id/one-api-pettycash/pettycash/"; "https://devone.aplikasi.web.id/one-api-pettycash/pettycash/";
// "http://devone.aplikasi.web.id/one-api-pettycash/pettycash/";
static String baseUrlFile = static String baseUrlFile =
"http://devone.aplikasi.web.id/pettycash-media/attachment/"; "https://devone.aplikasi.web.id/pettycash-media/attachment/";
// static String baseUrl_appdoctor = // static String baseUrl_appdoctor =
// "http://devbandungraya.aplikasi.web.id/one-api/app_doctor/"; // "http://devbandungraya.aplikasi.web.id/one-api/app_doctor/";
@@ -284,6 +288,13 @@ class Constant {
); );
} }
static TextStyle titleH6_700({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualYPhone(context: context, y: 18),
fontWeight: FontWeight.w700,
);
}
static TextStyle titleH3_700({required BuildContext context}) { static TextStyle titleH3_700({required BuildContext context}) {
return TextStyle( return TextStyle(
fontSize: Constant.getActualYPhone(context: context, y: 24), fontSize: Constant.getActualYPhone(context: context, y: 24),
@@ -355,6 +366,13 @@ class Constant {
); );
} }
static TextStyle H4_700V3({required BuildContext context}) {
return TextStyle(
fontSize: Constant.getActualYPhone(context: context, y: 16),
fontWeight: FontWeight.w700,
);
}
static TextStyle titleH5({required BuildContext context}) { static TextStyle titleH5({required BuildContext context}) {
return TextStyle( return TextStyle(
fontSize: Constant.getActualYPhone(context: context, y: 18), fontSize: Constant.getActualYPhone(context: context, y: 18),

View File

@@ -2,10 +2,15 @@ import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'app/route.dart'; import 'app/route.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
initializeDateFormatting();
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarIconBrightness: statusBarIconBrightness:
Brightness.dark, // this will change the brightness of the icons Brightness.dark, // this will change the brightness of the icons
@@ -38,8 +43,8 @@ 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,

View File

@@ -0,0 +1,21 @@
class CompanyModel {
String? companyid;
String? companyname;
String? mUserDefaultCompany;
CompanyModel({this.companyid, this.companyname, this.mUserDefaultCompany});
CompanyModel.fromJson(Map<String, dynamic> json) {
companyid = json['companyid'];
companyname = json['companyname'];
mUserDefaultCompany = json['M_UserDefaultCompany'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['companyid'] = this.companyid;
data['companyname'] = this.companyname;
data['M_UserDefaultCompany'] = this.mUserDefaultCompany;
return data;
}
}

View File

@@ -0,0 +1,21 @@
class InfoAccountBalanceModel {
String? totalAll;
String? kredit;
String? debit;
InfoAccountBalanceModel({this.totalAll, this.kredit, this.debit});
InfoAccountBalanceModel.fromJson(Map<String, dynamic> json) {
totalAll = json['total_all'];
kredit = json['kredit'];
debit = json['debit'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['total_all'] = this.totalAll;
data['kredit'] = this.kredit;
data['debit'] = this.debit;
return data;
}
}

View File

@@ -0,0 +1,64 @@
class ListTransaksiHomeModel {
String? id;
String? tanggaltransaksi;
String? tipe;
String? kategoriid;
String? kategoriname;
String? note;
String? amount;
String? sender;
String? imgurl;
String? isconfirm;
String? tanggalconfirm;
String? usertransaksi;
String? userconfirm;
ListTransaksiHomeModel(
{this.id,
this.tanggaltransaksi,
this.tipe,
this.kategoriid,
this.kategoriname,
this.note,
this.amount,
this.sender,
this.imgurl,
this.isconfirm,
this.tanggalconfirm,
this.usertransaksi,
this.userconfirm});
ListTransaksiHomeModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
tanggaltransaksi = json['tanggaltransaksi'];
tipe = json['tipe'];
kategoriid = json['kategoriid'];
kategoriname = json['kategoriname'];
note = json['note'];
amount = json['amount'];
sender = json['sender'];
imgurl = json['imgurl'];
isconfirm = json['isconfirm'];
tanggalconfirm = json['tanggalconfirm'];
usertransaksi = json['usertransaksi'];
userconfirm = json['userconfirm'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['tanggaltransaksi'] = this.tanggaltransaksi;
data['tipe'] = this.tipe;
data['kategoriid'] = this.kategoriid;
data['kategoriname'] = this.kategoriname;
data['note'] = this.note;
data['amount'] = this.amount;
data['sender'] = this.sender;
data['imgurl'] = this.imgurl;
data['isconfirm'] = this.isconfirm;
data['tanggalconfirm'] = this.tanggalconfirm;
data['usertransaksi'] = this.usertransaksi;
data['userconfirm'] = this.userconfirm;
return data;
}
}

View File

@@ -0,0 +1,11 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../model/info_account_balance.dart';
final currentInfoAccountBalanceProvider = StateProvider<InfoAccountBalanceModel>(
((ref) => InfoAccountBalanceModel(
debit: "0",
kredit: "0",
totalAll: "0",
)),
);

View File

@@ -0,0 +1,32 @@
import 'dart:convert';
import 'package:app_petty_cash/model/company_model.dart';
import 'package:app_petty_cash/model/list_type_model.dart';
import '../app/constant.dart';
import '../model/history_transaksi_model.dart';
import '../model/list_category_model.dart';
import 'base_repository.dart';
class CompanyRepository extends BaseRepository {
CompanyRepository({required super.dio});
// list company
Future<List<CompanyModel>> getListCompany({required String userID}) async {
// https: //devone.aplikasi.web.id/one-api-pettycash/pettycash/Usercompany/list_company?M_UserID=2
final service =
"${Constant.baseUrlDevone}Usercompany/list_company?M_UserID=${userID}";
final resp = await get(
service: service,
);
print("url list type : $service");
final result = List<CompanyModel>.empty(growable: true);
resp['data'].forEach((e) {
final model = CompanyModel.fromJson(e);
result.add(model);
});
return result;
}
}

View File

@@ -0,0 +1,61 @@
import 'package:app_petty_cash/model/list_type_model.dart';
import '../app/constant.dart';
import '../model/info_account_balance.dart';
import '../model/list_transaksi_model.dart';
import 'base_repository.dart';
class HomeRepository extends BaseRepository {
HomeRepository({required super.dio});
// list transaksi home
Future<List<ListTransaksiHomeModel>> getTransaksiListHome(
String companyid,
) async {
final service =
"${Constant.baseUrlDevone}homescreen/list_transaction/?companyid=$companyid";
final resp = await get(
// param: {
// "": "",
// },
service: service,
);
print("url list transaksi home : $service");
final result = List<ListTransaksiHomeModel>.empty(growable: true);
resp['data'].forEach((e) {
final model = ListTransaksiHomeModel.fromJson(e);
result.add(model);
});
return result;
}
// info account balance
Future<InfoAccountBalanceModel> getInfoAccountBalance(
String companyid,
) async {
final service =
"${Constant.baseUrlDevone}homescreen/list_total/?companyid=$companyid";
final resp = await get(
// param: {
// "": "",
// },
service: service,
);
print("url card info account balance home : $service");
InfoAccountBalanceModel result = InfoAccountBalanceModel(
debit: "0",
kredit: "0",
totalAll: "0",
);
print(resp['data']);
final model = InfoAccountBalanceModel.fromJson(resp['data']);
result = model;
return result;
}
}

View File

@@ -1,6 +1,13 @@
import 'dart:convert';
import 'package:app_petty_cash/model/auth_model.dart';
import 'package:app_petty_cash/model/company_model.dart';
import 'package:app_petty_cash/screen/change_company/list_company_provider.dart';
import 'package:app_petty_cash/widget/sankbar_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../app/constant.dart'; import '../../app/constant.dart';
import '../../app/route.dart'; import '../../app/route.dart';
@@ -12,6 +19,14 @@ class ChangeCompanyScreen extends HookConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final listCompany = useState<List<CompanyModel>>([
CompanyModel(companyid: "1", companyname: "SAS"),
CompanyModel(companyid: "2", companyname: "SIM")
]);
final isLoading = useState(false);
final selectedCompanyID = useState("0");
final selectedCompanyName = useState("");
final auth = ref.watch(currentUserProvider);
useEffect(() { useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0"; final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
@@ -23,9 +38,29 @@ class ChangeCompanyScreen extends HookConsumerWidget {
// Navigator.popAndPushNamed(context, loginRoute); // Navigator.popAndPushNamed(context, loginRoute);
return; return;
} }
ref.read(ListCompanyProvider.notifier).getListCompany(userID: userID);
}); });
return () {}; return () {};
}, []); }, []);
ref.listen(
ListCompanyProvider,
(previous, next) {
if (next is ListCompanyStateLoading) {
isLoading.value = true;
} else if (next is ListCompanyStateError) {
// print(next.message);
isLoading.value = false;
SanckbarWidget(context, next.message, snackbarType.error);
} else if (next is ListCompanyStateDone) {
print(jsonEncode(next.model));
// print(next.model.length);
listCompany.value = next.model;
selectedCompanyID.value = auth?.model.M_CompanyID ?? "0";
isLoading.value = 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),
@@ -43,7 +78,131 @@ class ChangeCompanyScreen extends HookConsumerWidget {
), ),
), ),
drawer: CustomDrawer(), drawer: CustomDrawer(),
body: Text('Under Construction'), body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(20),
child: isLoading.value
? Container(
height: MediaQuery.of(context).size.height,
child: Center(
child: CircularProgressIndicator(),
),
)
: Column(
children: listCompany.value
.map((e) => Container(
margin: EdgeInsets.only(bottom: 20),
child: InkWell(
onTap: () async {
selectedCompanyID.value = e.companyid ?? "0";
selectedCompanyName.value =
e.companyname ?? "0";
final shared =
await SharedPreferences.getInstance();
final oldData = jsonDecode(
shared.getString(Constant.bearerName) ??
"");
print(oldData['token']);
final newModel = AuthDoctorModel.fromJson(
oldData['model']);
newModel.M_CompanyID = e.companyid ?? "0";
newModel.M_CompanyName = e.companyname ?? "";
final token = jsonEncode({
"date": oldData['date'],
"model": newModel,
"token": oldData['token']
});
final newAuthData = AuthModel(
token: oldData['token'], model: newModel);
await shared.setString(
Constant.bearerName, token);
ref.read(currentUserProvider.notifier).state =
newAuthData;
Navigator.pushNamed(context, homeRoute);
},
child: Card(
shadowColor:
selectedCompanyID.value == e.companyid
? Constant.bgIconHistory
: Colors.white,
surfaceTintColor:
selectedCompanyID.value == e.companyid
? Constant.bgIconHistory
: Colors.white,
// elevation: selectedCompanyID.value == e.companyid
// ? 0
// : 1,
elevation: 10,
color: selectedCompanyID.value == e.companyid
? Constant.bgIconHistory
: Colors.white,
child: Container(
padding: EdgeInsets.all(20),
width: MediaQuery.of(context).size.width,
child: Row(
children: [
Expanded(
flex: 1,
child: Icon(
Icons.corporate_fare,
color:
selectedCompanyID.value ==
e.companyid
? Constant.textRed
: Colors.black,
size: 30,
)),
SizedBox(
width: 10,
),
Expanded(
flex: 8,
child: Text(e.companyname ?? "",
softWrap: true,
maxLines: 3,
// overflow: ,
style: Constant.body1(
context: context)
.copyWith(
color: selectedCompanyID
.value ==
e.companyid
? Constant.textRed
: Colors.black,
fontSize: 25)),
),
],
)),
),
),
))
.toList()
// [
// Card(
// shadowColor: Colors.white,
// // surfaceTintColor: Colors.white,
// elevation: 0,
// color: Constant.bgIconHistory,
// child: Container(
// padding: EdgeInsets.all(10),
// width: MediaQuery.of(context).size.width,
// child: Row(
// children: [
// Icon(Icons.corporate_fare),
// SizedBox(
// width: 10,
// ),
// Text("Company",
// style: Constant.body1(context: context)
// .copyWith(color: Constant.textRed)),
// ],
// )),
// )
// ],
),
),
),
), ),
); );
} }

View File

@@ -0,0 +1,69 @@
import 'package:app_petty_cash/model/company_model.dart';
import 'package:app_petty_cash/repository/company_repository.dart';
import '../../model/list_category_model.dart';
import '../../repository/transaksi_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../provider/dio_provider.dart';
import '../../repository/base_repository.dart';
abstract class ListCompanyState extends Equatable {
final DateTime date;
const ListCompanyState(this.date);
@override
List<Object?> get props => [date];
}
class ListCompanyStateInit extends ListCompanyState {
ListCompanyStateInit() : super(DateTime.now());
}
class ListCompanyStateLoading extends ListCompanyState {
ListCompanyStateLoading() : super(DateTime.now());
}
class ListCompanyStateError extends ListCompanyState {
final String message;
ListCompanyStateError({
required this.message,
}) : super(DateTime.now());
}
class ListCompanyStateDone extends ListCompanyState {
final List<CompanyModel> model;
ListCompanyStateDone({
required this.model,
}) : super(DateTime.now());
}
//notifier
class ListCompanyNotifier extends StateNotifier<ListCompanyState> {
final Ref ref;
ListCompanyNotifier({
required this.ref,
}) : super(ListCompanyStateInit());
void getListCompany({required String userID}) async {
try {
state = ListCompanyStateLoading();
final dio = ref.read(dioProvider);
final resp =
await CompanyRepository(dio: dio).getListCompany(userID: userID);
state = ListCompanyStateDone(model: resp);
} catch (e) {
if (e is BaseRepositoryException) {
state = ListCompanyStateError(message: e.message.toString());
} else {
state = ListCompanyStateError(message: e.toString());
}
}
}
}
//provider
final ListCompanyProvider =
StateNotifierProvider<ListCompanyNotifier, ListCompanyState>(
(ref) => ListCompanyNotifier(ref: ref),
);

View File

@@ -1,17 +1,55 @@
import 'dart:convert';
import 'package:app_petty_cash/screen/home/info_account_balance_provider.dart';
import 'package:app_petty_cash/screen/home/list_transaksi_home_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../app/constant.dart'; import '../../app/constant.dart';
import '../../app/route.dart'; import '../../app/route.dart';
import '../../model/info_account_balance.dart';
import '../../model/list_transaksi_model.dart';
import '../../provider/current_info_account_balance_provider.dart';
import '../../provider/current_user_provider.dart'; import '../../provider/current_user_provider.dart';
import '../../widget/custom_drawer.dart'; import '../../widget/custom_drawer.dart';
import '../../widget/history_row_atas_widget.dart';
import '../../widget/sankbar_widget.dart';
class HomeScreen extends HookConsumerWidget { class HomeScreen extends HookConsumerWidget {
const HomeScreen({super.key}); const HomeScreen({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final M_CompanyID = useState<String>("0");
final searchTransaksiHomeLoading = useState<bool>(false);
final infoAccountBalanceHomeLoading = useState<bool>(false);
final listTransaksiHome = useState<List<ListTransaksiHomeModel>>(
List.empty(growable: true),
);
final M_CompanyName = useState("-");
// company name
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 {
final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0"; final userID = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
@@ -23,10 +61,85 @@ class HomeScreen extends HookConsumerWidget {
// Navigator.popAndPushNamed(context, loginRoute); // Navigator.popAndPushNamed(context, loginRoute);
return; return;
} }
M_CompanyName.value = await getCompanyName();
}); });
return () {}; return () {};
}, []); }, []);
Future<String> getCompanyID() async {
final shared = await SharedPreferences.getInstance();
String M_CompanyID = "0";
if (shared != null) {
final bearerString = shared.get(Constant.bearerName).toString();
final xmodel = jsonDecode(bearerString);
if (xmodel != null) {
M_CompanyID = xmodel["model"]["M_CompanyID"];
}
}
if (M_CompanyID == "0") {
// throw BaseRepositoryException(message: 'Invalid Company ID');
}
return M_CompanyID;
}
useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
M_CompanyID.value = await getCompanyID();
// info account balance
ref
.read(infoAccountBalanceHomeProvider.notifier)
.infoAccountBalanceHome(M_CompanyID.value);
});
return () {};
}, []);
// read provider home
ref.listen(
listTransaksiHomeProvider,
(previous, next) {
if (next is ListTransaksiHomeStateLoading) {
searchTransaksiHomeLoading.value = true;
} else if (next is ListTransaksiHomeStateError) {
// print(next.message);
searchTransaksiHomeLoading.value = false;
SanckbarWidget(context, next.message, snackbarType.error);
} else if (next is ListTransaksiHomeStateDone) {
// print(jsonEncode(next.model));
// print(next.model.length);
listTransaksiHome.value = next.model;
searchTransaksiHomeLoading.value = false;
}
},
);
// read provider info account balance
ref.listen(
infoAccountBalanceHomeProvider,
(previous, next) {
if (next is InfoAccountBalanceHomeStateLoading) {
infoAccountBalanceHomeLoading.value = true;
} else if (next is InfoAccountBalanceHomeStateError) {
// print(next.message);
infoAccountBalanceHomeLoading.value = false;
SanckbarWidget(context, next.message, snackbarType.error);
} else if (next is InfoAccountBalanceHomeStateDone) {
// print(jsonEncode(next.model));
// print(next.model.length);
// infoAccountBalanceObject.value = next.model;
ref.read(currentInfoAccountBalanceProvider.notifier).state =
InfoAccountBalanceModel(
kredit: next.model.kredit,
debit: next.model.debit,
totalAll: next.model.totalAll,
);
infoAccountBalanceHomeLoading.value = 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),
@@ -34,8 +147,12 @@ class HomeScreen extends HookConsumerWidget {
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(
'Home Screen', // 'Home Screen',
style: TextStyle(color: Constant.textWhite), M_CompanyName.value,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Constant.textWhite,
),
), ),
backgroundColor: Constant.pcBtnBackgroundColor, backgroundColor: Constant.pcBtnBackgroundColor,
iconTheme: IconThemeData( iconTheme: IconThemeData(
@@ -44,8 +161,258 @@ class HomeScreen extends HookConsumerWidget {
), ),
drawer: CustomDrawer(), drawer: CustomDrawer(),
body: SafeArea( body: SafeArea(
child: Center( child: Padding(
child: Text('Home Screen Content'), 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: RefreshIndicator(
onRefresh: () async {
ref
.read(infoAccountBalanceHomeProvider.notifier)
.infoAccountBalanceHome(M_CompanyID.value);
},
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: (infoAccountBalanceHomeLoading.value)
? Center(
child: CircularProgressIndicator(),
)
: 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: Column(
children: [
Text(
'Account Balance',
style: Constant.body1(
context: context)
.copyWith(
fontWeight: FontWeight.w400,
color: Constant.textWhite),
),
Text(
ref
.watch(
currentInfoAccountBalanceProvider)
.totalAll
.toString(),
style: Constant.H4_700V3(
context: context)
.copyWith(
color: Constant.textWhite,
),
),
],
),
),
SizedBox(
height: Constant.getActualYPhone(
context: context, y: 27),
),
//Debit dan Kredit
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
// Spasi di sebelah kiri "Check In"
Expanded(
child: Padding(
padding: EdgeInsets.only(
left: Constant.getActualXPhone(
context: context, x: 20),
),
child: Column(
children: [
Text(
'Debit',
style: Constant.body1(
context: context)
.copyWith(
fontWeight:
FontWeight.w400,
color:
Constant.textWhite),
),
Text(
ref
.watch(
currentInfoAccountBalanceProvider)
.debit
.toString(),
style: Constant.H4_700V3(
context: context)
.copyWith(
color:
Constant.textWhite),
),
],
),
),
),
// SizedBox(
// width: Constant.getActualXPhone(
// context: context, x: 51),
// ),
Expanded(
child: Padding(
padding: EdgeInsets.only(
right: Constant.getActualXPhone(
context: context, x: 28),
),
child: Column(
children: [
Text(
'Credit',
style: Constant.body1(
context: context)
.copyWith(
fontWeight:
FontWeight.w400,
color:
Constant.textWhite),
),
Text(
ref
.watch(
currentInfoAccountBalanceProvider)
.kredit
.toString(),
style: Constant.H4_700V3(
context: context)
.copyWith(
color:
Constant.textWhite),
),
],
),
),
),
],
),
SizedBox(
height: Constant.getActualYPhone(
context: context, y: 17),
),
],
),
),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 44),
),
Align(
alignment: Alignment.centerLeft,
child: Text(
'Transaksi Terkini',
style: Constant.titleH5_600(context: context)
.copyWith(color: Constant.textBlack),
),
),
SizedBox(
height: Constant.getActualYPhone(context: context, y: 24),
),
// list transaksi
(searchTransaksiHomeLoading.value)
? Center(
child: CircularProgressIndicator(),
)
: Container(
child: Expanded(
child: ListView.builder(
itemCount: listTransaksiHome.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
HistoryRowAtasWidget(
icon_category_id:
listTransaksiHome
.value[idx].kategoriid
.toString(),
icon_category_name:
listTransaksiHome
.value[idx].kategoriname
.toString(),
amount: listTransaksiHome
.value[idx].amount
.toString(),
tglTransaksi: listTransaksiHome
.value[idx].tanggaltransaksi
.toString(),
tipe: listTransaksiHome
.value[idx].tipe
.toString(),
),
],
),
),
),
);
},
),
),
),
],
),
),
),
), ),
), ),
), ),

View File

@@ -0,0 +1,75 @@
import 'package:app_petty_cash/provider/current_info_account_balance_provider.dart';
import 'package:app_petty_cash/repository/home_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../model/info_account_balance.dart';
import '../../provider/dio_provider.dart';
import '../../repository/base_repository.dart';
import 'list_transaksi_home_provider.dart';
abstract class InfoAccountBalanceHomeState extends Equatable {
final DateTime date;
const InfoAccountBalanceHomeState(this.date);
@override
List<Object?> get props => [date];
}
class InfoAccountBalanceHomeStateInit extends InfoAccountBalanceHomeState {
InfoAccountBalanceHomeStateInit() : super(DateTime.now());
}
class InfoAccountBalanceHomeStateLoading extends InfoAccountBalanceHomeState {
InfoAccountBalanceHomeStateLoading() : super(DateTime.now());
}
class InfoAccountBalanceHomeStateError extends InfoAccountBalanceHomeState {
final String message;
InfoAccountBalanceHomeStateError({
required this.message,
}) : super(DateTime.now());
}
class InfoAccountBalanceHomeStateDone extends InfoAccountBalanceHomeState {
final InfoAccountBalanceModel model;
// final String resp;
InfoAccountBalanceHomeStateDone({
required this.model,
}) : super(DateTime.now());
}
//notifier
class InfoAccountBalanceHomeNotifier
extends StateNotifier<InfoAccountBalanceHomeState> {
final Ref ref;
InfoAccountBalanceHomeNotifier({
required this.ref,
}) : super(InfoAccountBalanceHomeStateInit());
void infoAccountBalanceHome(
String companyid,
) async {
try {
state = InfoAccountBalanceHomeStateLoading();
final dio = ref.read(dioProvider);
final resp = await HomeRepository(dio: dio).getInfoAccountBalance(
companyid,
);
state = InfoAccountBalanceHomeStateDone(model: resp);
// list transaksi home
ref.read(listTransaksiHomeProvider.notifier).listTransaksiHome(companyid);
} catch (e) {
if (e is BaseRepositoryException) {
state = InfoAccountBalanceHomeStateError(message: e.message.toString());
} else {
state = InfoAccountBalanceHomeStateError(message: e.toString());
}
}
}
}
//provider
final infoAccountBalanceHomeProvider = StateNotifierProvider<
InfoAccountBalanceHomeNotifier, InfoAccountBalanceHomeState>(
(ref) => InfoAccountBalanceHomeNotifier(ref: ref),
);

View File

@@ -0,0 +1,72 @@
import 'package:app_petty_cash/repository/home_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../model/list_transaksi_model.dart';
import '../../repository/transaksi_repository.dart';
import '../../provider/dio_provider.dart';
import '../../repository/base_repository.dart';
abstract class ListTransaksiHomeState extends Equatable {
final DateTime date;
const ListTransaksiHomeState(this.date);
@override
List<Object?> get props => [date];
}
class ListTransaksiHomeStateInit extends ListTransaksiHomeState {
ListTransaksiHomeStateInit() : super(DateTime.now());
}
class ListTransaksiHomeStateLoading extends ListTransaksiHomeState {
ListTransaksiHomeStateLoading() : super(DateTime.now());
}
class ListTransaksiHomeStateError extends ListTransaksiHomeState {
final String message;
ListTransaksiHomeStateError({
required this.message,
}) : super(DateTime.now());
}
class ListTransaksiHomeStateDone extends ListTransaksiHomeState {
final List<ListTransaksiHomeModel> model;
// final String resp;
ListTransaksiHomeStateDone({
required this.model,
}) : super(DateTime.now());
}
//notifier
class ListTransaksiHomeNotifier extends StateNotifier<ListTransaksiHomeState> {
final Ref ref;
ListTransaksiHomeNotifier({
required this.ref,
}) : super(ListTransaksiHomeStateInit());
void listTransaksiHome(
String companyid,
) async {
try {
state = ListTransaksiHomeStateLoading();
final dio = ref.read(dioProvider);
final resp = await HomeRepository(dio: dio).getTransaksiListHome(
companyid,
);
state = ListTransaksiHomeStateDone(model: resp);
} catch (e) {
if (e is BaseRepositoryException) {
state = ListTransaksiHomeStateError(message: e.message.toString());
} else {
state = ListTransaksiHomeStateError(message: e.toString());
}
}
}
}
//provider
final listTransaksiHomeProvider =
StateNotifierProvider<ListTransaksiHomeNotifier, ListTransaksiHomeState>(
(ref) => ListTransaksiHomeNotifier(ref: ref),
);

View File

@@ -114,7 +114,7 @@ class LoginFormScreen extends HookConsumerWidget {
), ),
Container( Container(
width: Constant.getActualXPhone(context: context, x: 390), width: Constant.getActualXPhone(context: context, x: 390),
height: Constant.getActualYPhone(context: context, y: 485), // height: Constant.getActualYPhone(context: context, y: 485),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,

View File

@@ -55,22 +55,22 @@ class LoginScreen extends HookConsumerWidget {
onTap: () => FocusManager.instance.primaryFocus?.unfocus(), onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
backgroundColor: Constant.backgroundColor, // backgroundColor: Colors.transparent,
body: SafeArea( body: SafeArea(
child: Center( child: Center(
child: Container( child: Container(
width: Constant.getActualXPhone(context: context, x: 390), width: Constant.getActualXPhone(context: context, x: 390),
height: Constant.getActualYPhone(context: context, y: 844), height: Constant.getActualYPhone(context: context, y: 844),
decoration: BoxDecoration( // decoration: BoxDecoration(
gradient: LinearGradient( // gradient: LinearGradient(
colors: [ // colors: [
Color(0xffdadae6), // Color(0xffdadae6),
Color(0xfff6f7fb), // Color(0xfff6f7fb),
], // ],
begin: Alignment.centerLeft, // begin: Alignment.centerLeft,
end: Alignment.centerRight, // end: Alignment.centerRight,
), // ),
), // ),
// child: BlockBodyV2(), // child: BlockBodyV2(),
child: LoginFormScreen(), child: LoginFormScreen(),
), ),

View File

@@ -1,4 +1,5 @@
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';
@@ -12,9 +13,11 @@ 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({
super.key, Key? key,
}); // required this.userCompany,
}) : super(key: key);
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
@@ -22,6 +25,26 @@ 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 {
@@ -34,6 +57,7 @@ class CustomDrawer extends HookConsumerWidget {
// Navigator.popAndPushNamed(context, loginRoute); // Navigator.popAndPushNamed(context, loginRoute);
return; return;
} }
M_CompanyName.value = await getCompanyName();
}); });
return () {}; return () {};
}, []); }, []);
@@ -56,7 +80,6 @@ class CustomDrawer extends HookConsumerWidget {
shared.remove(bearerString); shared.remove(bearerString);
shared.clear(); shared.clear();
// Navigator.popAndPushNamed(context, loginRoute); // Navigator.popAndPushNamed(context, loginRoute);
Navigator.of(context) Navigator.of(context)
.pushNamedAndRemoveUntil(loginRoute, (route) => false); .pushNamedAndRemoveUntil(loginRoute, (route) => false);
} }
@@ -69,173 +92,249 @@ class CustomDrawer extends HookConsumerWidget {
final currentMenu = ref.read(currentPageProvider); final currentMenu = ref.read(currentPageProvider);
return Drawer( return Drawer(
child: ListView( elevation: 0,
// padding: EdgeInsets.only( shape: RoundedRectangleBorder(
// top: Constant.getActualYPhone(context: context, y: 10), borderRadius: BorderRadius.all(Radius.circular(0))),
// ), child: Container(
children: [ child: ListView(
DrawerHeader( // padding: EdgeInsets.only(
decoration: BoxDecoration( // top: Constant.getActualYPhone(context: context, y: 10),
color: Colors.blue, // ),
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(
'Drawer Header', SizedBox(
style: TextStyle( height: Constant.getActualYPhone(context: context, y: 8),
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),
), ),
), ),
),
ListTile( // Expanded(
title: Text( // child: Padding(
'Home', // padding: EdgeInsets.only(
style: TextStyle( // left: Constant.getActualXPhone(context: context, x: 24),
// 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),
// ),
// ),
// ),
// ),
// ),
// ),
Chip(
backgroundColor: Constant.textGrey.withOpacity(0.16),
label: Text(
M_CompanyName.value,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Constant.textGreyv2,
),
),
),
ListTile(
leading: Icon(
Icons.home,
color: (currentMenu == 0) color: (currentMenu == 0)
? Constant.textWhite ? Constant.pcBtnBackgroundColor
: Constant.textBlack, : Constant.textGreyv2,
), ),
), title: Text(
tileColor: (currentMenu == 0) 'Home',
? Constant.pcBtnBackgroundColor style: TextStyle(
: Colors.transparent, color: (currentMenu == 0)
onTap: () { ? Constant.pcBtnBackgroundColor
// Handle navigation to Home screen : Constant.textGreyv2,
Navigator.pop(context); ),
ref.read(currentPageProvider.state).update((state) => 0);
Navigator.pushNamed(context, homeRoute);
// Navigator.pushNamed(context, cameraExampleRoute);
},
),
ListTile(
title: Text(
'Coba Camera',
style: TextStyle(
color: (currentMenu == 10)
? Constant.textWhite
: Constant.textBlack,
), ),
// 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);
},
), ),
tileColor: (currentMenu == 10) ListTile(
? Constant.pcBtnBackgroundColor leading: Icon(
: Colors.transparent, Icons.money,
onTap: () {
// Handle navigation to Home screen
Navigator.pop(context);
ref.read(currentPageProvider.state).update((state) => 10);
// Navigator.pushNamed(context, homeRoute);
Navigator.pushNamed(context, cobaCameraRoute);
},
),
ListTile(
title: Text(
'Transaksi',
style: TextStyle(
color: (currentMenu == 1) color: (currentMenu == 1)
? Constant.textWhite ? Constant.pcBtnBackgroundColor
: Constant.textBlack, : Constant.textGreyv2,
), ),
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);
},
), ),
tileColor: (currentMenu == 1) ListTile(
? Constant.pcBtnBackgroundColor leading: Icon(
: Colors.transparent, Icons.history,
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.textWhite ? Constant.pcBtnBackgroundColor
: Constant.textBlack, : Constant.textGreyv2,
), ),
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);
},
), ),
tileColor: (currentMenu == 2) ListTile(
? Constant.pcBtnBackgroundColor leading: Icon(
: Colors.transparent, Icons.feed,
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.textWhite ? Constant.pcBtnBackgroundColor
: Constant.textBlack, : Constant.textGreyv2,
), ),
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);
},
), ),
tileColor: (currentMenu == 3) // ListTile(
? Constant.pcBtnBackgroundColor // title: Text(
: Colors.transparent, // 'User',
onTap: () { // style: TextStyle(
// Handle navigation to Transaksi screen // color: (currentMenu == 4)
Navigator.pop(context); // ? Constant.textWhite
ref.read(currentPageProvider.state).update((state) => 3); // : Constant.textBlack,
Navigator.pushNamed(context, reportRoute); // ),
}, // ),
), // tileColor: (currentMenu == 4)
// ListTile( // ? Constant.pcBtnBackgroundColor
// title: Text( // : Colors.transparent,
// 'User', // onTap: () {
// style: TextStyle( // // Handle navigation to User screen
// color: (currentMenu == 4) // Navigator.pop(context);
// ? Constant.textWhite // ref.read(currentPageProvider.state).update((state) => 4);
// : Constant.textBlack, // Navigator.pushNamed(context, userRoute);
// ), // },
// ), // ),
// tileColor: (currentMenu == 4) // ListTile(
// ? Constant.pcBtnBackgroundColor // title: Text(
// : Colors.transparent, // 'Change Company',
// onTap: () { // style: TextStyle(
// // Handle navigation to User screen // color: (currentMenu == 5)
// Navigator.pop(context); // ? Constant.textWhite
// ref.read(currentPageProvider.state).update((state) => 4); // : Constant.textBlack,
// Navigator.pushNamed(context, userRoute); // ),
// }, // ),
// ), // tileColor: (currentMenu == 5)
// ListTile( // ? Constant.pcBtnBackgroundColor
// title: Text( // : Colors.transparent,
// 'Change Company', // onTap: () {
// style: TextStyle( // // Handle navigation to User screen
// color: (currentMenu == 5) // Navigator.pop(context);
// ? Constant.textWhite // ref.read(currentPageProvider.state).update((state) => 5);
// : Constant.textBlack, // Navigator.pushNamed(context, changeCompanyRoute);
// ), // },
// ), // ),
// tileColor: (currentMenu == 5) ListTile(
// ? Constant.pcBtnBackgroundColor leading: Icon(
// : Colors.transparent, Icons.logout,
// onTap: () { color: Constant.textGreyv2,
// // Handle navigation to User screen ),
// Navigator.pop(context); title: Text(
// ref.read(currentPageProvider.state).update((state) => 5); 'Logout',
// Navigator.pushNamed(context, changeCompanyRoute); style: TextStyle(color: Constant.textGreyv2),
// }, ),
// ), onTap: () {
ListTile( // di set ke 0 lagi
title: Text( ref.read(currentPageProvider.state).update((state) => 0);
'Logout', ref.read(logoutProvider.notifier).logout(
// style: TextStyle(color: Constant.textWhite), M_UserID: selectedUser?.model.M_UserID ?? "",
M_UserUsername: selectedUser?.model.M_UserUsername ?? "",
);
},
), ),
onTap: () {
// di set ke 0 lagi Spacer(),
ref.read(currentPageProvider.state).update((state) => 0);
ref.read(logoutProvider.notifier).logout( // Versi Aplikasi
M_UserID: selectedUser?.model.M_UserID ?? "", ListTile(
M_UserUsername: selectedUser?.model.M_UserUsername ?? "", title: Text(
); 'Versi ${Constant.version}',
}, style: Constant.titleH4Login(context: context)
), .copyWith(color: Constant.textGrey),
], ),
onTap: () {},
),
],
),
), ),
); );
} }

View File

@@ -0,0 +1,221 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../app/constant.dart';
import '../app/route.dart';
import '../provider/current_menu_provider.dart';
import '../provider/current_user_provider.dart';
import '../screen/login/logout_provider.dart';
class CustomDrawerV1 extends HookConsumerWidget {
const CustomDrawerV1({
super.key,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final selectedUser = ref.read(currentUserProvider);
final isLoading = useState(false);
final errorMessage = useState("");
final successMessage = useState("");
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 () {};
}, []);
ref.listen(logoutProvider, (prev, next) async {
if (next is LogoutStateLoading) {
isLoading.value = true;
} else if (next is LogoutStateError) {
isLoading.value = false;
errorMessage.value = next.message;
Timer(const Duration(seconds: 3), () {
errorMessage.value = "";
});
} else if (next is LogoutStateDone) {
isLoading.value = false;
final shared = await SharedPreferences.getInstance();
final bearerString = shared.get(Constant.bearerName).toString();
// print(bearerString);
if (bearerString.isNotEmpty) {
shared.remove(bearerString);
shared.clear();
// Navigator.popAndPushNamed(context, loginRoute);
Navigator.of(context)
.pushNamedAndRemoveUntil(loginRoute, (route) => false);
}
Timer(const Duration(seconds: 3), () async {
successMessage.value = "";
});
}
});
final currentMenu = ref.read(currentPageProvider);
return Drawer(
child: ListView(
// padding: EdgeInsets.only(
// top: Constant.getActualYPhone(context: context, y: 10),
// ),
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text(
'Drawer Header',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
),
ListTile(
title: Text(
'Home',
style: TextStyle(
color: (currentMenu == 0)
? Constant.textWhite
: Constant.textBlack,
),
),
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(
title: Text(
'Transaksi',
style: TextStyle(
color: (currentMenu == 1)
? Constant.textWhite
: Constant.textBlack,
),
),
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(
title: Text(
'History Transaksi',
style: TextStyle(
color: (currentMenu == 2)
? Constant.textWhite
: Constant.textBlack,
),
),
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(
title: Text(
'Report',
style: TextStyle(
color: (currentMenu == 3)
? Constant.textWhite
: Constant.textBlack,
),
),
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(
// title: Text(
// 'User',
// style: TextStyle(
// color: (currentMenu == 4)
// ? Constant.textWhite
// : Constant.textBlack,
// ),
// ),
// tileColor: (currentMenu == 4)
// ? Constant.pcBtnBackgroundColor
// : Colors.transparent,
// onTap: () {
// // Handle navigation to User screen
// Navigator.pop(context);
// ref.read(currentPageProvider.state).update((state) => 4);
// Navigator.pushNamed(context, userRoute);
// },
// ),
// ListTile(
// title: Text(
// 'Change Company',
// style: TextStyle(
// color: (currentMenu == 5)
// ? Constant.textWhite
// : Constant.textBlack,
// ),
// ),
// tileColor: (currentMenu == 5)
// ? Constant.pcBtnBackgroundColor
// : Colors.transparent,
// onTap: () {
// // Handle navigation to User screen
// Navigator.pop(context);
// ref.read(currentPageProvider.state).update((state) => 5);
// Navigator.pushNamed(context, changeCompanyRoute);
// },
// ),
ListTile(
title: Text(
'Logout',
// style: TextStyle(color: Constant.textWhite),
),
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 ?? "",
);
},
),
],
),
);
}
}

View File

@@ -28,7 +28,44 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
@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 {
// 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(),
// // ),
// );
// }
// }
final iconProvider =
FutureProvider.family<Widget, String>((ref, fileUrl) async {
try { try {
final dio = Dio(); final dio = Dio();
final response = await dio.head(fileUrl); final response = await dio.head(fileUrl);
@@ -36,39 +73,26 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
return SvgPicture.network( return SvgPicture.network(
fileUrl, fileUrl,
semanticsLabel: 'Icon pizza', semanticsLabel: 'Icon pizza',
placeholderBuilder: (BuildContext context) => Container(
padding: const EdgeInsets.all(30.0),
child: const CircularProgressIndicator(),
),
); );
} else { } else {
return SvgPicture.network( return SvgPicture.network(
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg', 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg',
semanticsLabel: 'Icon pizza', semanticsLabel: 'Icon pizza',
placeholderBuilder: (BuildContext context) => Container(
padding: const EdgeInsets.all(30.0),
child: const CircularProgressIndicator(),
),
); );
} }
} catch (e) { } catch (e) {
// print('Error checking file existence: $e');
return SvgPicture.network( return SvgPicture.network(
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg', 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg',
semanticsLabel: 'Icon pizza', semanticsLabel: 'Icon pizza',
placeholderBuilder: (BuildContext context) => Container(
padding: const EdgeInsets.all(30.0),
child: const CircularProgressIndicator(),
),
); );
} }
} });
// fungsi tanggal // fungsi tanggal
String formatDateString(String inputDate) { String formatDateString(String inputDate) {
try { try {
// Parsing tanggal dari string input // Parsing tanggal dari string input
DateTime date = DateFormat('dd-MM-yyyy').parse(inputDate); DateTime date = DateFormat('dd-MM-yyyy', 'id').parse(inputDate);
// Format tanggal ke '30 Des 2023' // Format tanggal ke '30 Des 2023'
String formattedDate = DateFormat('dd MMM yyyy', 'id').format(date); String formattedDate = DateFormat('dd MMM yyyy', 'id').format(date);
@@ -82,6 +106,99 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
} }
} }
Widget getIconUrl(String categoryid) {
List<Map<String, String>> iconDataList = [
{
'categoryid': '1',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '2',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '3',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_3.svg'
},
{
'categoryid': '4',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '5',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_5.svg'
},
{
'categoryid': '6',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_6.svg'
},
{
'categoryid': '7',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '8',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '9',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '10',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '11',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
{
'categoryid': '12',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_12.svg'
},
{
'categoryid': '13',
'url':
'https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg'
},
];
String urlFix = "";
for (var i = 0; i < iconDataList.length; i++) {
if (iconDataList[i]['categoryid'] == categoryid) {
// urlFix =
// "https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg";
urlFix = iconDataList[i]['url'] ??
"https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg";
}
}
if (urlFix == "") {
urlFix =
"https://devone.aplikasi.web.id/pettycash-media/icon/icon_13.svg";
}
// return urlFix;
return SvgPicture.network(
urlFix,
semanticsLabel: 'Icon category',
);
}
return Row( return Row(
children: [ children: [
// kiri // kiri
@@ -95,22 +212,71 @@ 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) { // ),
if (snapshot.connectionState == ConnectionState.waiting) { // builder: (context, snapshot) {
return CircularProgressIndicator(); // // if (snapshot.connectionState == ConnectionState.waiting) {
} else if (snapshot.hasError) { // // // return CircularProgressIndicator();
return Icon( // // return Text('');
Icons.error, // // } else if (snapshot.hasError) {
color: Colors.red, // // return Icon(
); // // Icons.error,
} else { // // color: Colors.red,
return snapshot.data ?? Container(); // // );
} // // } else {
}, // // return snapshot.data ?? Container();
), // // }
// if (snapshot.connectionState == ConnectionState.done) {
// return snapshot.data ?? Container();
// } else if (snapshot.hasError) {
// return Icon(
// Icons.error,
// color: Colors.red,
// );
// } else {
// return Text('');
// }
// },
// ),
// child: Consumer(
// builder: (context, watch, child) {
// String iconUrl =
// 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg';
// final iconAsyncValue = ref.read(
// iconProvider(
// iconUrl,
// ),
// );
// return iconAsyncValue.when(
// loading: () {
// print('loading iconurl : $iconUrl');
// return CircularProgressIndicator();
// },
// error: (error, stackTrace) {
// print('error iconurl : $iconUrl');
// return Icon(
// Icons.error,
// color: Colors.red,
// );
// },
// data: (iconWidget) {
// print('data iconurl : $iconUrl');
// return iconWidget ?? Container();
// }
// );
// },
// ),
// child: SvgPicture.network(
// 'https://devone.aplikasi.web.id/pettycash-media/icon/icon_$icon_category_id.svg',
// semanticsLabel: 'Icon pizza',
// ),
child: getIconUrl(icon_category_id),
), ),
// tengah // tengah
@@ -158,21 +324,23 @@ class HistoryRowAtasWidget extends HookConsumerWidget {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Container( Container(
// width: Constant.getActualXPhone(context: context, x: 32), width: Constant.getActualXPhone(context: context, x: 80),
height: Constant.getActualYPhone(context: context, y: 19), height: Constant.getActualYPhone(context: context, y: 24),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Constant.bgIconHistory, color: Constant.bgIconHistory,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(6.0), Radius.circular(6.0),
), ),
), ),
child: Padding( child: Align(
padding: EdgeInsets.all(2.0), alignment: Alignment.center,
child: Text( child: Text(
tipe, tipe,
style: Constant.body1_600(context: context).copyWith( style: Constant.body1_600(context: context).copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Constant.pcBtnBackgroundColor), color: Constant.pcBtnBackgroundColor,
fontSize: 14,
),
), ),
), ),
), ),

View File

@@ -9,12 +9,10 @@ import file_selector_macos
import path_provider_foundation import path_provider_foundation
import shared_preferences_foundation import shared_preferences_foundation
import url_launcher_macos import url_launcher_macos
import video_player_avfoundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
} }

View File

@@ -1,68 +1,68 @@
{ {
"images" : [ "info": {
{ "version": 1,
"size" : "16x16", "author": "xcode"
"idiom" : "mac",
"filename" : "app_icon_16.png",
"scale" : "1x"
}, },
{ "images": [
"size" : "16x16", {
"idiom" : "mac", "size": "16x16",
"filename" : "app_icon_32.png", "idiom": "mac",
"scale" : "2x" "filename": "app_icon_16.png",
}, "scale": "1x"
{ },
"size" : "32x32", {
"idiom" : "mac", "size": "16x16",
"filename" : "app_icon_32.png", "idiom": "mac",
"scale" : "1x" "filename": "app_icon_32.png",
}, "scale": "2x"
{ },
"size" : "32x32", {
"idiom" : "mac", "size": "32x32",
"filename" : "app_icon_64.png", "idiom": "mac",
"scale" : "2x" "filename": "app_icon_32.png",
}, "scale": "1x"
{ },
"size" : "128x128", {
"idiom" : "mac", "size": "32x32",
"filename" : "app_icon_128.png", "idiom": "mac",
"scale" : "1x" "filename": "app_icon_64.png",
}, "scale": "2x"
{ },
"size" : "128x128", {
"idiom" : "mac", "size": "128x128",
"filename" : "app_icon_256.png", "idiom": "mac",
"scale" : "2x" "filename": "app_icon_128.png",
}, "scale": "1x"
{ },
"size" : "256x256", {
"idiom" : "mac", "size": "128x128",
"filename" : "app_icon_256.png", "idiom": "mac",
"scale" : "1x" "filename": "app_icon_256.png",
}, "scale": "2x"
{ },
"size" : "256x256", {
"idiom" : "mac", "size": "256x256",
"filename" : "app_icon_512.png", "idiom": "mac",
"scale" : "2x" "filename": "app_icon_256.png",
}, "scale": "1x"
{ },
"size" : "512x512", {
"idiom" : "mac", "size": "256x256",
"filename" : "app_icon_512.png", "idiom": "mac",
"scale" : "1x" "filename": "app_icon_512.png",
}, "scale": "2x"
{ },
"size" : "512x512", {
"idiom" : "mac", "size": "512x512",
"filename" : "app_icon_1024.png", "idiom": "mac",
"scale" : "2x" "filename": "app_icon_512.png",
} "scale": "1x"
], },
"info" : { {
"version" : 1, "size": "512x512",
"author" : "xcode" "idiom": "mac",
} "filename": "app_icon_1024.png",
"scale": "2x"
}
]
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -1,6 +1,14 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
archive:
dependency: transitive
description:
name: archive
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
url: "https://pub.dev"
source: hosted
version: "3.4.10"
args: args:
dependency: transitive dependency: transitive
description: description:
@@ -49,6 +57,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.3"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
url: "https://pub.dev"
source: hosted
version: "0.4.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@@ -77,10 +101,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: cross_file name: cross_file
sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e sha256: "2f9d2cbccb76127ba28528cb3ae2c2326a122446a83de5a056aaa3880d3882c5"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.3.3+8" version: "0.3.3+7"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@@ -214,6 +238,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.18.6" version: "0.18.6"
flutter_launcher_icons:
dependency: "direct main"
description:
name: flutter_launcher_icons
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted
version: "0.13.1"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
@@ -284,10 +316,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: http name: http
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139 sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.2" version: "1.1.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@@ -296,6 +328,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.2" version: "4.0.2"
image:
dependency: transitive
description:
name: image
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
url: "https://pub.dev"
source: hosted
version: "4.1.4"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -368,6 +408,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.17.0" version: "0.17.0"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
url: "https://pub.dev"
source: hosted
version: "4.8.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@@ -552,6 +608,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29"
url: "https://pub.dev"
source: hosted
version: "3.7.4"
riverpod: riverpod:
dependency: transitive dependency: transitive
description: description:
@@ -793,10 +857,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: video_player name: video_player
sha256: fbf28ce8bcfe709ad91b5789166c832cb7a684d14f571a81891858fefb5bb1c2 sha256: "74b86e63529cf5885130c639d74cd2f9232e7c8a66cbecbddd1dcb9dbd060d1e"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.8.2" version: "2.7.2"
video_player_android: video_player_android:
dependency: transitive dependency: transitive
description: description:
@@ -809,10 +873,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: video_player_avfoundation name: video_player_avfoundation
sha256: "309e3962795e761be010869bae65c0b0e45b5230c5cee1bec72197ca7db040ed" sha256: bf1a1322bf68bccd349982ba1f5a41314a3880861fb9a93d25d6d0a2345845f0
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.6" version: "2.4.11"
video_player_platform_interface: video_player_platform_interface:
dependency: transitive dependency: transitive
description: description:
@@ -825,10 +889,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: video_player_web name: video_player_web
sha256: "34beb3a07d4331a24f7e7b2f75b8e2b103289038e07e65529699a671b6a6e2cb" sha256: "9c34a243785feca23148bfcd772dbb803d63c9304488177ec4f3f4463802fcb7"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" version: "2.0.17"
web: web:
dependency: transitive dependency: transitive
description: description:
@@ -861,6 +925,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.3.0" version: "6.3.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
sdks: sdks:
dart: ">=3.2.0 <4.0.0" dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.16.0" flutter: ">=3.10.0"

View File

@@ -1,4 +1,5 @@
name: app_petty_cash name: app_petty_cash
# name: PettyCash
description: A new Flutter project. description: A new Flutter project.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
@@ -51,6 +52,7 @@ dependencies:
top_snackbar_flutter: ^3.1.0 top_snackbar_flutter: ^3.1.0
url_launcher: ^6.1.13 url_launcher: ^6.1.13
flutter_svg: ^2.0.9 flutter_svg: ^2.0.9
flutter_launcher_icons: ^0.13.1
image_picker: ^1.0.7 image_picker: ^1.0.7
video_player: ^2.7.2 video_player: ^2.7.2
photo_view: ^0.14.0 photo_view: ^0.14.0
@@ -71,6 +73,24 @@ dev_dependencies:
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "images/logo_apk_v2.png"
min_sdk_android: 21 # android min sdk min:16, default 21
web:
generate: true
image_path: "images/logo_apk_v2.png"
background_color: "#00FFFFFF"
theme_color: "#00FFFFFF"
windows:
generate: true
image_path: "images/logo_apk_v2.png"
icon_size: 48 # min:48, max:256, default: 48
macos:
generate: true
image_path: "images/logo_apk_v2.png"
# The following section is specific to Flutter packages. # The following section is specific to Flutter packages.
flutter: flutter:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -3,8 +3,8 @@
"short_name": "app_petty_cash", "short_name": "app_petty_cash",
"start_url": ".", "start_url": ".",
"display": "standalone", "display": "standalone",
"background_color": "#0175C2", "background_color": "#00FFFFFF",
"theme_color": "#0175C2", "theme_color": "#00FFFFFF",
"description": "A new Flutter project.", "description": "A new Flutter project.",
"orientation": "portrait-primary", "orientation": "portrait-primary",
"prefer_related_applications": false, "prefer_related_applications": false,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB