Skip to content

Commit

Permalink
Merge pull request #26 from thaidmfinnick/fix_mobile/no_data
Browse files Browse the repository at this point in the history
fix(mobile): no data statistic screen
  • Loading branch information
thaidmfinnick authored Dec 24, 2024
2 parents 5648766 + 995ae44 commit bc53fba
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 132 deletions.
1 change: 1 addition & 0 deletions mobile/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ app.*.map.json
/android/app/release

pubspec.lock
*/Podfile.lock
123 changes: 0 additions & 123 deletions mobile/ios/Podfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion mobile/lib/features/home/view/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class _HomeScreenState extends State<HomeScreen> {
..add(OpenMessageTerminated())
..add(ReceiveMessageForeground()),
child: _currentIndex == 0 ? adminWidget
: _currentIndex == 1 ? const StatisticScreen()
: _currentIndex == 1 ? StatisticScreen(householdStatisticData: householdData["statistic"] ?? {}, scraperStatisticData: scraperData["statistic"] ?? {})
: const UserInfo(),
),
);
Expand Down
18 changes: 11 additions & 7 deletions mobile/lib/features/home/view/statistic_screen.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'package:cecr_unwomen/constants/color_constants.dart';
import 'package:cecr_unwomen/features/home/view/component/header_widget.dart';
import 'package:cecr_unwomen/features/home/view/component/tab_bar_widget.dart';
import 'package:cecr_unwomen/features/home/view/contribution_screen.dart';
import 'package:cecr_unwomen/utils.dart';
import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class StatisticScreen extends StatefulWidget {
const StatisticScreen({super.key});
const StatisticScreen({super.key, required this.householdStatisticData, required this.scraperStatisticData});
final Map householdStatisticData;
final Map scraperStatisticData;

@override
State<StatisticScreen> createState() => _StatisticScreenState();
Expand All @@ -24,6 +27,7 @@ class _StatisticScreenState extends State<StatisticScreen> {

@override
Widget build(BuildContext context) {
final Map allData = isHouseholdTab ? (widget.householdStatisticData) : (widget.scraperStatisticData);
return Column(
children: [
HeaderWidget(
Expand Down Expand Up @@ -52,12 +56,12 @@ class _StatisticScreenState extends State<StatisticScreen> {
child: Column(
children: [
BarWidget(isHousehold: isHouseholdTab, changeBar: changeBar),
// if (allData["overall_data_one_month"] != null && allData["overall_data_one_month"].isNotEmpty)
// ...allData["overall_data_one_month"].map((e) {
// final int roleIdUser = isHouseholdTab ? 2 : 3;
// return UserContributionWidget(oneDayData: {...e, "role_id": roleIdUser});
// }).toList()
// else
if (allData["overall_data_one_month"] != null && allData["overall_data_one_month"].isNotEmpty)
...allData["overall_data_one_month"].map((e) {
final int roleIdUser = isHouseholdTab ? 2 : 3;
return UserContributionWidget(oneDayData: {...e, "role_id": roleIdUser});
}).toList()
else
const Center(
child: Text("Không có dữ liệu", style: TextStyle(
color: Color(0xFF808082),
Expand Down
2 changes: 1 addition & 1 deletion mobile/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "WazNet (Waste zero, Net zero) is a mobile app that helps users tra
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.1+10
version: 0.0.1+11

environment:
sdk: ^3.5.3
Expand Down

0 comments on commit bc53fba

Please sign in to comment.