3 Commits

Author SHA1 Message Date
Stephen
dc41ad389c [Homepage] 3. add row transaksi 2024-01-17 08:34:31 +07:00
Stephen
150046115d [Homepage] 2. memperbaiki image background card 2024-01-17 08:34:07 +07:00
Stephen
4bfb4f5e8c [Homepage] 1. add homepage screen 2024-01-16 20:20:09 +07:00
8 changed files with 495 additions and 27 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -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
static TextStyle titleH5_600({required BuildContext context}) {
return TextStyle(

View File

@@ -1,3 +1,5 @@
import 'package:app_petty_cash/screen/home/homepage_screen.dart';
import '../screen/change_company/change_company.dart';
import 'package:flutter/material.dart';
@@ -98,7 +100,8 @@ class AppRoute {
textScaleFactor: 1.0,
padding: EdgeInsets.all(0),
),
child: HomeScreen(),
// child: HomeScreen(),
child: HomePageScreen(),
);
});
}

View File

@@ -38,11 +38,12 @@ class MyApp extends StatelessWidget {
},
),
debugShowCheckedModeBanner: false,
initialRoute: loginRoute,
// initialRoute: loginRoute,
// initialRoute: splashScreen,
// initialRoute: transaksiRoute,
// initialRoute: reportRoute,
// initialRoute: testFilePickerRoute,
initialRoute: homeRoute,
onGenerateRoute: AppRoute.generateRoute,
);
}

View 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(),
// ),
// ],
// ),
// ),
// ),
// );
// },
// ),
// ),
]),
),
)
],
),
),
),
),
);
}
}

View 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),
),
],
),
),
),
],
);
}
}

View File

@@ -61,10 +61,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.1"
version: "1.18.0"
convert:
dependency: transitive
description:
@@ -240,14 +240,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.17.0"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
lints:
dependency: transitive
description:
@@ -260,26 +252,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev"
source: hosted
version: "0.12.15"
version: "0.12.16"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "0.5.0"
meta:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
open_file:
dependency: "direct main"
description:
@@ -465,18 +457,18 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
state_notifier:
dependency: transitive
description:
@@ -489,10 +481,10 @@ packages:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -513,10 +505,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
version: "0.6.1"
top_snackbar_flutter:
dependency: "direct main"
description:
@@ -629,6 +621,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.3.0"
win32:
dependency: transitive
description:
@@ -654,5 +654,5 @@ packages:
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.0.6 <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.10.0"