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

Menu tab #360

Open
wants to merge 23 commits into
base: development
Choose a base branch
from
Open

Menu tab #360

wants to merge 23 commits into from

Conversation

AbedrahmanYassen
Copy link

I have made the menu tab and used the logic at the settings screen in this tab, after that I have deleted the settings screen.

@Xazin
Copy link
Member

Xazin commented Feb 12, 2023

Seems the analyzer is complaining.

In VSCode, it's a good idea to enable the "Format file on Save" option, such that the dart formatter will always make sure your files are formatted properly.

lib/main.dart Outdated
@@ -1,4 +1,4 @@
import 'dart:async';
import 'dart:async';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why another space?

Widget _buildSubTitle(
{required String subTitle,
double paddingTop = 0.0,
double paddingBottom = 0.0}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma for formatting

Comment on lines 17 to 23
class MenuPage extends StatefulWidget {
const MenuPage({Key? key}) : super(key: key);

@override
State<MenuPage> createState() => _MenuTabState();
}

class _MenuTabState extends State<MenuPage> {
@override
Widget build(BuildContext context) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason for this being a Statefulwidget, can be stateless.

Comment on lines 42 to 43
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"Menu",
style: TextStyle(
fontSize: 28,
fontFamily: "Rubik",
fontWeight: FontWeight.w700,
),
),
IconButton(
onPressed: () {},
icon: Icon(
Icons.search,
color: kPrimaryColor600,
size: 21.08,
),
),
],
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should most likely be a common widget. Best to extract it.

"Menu",
style: TextStyle(
fontSize: 28,
fontFamily: "Rubik",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to define fontFamily

),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma for Formatting

SizedBox(
height: 30,
),
Container(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a Widget itself as well.

),
),
_buildSubTitle(
subTitle: "Account", paddingTop: 38.5, paddingBottom: 20),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma for formatting

Comment on lines 28 to 38
class _AvatarAndInfoState extends State<AvatarAndInfo> {
late final IUserRepository _userRepository;
File? _image;
@override
void initState() {
super.initState();
_userRepository = getIt<IUserRepository>();
}
@override
Widget build(BuildContext context) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love to see some line breaks..

Comment on lines 41 to 45
// ProfilePicture(
// maxRadius: 40,
// profileImage:
// '${dotenv.get('BASE_STATIC_ENDPOINT_URL')}/${widget.pictureUrl}',
// ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment on lines 48 to 46
profileImage: widget.pictureUrl !=
null
? '${dotenv.get('BASE_STATIC_ENDPOINT_URL')}/${widget.pictureUrl}'
: null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null check but if null then you return null? Look into ?? operator.

Comment on lines 76 to 77
},stream: _userRepository.observeUser()
,),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting?

Comment on lines 72 to 74
} else {
return const Text('...');
}
Copy link
Member

@Xazin Xazin Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the else, just do:

if (snapshot.hasData) {
  return Text(snapshot.data!.phoneNumber!, style: phoneNumberTextStyle);
}

return const Text('...', style: phoneNumberTextStyle);

@@ -15,7 +15,7 @@ class BuildInformationTile extends StatelessWidget {
const SizedBox(height: 50),
const SizedBox(
width: 56,
child: Image(image: AssetImage('assets/images/build_info.png')),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not using build_info.png anywhere else, we can delete it from the assets folder.

{Key? key,
required this.onTap,
required this.iconWidget,
required this.label})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma for formatting

import '../../themes/constants.dart';

class LegalInfoAndPoliciesWidget extends StatefulWidget {
final onTap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be typed

Comment on lines 30 to 32
onTap:(){
widget.onTap();
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onTap:(){
widget.onTap();
},
onTap:() => widget.onTap(),

Comment on lines 27 to 29
const Color kPrimaryColor600 = Color(0xFF2EB494);
const TextStyle kCaption1 = TextStyle(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line break?

Comment on lines 56 to 58



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many line breaks, use the formatter

pubspec.yaml Outdated
@@ -39,6 +39,7 @@ dependencies:
flutter_bloc: ^8.1.1
flutter_dotenv: ^5.0.2
freezed_annotation: ^2.2.0
fvm: ^2.4.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? We don't use it nor need it?

pubspec.yaml Outdated
Comment on lines 81 to 82
dependency_overrides:
firebase_core_platform_interface: 4.5.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need?

@Xazin
Copy link
Member

Xazin commented Feb 14, 2023

Formatter still fails

@Xazin
Copy link
Member

Xazin commented Feb 28, 2023

@AbedrahmanYassen How is it going?

I made sure all the screens are formatted, what can be the problem?

It's specifically complaining about Changed lib/presentation/home/home_screen.dart Changed lib/presentation/routes/app_routes.dart - You can try to run the dart format command and see.

Tests are also failing

Copy link
Member

@Xazin Xazin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove .env.example? It's crucial for it to be there.

);
}

Widget _buildSubTitle({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use methods returning Widgets if there is no reason to do so.

Make it into a StatelessWidget with a constant constructor. Functions and methods returning widgets that are used in Build methods are a pitfall for useless rebuilding.

Comment on lines +115 to +124
SizedBox(
width: 306,
child: Text(
"View and update your account and contact information that is associated with your CollAction account.",
style: TextStyle(
fontSize: 12,
color: kPrimaryColor300,
fontWeight: FontWeight.w400),
),
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using a fixed width here (why even a sizedbox?)? This won't make it look well on devices.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix it soon, sorry I got exams 😥.

@Xazin
Copy link
Member

Xazin commented Mar 16, 2023

I've pushed a commit.

There were a lot of discrepancies according to Design. Take a look at my commit and it's changes, and have the figma beside you when you look it through.

Some of the generic mistakes:

  • Don't use fixed sizing for Dynamically Sized Widgets
  • When using BLoC, remember to account for loading state, otherwise you'll get a grey/red screen due to null guarantee ! where not applicable
  • Size by spacing, correct spacing, font size, icon sizes, makes a bigger chance it's going to look according to design

And some other minor things.

@Xazin Xazin requested a review from wizlif March 16, 2023 07:22
Copy link
Collaborator

@wizlif wizlif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AbedrahmanYassen The design looks good, just add some fixes.

lib/presentation/menu/menu_screen.dart Outdated Show resolved Hide resolved
lib/presentation/menu/menu_screen.dart Outdated Show resolved Hide resolved
Comment on lines 24 to 25
padding: const EdgeInsets.only(left: 20, right: 54) +
const EdgeInsets.symmetric(vertical: 10),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this. Use EdgeInsets.fromLTRB

Comment on lines 40 to 44
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: kPrimaryColor300,
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not easily visible but we could take into consideration the line height from figma just to make it pixel perfect.

Same for other text styles.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how much line-height should I add ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the figma


import '../../themes/constants.dart';

class HeaderBar extends StatelessWidget {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retire this after implementation of AppBar instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the implementation of the search bar, I think It's easier to implement the search bar, if It's like this not an AppBar, What do you think?

children: [
AvatarAndInfo(
avatar: avatar,
phoneNumber: '+31 612345678',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a TODO: To get the phone number from the profile.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to get the phone number from the profile, once the user has signed in, the phone number will be showed.

@@ -23,7 +24,7 @@ class ProfilePicture extends StatelessWidget {

if (profileImage != null && imageProvider == null) {
imageProvider = NetworkImage(
profileImage!,
"${dotenv.env['BASE_STATIC_ENDPOINT_URL']}/$profileImage",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a config file with static url instead of directly using dotenv.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also the reason the profile_picture_test.dart is failing

@@ -19,8 +19,6 @@ class BuildInformationBloc
on<BuildInformationEvent>((event, emit) async {
await event.when(
fetch: () async {
emit(const BuildInformationState.loading());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for removing the loading state ??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also the reason the build_information_test and building_information_bloc_test are failing

Copy link
Member

@Xazin Xazin Mar 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is tricky, it should be the initial state of the BLOC

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blocTest expects only emitted values when an event is added. So skipping the initial state.

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #360 (5012b82) into development (1e9981e) will decrease coverage by 9.39%.
The diff coverage is 15.94%.

@@               Coverage Diff               @@
##           development     #360      +/-   ##
===============================================
- Coverage        65.88%   56.49%   -9.39%     
===============================================
  Files              161      157       -4     
  Lines             4095     4064      -31     
===============================================
- Hits              2698     2296     -402     
- Misses            1397     1768     +371     
Impacted Files Coverage Δ
lib/application/auth/auth_bloc.dart 0.00% <ø> (-49.40%) ⬇️
.../application/participation/participation_bloc.dart 0.00% <0.00%> (ø)
lib/application/user/profile/profile_event.dart 0.00% <0.00%> (ø)
...application/user/profile_tab/profile_tab_bloc.dart 0.00% <0.00%> (-87.50%) ⬇️
lib/core/config/network_config.dart 50.00% <ø> (-16.67%) ⬇️
lib/domain/user/user.dart 100.00% <ø> (ø)
.../infrastructure/auth/firebase_auth_repository.dart 45.16% <0.00%> (+0.95%) ⬆️
...astructure/crowdaction/crowdaction_repository.dart 0.00% <0.00%> (-100.00%) ⬇️
...ucture/participation/participation_repository.dart 0.00% <0.00%> (-100.00%) ⬇️
lib/presentation/auth/auth_screen.dart 1.96% <0.00%> (-0.04%) ⬇️
... and 34 more

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants