Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mobile): change type, build #38

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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