feat: update profit shareing
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
This commit is contained in:
@@ -6,10 +6,20 @@ import '../../../../domain/analytic/analytic.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
|
||||
/// Warna tetap untuk tiap pos bagi hasil supaya konsisten di semua bagian.
|
||||
/// Sengaja pakai warna jenuh, bukan default Material yang pucat.
|
||||
class ProfitSharingColor {
|
||||
static const Color purchase = Color(0xFF2196F3);
|
||||
static const Color owner = Color(0xFF4CAF50);
|
||||
static const Color team = Color(0xFFFF9800);
|
||||
static const Color owner = Color(0xFF00B341);
|
||||
static const Color team = Color(0xFFFF6A00);
|
||||
|
||||
// Status margin (Sehat / Waspada / Tidak Sehat).
|
||||
static const Color healthy = Color(0xFF00B341);
|
||||
static const Color watch = Color(0xFFFF9500);
|
||||
static const Color critical = Color(0xFFFF1E3C);
|
||||
|
||||
// Tile ringkasan.
|
||||
static const Color subCategory = AppColor.primary;
|
||||
static const Color product = Color(0xFF7B2FF7);
|
||||
static const Color order = Color(0xFF00A3D9);
|
||||
}
|
||||
|
||||
class ProfitSharingAllocation extends StatelessWidget {
|
||||
@@ -21,11 +31,14 @@ class ProfitSharingAllocation extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final total = budget.total;
|
||||
final percentages = budget.percentages;
|
||||
// Fee owner berbeda tiap kategori induk, jadi porsi SDL dihitung dari
|
||||
// Fee owner berbeda tiap kategori induk, jadi porsi dihitung dari
|
||||
// nominalnya; persentase bawaan hanya dipakai saat belum ada omzet.
|
||||
final sdlPercentage = total.hasRevenue
|
||||
? total.sdlPercentage
|
||||
: percentages.owner;
|
||||
final teamPercentage = total.hasRevenue
|
||||
? total.teamPercentage
|
||||
: percentages.team;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
@@ -55,22 +68,10 @@ class ProfitSharingAllocation extends StatelessWidget {
|
||||
|
||||
const SpaceHeight(16),
|
||||
|
||||
ProfitSharingBar(
|
||||
purchase: percentages.purchase,
|
||||
owner: sdlPercentage,
|
||||
team: percentages.team,
|
||||
),
|
||||
ProfitSharingBar(owner: sdlPercentage, team: teamPercentage),
|
||||
|
||||
const SpaceHeight(20),
|
||||
|
||||
_row(
|
||||
context: context,
|
||||
color: ProfitSharingColor.purchase,
|
||||
label: context.lang.share_purchase,
|
||||
percentage: percentages.purchase,
|
||||
amount: total.limitPurchase,
|
||||
),
|
||||
const Divider(height: 24, color: AppColor.borderLight),
|
||||
_row(
|
||||
context: context,
|
||||
color: ProfitSharingColor.owner,
|
||||
@@ -83,7 +84,7 @@ class ProfitSharingAllocation extends StatelessWidget {
|
||||
context: context,
|
||||
color: ProfitSharingColor.team,
|
||||
label: context.lang.share_team,
|
||||
percentage: percentages.team,
|
||||
percentage: teamPercentage,
|
||||
amount: total.limitTeam,
|
||||
),
|
||||
],
|
||||
@@ -117,14 +118,14 @@ class ProfitSharingAllocation extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.12),
|
||||
color: color,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'${percentage.toStringAsFixed(percentage % 1 == 0 ? 0 : 1)}%',
|
||||
style: AppStyle.xs.copyWith(
|
||||
color: color,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColor.textWhite,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -145,16 +146,15 @@ class ProfitSharingAllocation extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// Bar proporsi belanja / SDL (owner) / tim.
|
||||
/// Bar proporsi SDL (owner) / tim dalam persen omzet. Sisa yang belum terbagi
|
||||
/// (backend lama masih menyisihkan porsi belanja) tampil sebagai track kosong.
|
||||
class ProfitSharingBar extends StatelessWidget {
|
||||
final double purchase;
|
||||
final double owner;
|
||||
final double team;
|
||||
final double height;
|
||||
|
||||
const ProfitSharingBar({
|
||||
super.key,
|
||||
required this.purchase,
|
||||
required this.owner,
|
||||
required this.team,
|
||||
this.height = 12,
|
||||
@@ -162,7 +162,7 @@ class ProfitSharingBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final total = purchase + owner + team;
|
||||
final total = owner + team;
|
||||
if (total <= 0) {
|
||||
return Container(
|
||||
height: height,
|
||||
@@ -179,9 +179,9 @@ class ProfitSharingBar extends StatelessWidget {
|
||||
height: height,
|
||||
child: Row(
|
||||
children: [
|
||||
_segment(purchase, ProfitSharingColor.purchase),
|
||||
_segment(owner, ProfitSharingColor.owner),
|
||||
_segment(team, ProfitSharingColor.team),
|
||||
_segment(100 - total, AppColor.borderLight),
|
||||
].whereType<Widget>().toList(),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user