Skip to content

Commit

Permalink
Merge pull request #38 from thaidmfinnick/improve_mobile/ready_deploy
Browse files Browse the repository at this point in the history
fix(mobile): change type, build
  • Loading branch information
thaidmfinnick authored Dec 30, 2024
2 parents af1f41b + e2c4b17 commit a2229d4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
37 changes: 21 additions & 16 deletions mobile/lib/features/home/view/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ class _HomeScreenState extends State<HomeScreen> {
..add(OpenMessageTerminated())
..add(ReceiveMessageForeground()),
child: _currentIndex == 0 ? adminWidget
: _currentIndex == 1 ? StatisticScreen(householdStatisticData: householdData["statistic"] ?? {}, scraperStatisticData: scraperData["statistic"] ?? {})
: _currentIndex == 1 ?
StatisticScreen(
householdStatisticData: householdData["statistic"] ?? {},
scraperStatisticData: scraperData["statistic"] ?? {},
roleId: roleId,
)
: const UserInfo(),
),
);
Expand All @@ -259,6 +264,21 @@ class CardInfoWidget extends StatelessWidget {
),
child: Stack(
children: [
Positioned(
right: -5,
bottom: -20,
child: ShaderMask(
shaderCallback: (Rect bounds) {
return const LinearGradient(
colors: [Color(0xFFFFFCF0), Color(0xFFC8E6C9)], // Define your gradient colors here
tileMode: TileMode.clamp,
begin: Alignment.centerLeft,
end: Alignment.bottomRight,
).createShader(bounds);
},
child: icon
),
),
Container(
padding: const EdgeInsets.all(14),
child: Column(
Expand All @@ -278,21 +298,6 @@ class CardInfoWidget extends StatelessWidget {
],
),
),
Positioned(
right: -5,
bottom: -20,
child: ShaderMask(
shaderCallback: (Rect bounds) {
return const LinearGradient(
colors: [Color(0xFFFFFCF0), Color(0xFFC8E6C9)], // Define your gradient colors here
tileMode: TileMode.clamp,
begin: Alignment.centerLeft,
end: Alignment.bottomRight,
).createShader(bounds);
},
child: icon
),
),
],
),
);
Expand Down
12 changes: 8 additions & 4 deletions mobile/lib/features/home/view/statistic_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import 'package:flutter/material.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

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

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

@override
Widget build(BuildContext context) {
final Map allData = isHouseholdTab ? (widget.householdStatisticData) : (widget.scraperStatisticData);
final Map allData = widget.roleId == 1 ?
isHouseholdTab ? (widget.householdStatisticData) : (widget.scraperStatisticData)
: widget.roleId == 2 ? (widget.householdStatisticData)
: widget.roleId == 3 ? (widget.scraperStatisticData)
: {};
return Column(
children: [
HeaderWidget(
Expand Down Expand Up @@ -58,8 +63,7 @@ class _StatisticScreenState extends State<StatisticScreen> {
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});
return UserContributionWidget(oneDayData: {...e, "role_id": widget.roleId});
}).toList()
else
const Center(
Expand Down
4 changes: 3 additions & 1 deletion mobile/lib/features/user/view/user_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class _UserInfoState extends State<UserInfo> {
text: "Xác thực sinh trắc học",
icon: PhosphorIcons.regular.fingerprint,
hasSwitch: true,
onToggleSwitch: (p0) => () => Utils.showDialogWarningError(context, false, "Chức năng đang được phát triển"),
onToggleSwitch: (p0) {
return Utils.showDialogWarningError(context, false, "Chức năng đang được phát triển");
},
),
NavigationButton(
text: "Đăng xuất",
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+12
version: 0.0.1+13

environment:
sdk: ^3.5.3
Expand Down

0 comments on commit a2229d4

Please sign in to comment.