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

feat(mobile): Write test for notification_domain_layer #66

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Next Next commit
fix(mobile): fix homePage UI
  • Loading branch information
duressaJemal committed Jun 30, 2023
commit a54742fe5933b93713d32d2491ca38b20f3f1757
Original file line number Diff line number Diff line change
Expand Up @@ -27,105 +27,113 @@ class _HomeState extends State<Home> {

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: whiteColor,
appBar: const UpperBar(),
body: BlocBuilder<ApplicationBloc, ApplicationState>(
builder: (context, state) {
if (state is ApplicationLoading) {
return const CircularProgressIndicator();
} else if (state is ApplicationLoaded) {
final subSteps = state.applicationStepEntity[i].subSteps;
final subStepCards = subSteps.map((subStep) {
return CustomCard(
title: subStep.subStepName,
description: subStep.description,
done: subStep.isCompleted,
return Padding(
padding: const EdgeInsets.only(top:16),
child: Scaffold(
backgroundColor: whiteColor,
appBar: const UpperBar(),
body: BlocBuilder<ApplicationBloc, ApplicationState>(
builder: (context, state) {
if (state is ApplicationLoading) {
return Container(
alignment: Alignment.center,
width: 130,
height: 130,
child: const CircularProgressIndicator(),
);
}).toList();
return Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 17, bottom: 17.0),
child: StepperBox(
text: '${i + 1} of ${state.applicationStepEntity.length}',
percentage: (i + 1) / (state.applicationStepEntity.length),
currentStep: state.applicationStepEntity[i].stepName,
nextStep: i != state.applicationStepEntity.length - 1
? state.applicationStepEntity[i + 1].stepName
: "Apply",
} else if (state is ApplicationLoaded) {
final subSteps = state.applicationStepEntity[i].subSteps;
final subStepCards = subSteps.map((subStep) {
return CustomCard(
title: subStep.subStepName,
description: subStep.description,
done: subStep.isCompleted,
);
}).toList();
return Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 17, bottom: 17.0),
child: StepperBox(
text: '${i + 1} of ${state.applicationStepEntity.length}',
percentage: (i + 1) / (state.applicationStepEntity.length),
currentStep: state.applicationStepEntity[i].stepName,
nextStep: i != state.applicationStepEntity.length - 1
? state.applicationStepEntity[i + 1].stepName
: "Apply",
),
),
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: subStepCards,
Expanded(
child: SingleChildScrollView(
child: Column(
children: subStepCards,
),
),
),
),
Padding(
padding: const EdgeInsets.only(top: 15.0, bottom: 15.0),
child: SizedBox(
height: UIConverter.getComponentHeight(context, 48),
child: Align(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
i != 0
? CustomButton(
label: 'Previous',
onTap: () {
if (i > 0) {
setState(() {
i -= 1;
});
}
},
)
: SizedBox(
width: UIConverter.getDeviceWidth(context) > 700
? 124
: UIConverter.getComponentWidth(
context, 124),
height:
UIConverter.getComponentHeight(context, 48),
),
i != state.applicationStepEntity.length - 1
? CustomButton(
label:
i != state.applicationStepEntity.length - 1
? 'Next'
: 'Apply',
onTap: () {
if (i <
state.applicationStepEntity.length - 1) {
setState(() {
i += 1;
});
}
})
: SizedBox(
width: UIConverter.getDeviceWidth(context) > 700
? 124
: UIConverter.getComponentWidth(
context, 124),
height:
UIConverter.getComponentHeight(context, 48),
),
],
Padding(
padding: const EdgeInsets.only(top: 15.0, bottom: 15.0),
child: SizedBox(
height: UIConverter.getComponentHeight(context, 48),
child: Align(
alignment: Alignment.bottomCenter,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
i != 0
? CustomButton(
label: 'Previous',
onTap: () {
if (i > 0) {
setState(() {
i -= 1;
});
}
},
)
: SizedBox(
width: UIConverter.getDeviceWidth(context) > 700
? 124
: UIConverter.getComponentWidth(
context, 124),
height:
UIConverter.getComponentHeight(context, 48),
),
i != state.applicationStepEntity.length - 1
? CustomButton(
label:
i != state.applicationStepEntity.length - 1
? 'Next'
: 'Apply',
onTap: () {
if (i <
state.applicationStepEntity.length - 1) {
setState(() {
i += 1;
});
}
})
: SizedBox(
width: UIConverter.getDeviceWidth(context) > 700
? 124
: UIConverter.getComponentWidth(
context, 124),
height:
UIConverter.getComponentHeight(context, 48),
),
],
),
),
),
),
),
],
);
} else if (state is ApplicationError) {
return Text(state.message);
} else {
return Text("${state is ApplicationInitial}");
}
}),
],
);
} else if (state is ApplicationError) {
return Text(state.message);
} else {
return Text("${state is ApplicationInitial}");
}
}),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,69 @@ class UpperBar extends StatelessWidget implements PreferredSizeWidget {

@override
Widget build(BuildContext context) {
return AppBar(
elevation: 0,
backgroundColor: whiteColor,
title: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Welcome',
style: TextStyle(fontSize: 14, color: whiteGreyColor),
),
SizedBox(height: 4.0), // Use const with SizedBox constructor
Text(
'Joe Doe',
style: TextStyle(
fontSize: 20,
color: userNameColor,
fontWeight: FontWeight.w600),
),
],
),
),
GestureDetector(
onTap: () {
GoRouter.of(context).push('/home/notifications');
context.read<NotificationBloc>().add(GetNotificationsEvent());
},
child: Stack(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: greyColorForIcon, // Use const with Color constructor
return SafeArea(
child: AppBar(
elevation: 0,
backgroundColor: whiteColor,
title:
// margin: EdgeInsets.only(top: 16),
Row(
children: [
const Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Welcome',
style: TextStyle(fontSize: 14, color: whiteGreyColor),
),
SizedBox(height: 4.0), // Use const with SizedBox constructor
Text(
'Joe Doe',
style: TextStyle(
fontSize: 20,
color: userNameColor,
fontWeight: FontWeight.w600),
),
padding: const EdgeInsets.all(5),
height: 50,
width: 50,
margin: const EdgeInsets.only(top: 5),
child: const Icon(
Icons.notifications,
color: blueBlackForAppBar,
size: 24,
],
),
),
GestureDetector(
onTap: () {
GoRouter.of(context).push('/home/notifications');
context.read<NotificationBloc>().add(GetNotificationsEvent());
},
child: Stack(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: greyColorForIcon, // Use const with Color constructor
),
padding: const EdgeInsets.all(5),
height: 50,
width: 50,
margin: const EdgeInsets.only(top: 5),
child: const Icon(
Icons.notifications,
color: blueBlackForAppBar,
size: 24,
),
),
),
Container(
width: 11,
height: 11,
margin: const EdgeInsets.only(left: 33, top: 2),
decoration: const BoxDecoration(
color: primaryColor, // Use const with Color constructor
shape: BoxShape.circle,
Container(
width: 11,
height: 11,
margin: const EdgeInsets.only(left: 33, top: 2),
decoration: const BoxDecoration(
color: primaryColor, // Use const with Color constructor
shape: BoxShape.circle,
),
),
),
],
],
),
),
),
],
],
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class UpperBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0),
padding: const EdgeInsets.only(top: 16, left: 16.0, right: 16.0),
child: Row(
children: [
const Expanded(
Expand Down