Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
1.0.140
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Nov 3, 2021
1 parent 4d4f89f commit 8a0afac
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 30 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

Mobile App to encourage reducing Food Wastes

## About This App

This app is prototype of Food Busters as part of AIS Jump Thailand Hackathon

The app is incomplete as it's only used to show our idea.

(Most data in this app are mocked up)

## Compatibility

- iOS 🟡 (No Device to test or run)

- Android 🟢 (Minimum 5.0 Recommended 11)

- Windows (WSA) 🔴 (Crash when taking picture)
52 changes: 52 additions & 0 deletions lib/data/dummy_busters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,57 @@ Future<List<Buster>> getTopBustersData() async {
actualRank: 3,
percentileRank: 86,
),
Buster(
username: "Speedwagon420",
pfp:
"https://cdn.myanimelist.net/r/360x360/images/characters/7/196031.jpg?s=1c554a3e9004301e185ef141f6f7c1d9",
actualRank: 4,
percentileRank: 85,
),
Buster(
username: "ILikeDonut",
pfp:
"https://www.online-station.net/wp-content/uploads/2020/02/JoJo1200_1200_628.jpg",
actualRank: 5,
percentileRank: 82,
),
];
}

Future<List<Buster>> getFriendsData() async {
// * Simulate Server Request
await Future.delayed(
const Duration(milliseconds: 1000),
);

return [
Buster(
username: "CaffeMocha",
pfp:
"https://64.media.tumblr.com/1afca247415c0ded1f04a5fe9f167de1/tumblr_ox2pjl9uuE1uctmvwo8_1280.png",
actualRank: 3,
percentileRank: 86,
),
Buster(
username: "THEWORLD",
pfp:
"https://pbs.twimg.com/profile_images/1164228011194892288/w2P19BSw_400x400.jpg",
actualRank: 42,
percentileRank: 69,
),
Buster(
username: "NeverGonnaGiveEnvironmentUp",
pfp:
"https://i.gadgets360cdn.com/large/rick_astley_youtube_1627540038486.jpg?downsize=950:*",
actualRank: 128,
percentileRank: 22,
),
Buster(
username: "ILoveDonut",
pfp:
"https://s.isanook.com/ga/0/rp/r/w850/ya0xa0m1w0/aHR0cHM6Ly9zLmlzYW5vb2suY29tL2dhLzAvdWQvMjIwLzExMDIzNjkvZGVtb25fc2xheWVyX2tpbWV0c3VfeWFpYmFfcmUuanBn.jpg",
actualRank: 255,
percentileRank: 2,
),
];
}
2 changes: 2 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
"thanks_buster_1": "Looks like you've done a great job!",
"thanks_buster_2": "Thanks, Our Food Buster!",
"leaderboard": "LEADERBOARD",
"top_busters": "Top Busters",
"friends": "Friends",
"you_produced": "You produced",
"less_carbon": "less carbon footprint than others",
"less_methane": "less methane produced by using vehicle",
Expand Down
2 changes: 2 additions & 0 deletions lib/l10n/app_th.arb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
"thanks_buster_1": "ดูเหมือนว่าคุณกำลังทำได้ดีเลย",
"thanks_buster_2": "ขอบคุณฟูดบัสเตอร์ของพวกเรา!",
"leaderboard": "ลีดเดอร์บอร์ด",
"top_busters": "ท็อปบัสเตอร์",
"friends": "เพื่อน",
"you_produced": "คุณได้ผลิต",
"less_carbon": "คาร์บอนฟุตปรินท์น้อยกว่าคนอื่น",
"less_methane": "เกิดมีเทนจากการใช้ยานพาหนะน้อยลง",
Expand Down
70 changes: 51 additions & 19 deletions lib/views/mission/mission.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _MyMissionPageState extends State<MyMissionPage> {
}

Widget currentMission(AppLocalizations text) => Container(
height: 200,
height: 370,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
Expand All @@ -60,33 +60,65 @@ class _MyMissionPageState extends State<MyMissionPage> {
child: Column(
children: [
Text(text.current_missions),
FutureBuilder<List<OngoingMission>>(
future: getCurrentMissions(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final data = snapshot.data!;
final loc = MyApp.of(context).localeStrSimp;
return SingleChildScrollView(
child: ListView.builder(
Container(
height: 300,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12.0),
),
child: FutureBuilder<List<OngoingMission>>(
future: getCurrentMissions(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final data = snapshot.data!;
final loc = MyApp.of(context).localeStrSimp;
return ListView.builder(
padding: EdgeInsets.zero,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: data.length,
itemBuilder: (context, index) {
final ms = data[index];
return ListTile(
title: Text(ms.obj.toStr(loc)),
trailing: Row(
title: Column(
children: [
Text(ms.deadlineDate.toString()),
Text(ms.deadlineMonth)
Text(ms.obj.toStr(loc)),
Text(
"${ms.award.toString()} ${text.points}",
style: const TextStyle(
fontWeight: FontWeight.w500,
),
),
],
),
trailing: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
ms.deadlineDate.toString(),
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.w500,
height: 1,
),
),
Text(
ms.deadlineMonth,
style: const TextStyle(
fontSize: 12,
height: 0.5,
),
),
],
),
);
},
),
);
} else {
return const CircularProgressIndicator();
}
},
);
} else {
return const Center(child: CircularProgressIndicator());
}
},
),
)
],
),
Expand Down
48 changes: 40 additions & 8 deletions lib/views/record/leaderboard.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "package:flutter/material.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
import "package:flutter_toggle_tab/flutter_toggle_tab.dart";
import "package:food_busters/components/background.dart";
import "package:food_busters/data/dummy_busters.dart";
import "package:food_busters/models/buster.dart";
Expand All @@ -13,6 +14,8 @@ class LeaderboardPage extends StatefulWidget {
}

class _LeaderboardPageState extends State<LeaderboardPage> {
bool _panel = false;

@override
Widget build(BuildContext context) {
final text = AppLocalizations.of(context)!;
Expand All @@ -32,6 +35,7 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 50),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 8.0,
Expand Down Expand Up @@ -80,7 +84,7 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
height: 320,
height: 350,
decoration: BoxDecoration(
color: lightGreen,
borderRadius: BorderRadius.circular(16.0),
Expand All @@ -92,15 +96,34 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
),
child: Column(
children: [
const Text(
"TOP 3 BUSTERS",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 24,
Padding(
padding: const EdgeInsets.all(8.0),
child: FlutterToggleTab(
width: 80,
borderRadius: 30,
height: 50,
selectedIndex: _panel ? 1 : 0,
selectedTextStyle: const TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.w700,
),
unSelectedTextStyle: const TextStyle(
color: Colors.black87,
fontSize: 14,
fontWeight: FontWeight.w500,
),
labels: [text.top_busters, text.friends],
selectedLabelIndex: (index) {
setState(() {
_panel = index == 0 ? false : true;
});
},
selectedBackgroundColors: const [tan],
),
),
SizedBox(
height: 240,
height: 260,
child: topBusters(text),
),
],
Expand All @@ -118,11 +141,12 @@ class _LeaderboardPageState extends State<LeaderboardPage> {

Widget topBusters(AppLocalizations text) {
return FutureBuilder<List<Buster>>(
future: getTopBustersData(),
future: _panel ? getFriendsData() : getTopBustersData(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final data = snapshot.data!;
return ListView.builder(
padding: EdgeInsets.zero,
scrollDirection: Axis.vertical,
itemCount: data.length,
itemBuilder: (context, index) {
Expand All @@ -144,6 +168,14 @@ class _LeaderboardPageState extends State<LeaderboardPage> {
),
),
),
child: Text(
buster.actualRank.toString(),
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
height: 0.8,
),
),
),
trailing: Column(
children: [
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.135+1350000
version: 1.0.140+1400000

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit 8a0afac

Please sign in to comment.