- Wallet EnakPoint & EnakCoin: beranda, riwayat, saldo kedaluwarsa, kode bayar, tukar EnakCoin, transfer - PIN (buat, ganti, lupa), outlet, riwayat order, game spin - Halaman community, webview, coming soon, dan ikon menu beranda baru - Redesign Reward Saya: kartu tiket, filter chip, detail kode + QR - Hapus customer point loader, menu, dan checkout lama - Base URL ke enaklo-pos-api.altru.id Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
299 lines
7.8 KiB
Dart
299 lines
7.8 KiB
Dart
import '../presentation/components/assets/assets.gen.dart';
|
|
|
|
// Models
|
|
class CommunityMember {
|
|
final String id;
|
|
final String name;
|
|
final String? badge;
|
|
|
|
const CommunityMember({required this.id, required this.name, this.badge});
|
|
|
|
String get initials {
|
|
final parts = name.trim().split(RegExp(r'\s+'));
|
|
if (parts.length == 1) return parts.first.substring(0, 1).toUpperCase();
|
|
return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
}
|
|
}
|
|
|
|
class CommunityGroup {
|
|
final String id;
|
|
final String name;
|
|
final String emoji;
|
|
final String description;
|
|
final String coverImage;
|
|
final int memberCount;
|
|
final int postPerDay;
|
|
final List<String> tags;
|
|
final bool isJoined;
|
|
|
|
/// Indeks warna lembut di [CommunityColor.tints].
|
|
final int tint;
|
|
|
|
const CommunityGroup({
|
|
required this.id,
|
|
required this.name,
|
|
required this.emoji,
|
|
required this.description,
|
|
required this.coverImage,
|
|
required this.memberCount,
|
|
required this.postPerDay,
|
|
required this.tags,
|
|
required this.tint,
|
|
this.isJoined = false,
|
|
});
|
|
}
|
|
|
|
class CommunityPost {
|
|
final String id;
|
|
final CommunityMember author;
|
|
final CommunityGroup group;
|
|
final String content;
|
|
final String? image;
|
|
final String? merchantName;
|
|
final DateTime createdAt;
|
|
final int likeCount;
|
|
final int commentCount;
|
|
final bool isLiked;
|
|
|
|
const CommunityPost({
|
|
required this.id,
|
|
required this.author,
|
|
required this.group,
|
|
required this.content,
|
|
required this.createdAt,
|
|
this.image,
|
|
this.merchantName,
|
|
this.likeCount = 0,
|
|
this.commentCount = 0,
|
|
this.isLiked = false,
|
|
});
|
|
}
|
|
|
|
class CommunityComment {
|
|
final String id;
|
|
final CommunityMember author;
|
|
final String content;
|
|
final DateTime createdAt;
|
|
final int likeCount;
|
|
|
|
const CommunityComment({
|
|
required this.id,
|
|
required this.author,
|
|
required this.content,
|
|
required this.createdAt,
|
|
this.likeCount = 0,
|
|
});
|
|
}
|
|
|
|
class CommunityEvent {
|
|
final String id;
|
|
final String groupId;
|
|
final String title;
|
|
final String location;
|
|
final String image;
|
|
final DateTime startAt;
|
|
final int attendeeCount;
|
|
final int quota;
|
|
final String? reward;
|
|
final List<CommunityMember> attendees;
|
|
|
|
const CommunityEvent({
|
|
required this.id,
|
|
required this.groupId,
|
|
required this.title,
|
|
required this.location,
|
|
required this.image,
|
|
required this.startAt,
|
|
required this.attendeeCount,
|
|
required this.quota,
|
|
required this.attendees,
|
|
this.reward,
|
|
});
|
|
}
|
|
|
|
// Sample data
|
|
const currentMember = CommunityMember(id: 'me', name: 'Kamu');
|
|
|
|
const _members = [
|
|
CommunityMember(id: 'm1', name: 'Nadia Putri', badge: 'Top Foodie'),
|
|
CommunityMember(id: 'm2', name: 'Raka Pratama'),
|
|
CommunityMember(id: 'm3', name: 'Salsa Amelia', badge: 'Kopi Lover'),
|
|
CommunityMember(id: 'm4', name: 'Dimas Haryo'),
|
|
CommunityMember(id: 'm5', name: 'Intan Lestari'),
|
|
CommunityMember(id: 'm6', name: 'Bayu Saputra', badge: 'Pedas Master'),
|
|
];
|
|
|
|
final List<CommunityGroup> communityGroups = [
|
|
CommunityGroup(
|
|
id: 'g1',
|
|
name: 'Pecinta Bakso',
|
|
emoji: '🍜',
|
|
description:
|
|
'Tempat berbagi rekomendasi bakso terenak, dari urat sampai mercon. '
|
|
'Yuk kulineran bareng!',
|
|
coverImage: Assets.images.bakso343.path,
|
|
memberCount: 12480,
|
|
postPerDay: 86,
|
|
tags: ['Bakso', 'Kuliner Lokal', 'Review'],
|
|
tint: 0,
|
|
isJoined: true,
|
|
),
|
|
CommunityGroup(
|
|
id: 'g2',
|
|
name: 'Ngopi Santai',
|
|
emoji: '☕',
|
|
description:
|
|
'Obrolan santai soal kopi, manual brew, dan coffee shop nyaman '
|
|
'buat kerja atau nongkrong.',
|
|
coverImage: Assets.images.tumulu.path,
|
|
memberCount: 8920,
|
|
postPerDay: 54,
|
|
tags: ['Kopi', 'Nongkrong', 'WFC'],
|
|
tint: 1,
|
|
isJoined: true,
|
|
),
|
|
CommunityGroup(
|
|
id: 'g3',
|
|
name: 'Ramen Hunter',
|
|
emoji: '🍥',
|
|
description:
|
|
'Berburu semangkuk ramen terbaik. Bagikan kuah favoritmu dan '
|
|
'temukan kedai baru.',
|
|
coverImage: Assets.images.ramenmulu.path,
|
|
memberCount: 5310,
|
|
postPerDay: 31,
|
|
tags: ['Ramen', 'Jepang'],
|
|
tint: 2,
|
|
),
|
|
CommunityGroup(
|
|
id: 'g4',
|
|
name: 'Tim Pedas',
|
|
emoji: '🌶️',
|
|
description:
|
|
'Buat kamu yang nggak kenyang kalau belum kepedesan. Tantangan '
|
|
'level pedas tiap minggu!',
|
|
coverImage: Assets.images.woku.path,
|
|
memberCount: 7640,
|
|
postPerDay: 47,
|
|
tags: ['Pedas', 'Challenge'],
|
|
tint: 3,
|
|
),
|
|
];
|
|
|
|
final List<CommunityPost> communityPosts = [
|
|
CommunityPost(
|
|
id: 'p1',
|
|
author: _members[0],
|
|
group: communityGroups[0],
|
|
content:
|
|
'Akhirnya nyobain bakso urat di Bakso 343 🤤 Kuahnya bening tapi '
|
|
'kaldunya kerasa banget, uratnya juga kenyal pas. Porsi besar, '
|
|
'harga masih ramah dompet. Wajib coba sambal ijonya!',
|
|
image: Assets.images.bakso343.path,
|
|
merchantName: 'Bakso 343',
|
|
createdAt: DateTime.now().subtract(const Duration(minutes: 25)),
|
|
likeCount: 128,
|
|
commentCount: 24,
|
|
isLiked: true,
|
|
),
|
|
CommunityPost(
|
|
id: 'p2',
|
|
author: _members[2],
|
|
group: communityGroups[1],
|
|
content:
|
|
'Rekomendasi tempat WFC yang colokannya banyak dan wifi kencang? '
|
|
'Aku biasanya di Tumulu Coffee, tapi pengen coba suasana baru ☕',
|
|
createdAt: DateTime.now().subtract(const Duration(hours: 2)),
|
|
likeCount: 42,
|
|
commentCount: 31,
|
|
),
|
|
CommunityPost(
|
|
id: 'p3',
|
|
author: _members[5],
|
|
group: communityGroups[3],
|
|
content:
|
|
'Level 5 Woku Pedas sukses kutaklukkan 🔥 Yang berani ikut challenge '
|
|
'minggu depan, kumpul di komen ya!',
|
|
image: Assets.images.woku.path,
|
|
merchantName: 'Woku Pedas',
|
|
createdAt: DateTime.now().subtract(const Duration(hours: 5)),
|
|
likeCount: 256,
|
|
commentCount: 58,
|
|
),
|
|
CommunityPost(
|
|
id: 'p4',
|
|
author: _members[1],
|
|
group: communityGroups[2],
|
|
content:
|
|
'Shoyu ramen di Ramenmulu ternyata enak banget, chashu-nya lumer. '
|
|
'Next mau coba yang tantan.',
|
|
image: Assets.images.ramenmulu.path,
|
|
merchantName: 'Ramenmulu',
|
|
createdAt: DateTime.now().subtract(const Duration(days: 1, hours: 3)),
|
|
likeCount: 87,
|
|
commentCount: 12,
|
|
),
|
|
];
|
|
|
|
final List<CommunityComment> communityComments = [
|
|
CommunityComment(
|
|
id: 'c1',
|
|
author: _members[3],
|
|
content: 'Setuju! Sambal ijonya juara, aku sampai nambah dua kali 😆',
|
|
createdAt: DateTime.now().subtract(const Duration(minutes: 12)),
|
|
likeCount: 8,
|
|
),
|
|
CommunityComment(
|
|
id: 'c2',
|
|
author: _members[4],
|
|
content: 'Buka sampai jam berapa ya kak? Mau mampir pulang kerja.',
|
|
createdAt: DateTime.now().subtract(const Duration(minutes: 8)),
|
|
likeCount: 2,
|
|
),
|
|
CommunityComment(
|
|
id: 'c3',
|
|
author: _members[0],
|
|
content: '@Intan sampai jam 10 malam kok, aman 👍',
|
|
createdAt: DateTime.now().subtract(const Duration(minutes: 3)),
|
|
likeCount: 1,
|
|
),
|
|
];
|
|
|
|
final List<CommunityEvent> communityEvents = [
|
|
CommunityEvent(
|
|
id: 'e1',
|
|
groupId: 'g1',
|
|
title: 'Kopdar Pecinta Bakso',
|
|
location: 'Bakso 343, Jakarta Selatan',
|
|
image: Assets.images.bakso343.path,
|
|
startAt: DateTime.now().add(const Duration(days: 4, hours: 2)),
|
|
attendeeCount: 38,
|
|
quota: 50,
|
|
reward: '+500 EnakPoint',
|
|
attendees: _members.sublist(0, 4),
|
|
),
|
|
CommunityEvent(
|
|
id: 'e2',
|
|
groupId: 'g2',
|
|
title: 'Cupping Session Bareng Barista',
|
|
location: 'Tumulu Coffee, Bandung',
|
|
image: Assets.images.tumulu.path,
|
|
startAt: DateTime.now().add(const Duration(days: 9)),
|
|
attendeeCount: 18,
|
|
quota: 20,
|
|
attendees: _members.sublist(2, 5),
|
|
),
|
|
CommunityEvent(
|
|
id: 'e3',
|
|
groupId: 'g4',
|
|
title: 'Spicy Challenge Level 10',
|
|
location: 'Woku Pedas, Surabaya',
|
|
image: Assets.images.woku.path,
|
|
startAt: DateTime.now().add(const Duration(days: 15)),
|
|
attendeeCount: 64,
|
|
quota: 100,
|
|
reward: '+1.000 EnakCoin',
|
|
attendees: _members.sublist(3),
|
|
),
|
|
];
|