1
0
mirror of https://github.com/Uttkarsh-raj/Plannerly.git synced 2025-12-05 22:06:27 +02:00
This commit is contained in:
Uttkarsh-raj
2023-11-03 23:16:14 +05:30
parent 5770dc9106
commit 1cbbdf1677
2 changed files with 441 additions and 401 deletions

View File

@@ -89,441 +89,481 @@ class _HomeScreenState extends State<HomeScreen> {
final successState = state as HomeLoadedSuccessState;
return Scaffold(
backgroundColor: AppColors.backgroundDark,
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(14.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: size.height * 0.03),
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
body: Padding(
padding: const EdgeInsets.all(14.0),
child: Stack(
children: [
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.menu_outlined,
size: 28,
color: AppColors.white,
SizedBox(height: size.height * 0.03),
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
Icons.menu_outlined,
size: 28,
color: AppColors.white,
),
Icon(
Icons.notifications_outlined,
size: 28,
color: AppColors.white,
),
],
),
Icon(
Icons.notifications_outlined,
size: 28,
color: AppColors.white,
),
],
),
SizedBox(height: size.height * 0.03),
const Text(
"Hi, Jason",
style: TextStyle(
color: AppColors.white,
fontSize: 18,
fontWeight: FontWeight.w300,
),
),
SizedBox(height: size.height * 0.01),
const Text(
"Be productivity today",
style: TextStyle(
color: AppColors.white,
fontSize: 24,
fontWeight: FontWeight.w500,
),
),
SizedBox(height: size.height * 0.038),
Center(
child: Container(
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Expanded(
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Search task',
hintStyle: TextStyle(
color: AppColors.grey,
fontSize: 18,
),
contentPadding: EdgeInsets.all(10),
),
),
),
IconButton(
onPressed: () {},
icon: Icon(
Icons.search_outlined,
size: 28,
color: AppColors.white.withOpacity(0.6),
),
),
],
SizedBox(height: size.height * 0.03),
const Text(
"Hi, Jason",
style: TextStyle(
color: AppColors.white,
fontSize: 18,
fontWeight: FontWeight.w300,
),
),
),
),
SizedBox(height: size.height * 0.025),
Center(
child: Container(
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
SizedBox(height: size.height * 0.01),
const Text(
"Be productivity today",
style: TextStyle(
color: AppColors.white,
fontSize: 24,
fontWeight: FontWeight.w500,
),
),
child: Padding(
padding: const EdgeInsets.all(18.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Task Progress",
style: TextStyle(
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.w400,
),
),
const SizedBox(height: 8),
Text(
"${state.totalRegularTasksCompleted + state.totalUrgentTasksCompleted}/${state.totalRegularTasks + state.totalUrgentTasks} task completed.",
style: TextStyle(
color:
AppColors.white.withOpacity(0.4),
fontSize: 14,
fontWeight: FontWeight.w400,
),
),
],
),
),
Stack(
SizedBox(height: size.height * 0.038),
Center(
child: Container(
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
SizedBox(
height: size.height * 0.07,
width: size.height * 0.07,
child: CircularProgressIndicator(
value: ((state.totalRegularTasksCompleted +
state
.totalUrgentTasksCompleted) ==
0)
? 0
: (state.totalRegularTasksCompleted +
state
.totalUrgentTasksCompleted) /
(state.totalRegularTasks +
state.totalUrgentTasks),
strokeWidth: 7,
valueColor:
const AlwaysStoppedAnimation(
AppColors.buttonBlue),
backgroundColor:
AppColors.white.withOpacity(0.2),
color: AppColors.white,
const Expanded(
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Search task',
hintStyle: TextStyle(
color: AppColors.grey,
fontSize: 18,
),
contentPadding: EdgeInsets.all(10),
),
),
),
SizedBox(
height: size.height * 0.07,
width: size.height * 0.07,
child: Center(
child: Text(
((state.totalRegularTasksCompleted +
state
.totalUrgentTasksCompleted) ==
0)
? "0%"
: "${((state.totalRegularTasksCompleted + state.totalUrgentTasksCompleted) / (state.totalRegularTasks + state.totalUrgentTasks) * 100).toStringAsFixed(1)}%",
style: TextStyle(
color: AppColors.white
.withOpacity(0.8),
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
IconButton(
onPressed: () {},
icon: Icon(
Icons.search_outlined,
size: 28,
color: AppColors.white.withOpacity(0.6),
),
),
],
),
],
),
),
),
),
SizedBox(height: size.height * 0.04),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
height: size.height * 0.25,
width: size.width * 0.45,
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(5.0)
.copyWith(top: 12, bottom: 12),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Urgent Tasks Progress",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 20),
Center(
child: Stack(
children: [
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child: CircularProgressIndicator(
value: (state
.totalUrgentTasksCompleted ==
0)
? 0
: (state.totalUrgentTasksCompleted /
state.totalUrgentTasks),
strokeWidth: 7,
valueColor:
AlwaysStoppedAnimation(
Colors.red[400]),
backgroundColor: AppColors.white
.withOpacity(0.2),
color: AppColors.white,
),
),
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child: Center(
child: Text(
(state.totalUrgentTasksCompleted ==
0)
? "0%"
: "${((state.totalUrgentTasksCompleted / state.totalUrgentTasks) * 100).toStringAsFixed(1)}%",
style: TextStyle(
color: AppColors.white
.withOpacity(0.8),
fontSize: 22,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
),
const SizedBox(height: 16),
Center(
child: Text(
"${state.totalUrgentTasksCompleted}/${state.totalUrgentTasks}",
style: TextStyle(
color: AppColors.white
.withOpacity(0.4),
fontSize: 22,
fontWeight: FontWeight.w400,
),
),
),
],
),
],
),
),
),
Container(
height: size.height * 0.25,
width: size.width * 0.45,
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(5.0)
.copyWith(top: 12, bottom: 12),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Regular Tasks Progress",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
),
SizedBox(height: size.height * 0.025),
Center(
child: Container(
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(18.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Task Progress",
style: TextStyle(
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.w400,
),
),
const SizedBox(height: 8),
Text(
"${state.totalRegularTasksCompleted + state.totalUrgentTasksCompleted}/${state.totalRegularTasks + state.totalUrgentTasks} task completed.",
style: TextStyle(
color: AppColors.white
.withOpacity(0.4),
fontSize: 14,
fontWeight: FontWeight.w400,
),
),
],
),
const SizedBox(height: 20),
Center(
child: Stack(
children: [
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child: CircularProgressIndicator(
value: (state
.totalRegularTasksCompleted ==
0)
? 0
: (state.totalRegularTasksCompleted /
),
Stack(
children: [
SizedBox(
height: size.height * 0.07,
width: size.height * 0.07,
child: CircularProgressIndicator(
value: ((state.totalRegularTasksCompleted +
state
.totalRegularTasks),
strokeWidth: 7,
valueColor:
AlwaysStoppedAnimation(
Colors.green[400]),
backgroundColor: AppColors.white
.withOpacity(0.2),
color: AppColors.white,
),
),
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child: Center(
child: Text(
(state.totalRegularTasksCompleted ==
0)
? "0%"
: "${((state.totalRegularTasksCompleted / state.totalRegularTasks) * 100).toStringAsFixed(1)}%",
style: TextStyle(
color: AppColors.white
.withOpacity(0.8),
fontSize: 22,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
),
const SizedBox(height: 16),
Center(
child: Text(
"${state.totalRegularTasksCompleted}/${state.totalRegularTasks}",
style: TextStyle(
color: AppColors.white
.withOpacity(0.4),
fontSize: 22,
fontWeight: FontWeight.w400,
.totalUrgentTasksCompleted) ==
0)
? 0
: (state.totalRegularTasksCompleted +
state
.totalUrgentTasksCompleted) /
(state.totalRegularTasks +
state.totalUrgentTasks),
strokeWidth: 7,
valueColor:
const AlwaysStoppedAnimation(
AppColors.buttonBlue),
backgroundColor: AppColors.white
.withOpacity(0.2),
color: AppColors.white,
),
),
SizedBox(
height: size.height * 0.07,
width: size.height * 0.07,
child: Center(
child: Text(
((state.totalRegularTasksCompleted +
state
.totalUrgentTasksCompleted) ==
0)
? "0%"
: "${((state.totalRegularTasksCompleted + state.totalUrgentTasksCompleted) / (state.totalRegularTasks + state.totalUrgentTasks) * 100).toStringAsFixed(1)}%",
style: TextStyle(
color: AppColors.white
.withOpacity(0.8),
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
],
),
),
),
),
SizedBox(height: size.height * 0.04),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
height: size.height * 0.25,
width: size.width * 0.45,
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(5.0)
.copyWith(top: 12, bottom: 12),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Urgent Tasks Progress",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 20),
Center(
child: Stack(
children: [
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child:
CircularProgressIndicator(
value: (state
.totalUrgentTasksCompleted ==
0)
? 0
: (state.totalUrgentTasksCompleted /
state
.totalUrgentTasks),
strokeWidth: 7,
valueColor:
AlwaysStoppedAnimation(
Colors.red[400]),
backgroundColor: AppColors
.white
.withOpacity(0.2),
color: AppColors.white,
),
),
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child: Center(
child: Text(
(state.totalUrgentTasksCompleted ==
0)
? "0%"
: "${((state.totalUrgentTasksCompleted / state.totalUrgentTasks) * 100).toStringAsFixed(1)}%",
style: TextStyle(
color: AppColors.white
.withOpacity(0.8),
fontSize: 22,
fontWeight:
FontWeight.w600,
),
),
),
),
],
),
),
const SizedBox(height: 16),
Center(
child: Text(
"${state.totalUrgentTasksCompleted}/${state.totalUrgentTasks}",
style: TextStyle(
color: AppColors.white
.withOpacity(0.4),
fontSize: 22,
fontWeight: FontWeight.w400,
),
),
),
],
),
],
),
],
),
),
),
Container(
height: size.height * 0.25,
width: size.width * 0.45,
decoration: BoxDecoration(
color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18),
),
child: Padding(
padding: const EdgeInsets.all(5.0)
.copyWith(top: 12, bottom: 12),
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Text(
"Regular Tasks Progress",
textAlign: TextAlign.center,
style: TextStyle(
color: AppColors.white,
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 20),
Center(
child: Stack(
children: [
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child:
CircularProgressIndicator(
value: (state
.totalRegularTasksCompleted ==
0)
? 0
: (state.totalRegularTasksCompleted /
state
.totalRegularTasks),
strokeWidth: 7,
valueColor:
AlwaysStoppedAnimation(
Colors.green[400]),
backgroundColor: AppColors
.white
.withOpacity(0.2),
color: AppColors.white,
),
),
SizedBox(
height: size.height * 0.1,
width: size.height * 0.1,
child: Center(
child: Text(
(state.totalRegularTasksCompleted ==
0)
? "0%"
: "${((state.totalRegularTasksCompleted / state.totalRegularTasks) * 100).toStringAsFixed(1)}%",
style: TextStyle(
color: AppColors.white
.withOpacity(0.8),
fontSize: 22,
fontWeight:
FontWeight.w600,
),
),
),
),
],
),
),
const SizedBox(height: 16),
Center(
child: Text(
"${state.totalRegularTasksCompleted}/${state.totalRegularTasks}",
style: TextStyle(
color: AppColors.white
.withOpacity(0.4),
fontSize: 22,
fontWeight: FontWeight.w400,
),
),
),
],
),
],
),
),
),
],
),
],
),
SizedBox(height: size.height * 0.045),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Urgent Tasks",
style: TextStyle(
color: AppColors.white,
fontSize: 24,
fontWeight: FontWeight.w500,
),
SizedBox(height: size.height * 0.045),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Urgent Tasks",
style: TextStyle(
color: AppColors.white,
fontSize: 24,
fontWeight: FontWeight.w500,
),
),
TextButton(
onPressed: () {
homeBloc.add(
HomeUrgentTasksViewAllClickedEvent());
},
child: const Text(
'View all',
style: TextStyle(
color: AppColors.buttonBlue,
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
),
],
),
TextButton(
onPressed: () {
homeBloc
.add(HomeUrgentTasksViewAllClickedEvent());
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Task(
bloc: homeBloc,
task: successState.urgentTasks[index],
),
itemCount: (successState.urgentTasks.length < 2)
? successState.urgentTasks.length
: 2,
separatorBuilder:
(BuildContext context, int index) {
return const SizedBox(height: 15);
},
child: const Text(
'View all',
style: TextStyle(
color: AppColors.buttonBlue,
fontSize: 14,
fontWeight: FontWeight.w500,
),
SizedBox(height: size.height * 0.04),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Regular Tasks",
style: TextStyle(
color: AppColors.white,
fontSize: 24,
fontWeight: FontWeight.w500,
),
),
),
TextButton(
onPressed: () {
homeBloc.add(
HomeRegularTasksViewAllClickedEvent());
},
child: const Text(
'View all',
style: TextStyle(
color: AppColors.buttonBlue,
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Task(
bloc: homeBloc,
task: successState.urgentTasks[index],
),
itemCount: (successState.urgentTasks.length < 2)
? successState.urgentTasks.length
: 2,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(height: 15);
},
),
SizedBox(height: size.height * 0.04),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Regular Tasks",
style: TextStyle(
color: AppColors.white,
fontSize: 24,
fontWeight: FontWeight.w500,
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Task(
bloc: homeBloc,
task: successState.regularTasks[index],
),
),
TextButton(
onPressed: () {
homeBloc
.add(HomeRegularTasksViewAllClickedEvent());
itemCount: (successState.regularTasks.length < 2)
? successState.regularTasks.length
: 2,
separatorBuilder:
(BuildContext context, int index) {
return const SizedBox(height: 15);
},
child: const Text(
'View all',
),
SizedBox(height: size.height * 0.1),
],
),
),
Positioned(
width: size.width,
bottom: 8,
child: Center(
child: Container(
width: size.width * 0.7,
height: size.height * 0.07,
decoration: BoxDecoration(
color: AppColors.buttonBlue,
borderRadius: BorderRadius.circular(16),
),
child: const Center(
child: Text(
"Add new task +",
style: TextStyle(
color: AppColors.buttonBlue,
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.white,
fontSize: 20,
fontWeight: FontWeight.w400,
),
),
),
],
),
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => Task(
bloc: homeBloc,
task: successState.regularTasks[index],
),
itemCount: (successState.regularTasks.length < 2)
? successState.regularTasks.length
: 2,
separatorBuilder: (BuildContext context, int index) {
return const SizedBox(height: 15);
},
),
],
),
),
],
),
),
);

View File

@@ -1,4 +1,4 @@
//just for testing
var baseUrl = "http://192.168.235.52:8000";
var baseUrl = "http://192.168.2.52:8000";
var token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6ImpvaG4uZG9lQGdtYWlsLmNvbSIsIkZpcnN0X25hbWUiOiJKb2huIiwiTGFzdF9uYW1lIjoiRG9lIiwiVWlkIjoiNjUzYTJmNzFlMjMzMGFjMzY5ZTkzYzliIiwiZXhwIjoxNjk5MDI4NDM4fQ.1doJ9tOyRHosZAYM3dD1rxGhbxPg3laHVzYvGeGHKGQ";
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6ImpvaG4uZG9lQGdtYWlsLmNvbSIsIkZpcnN0X25hbWUiOiJKb2huIiwiTGFzdF9uYW1lIjoiRG9lIiwiVWlkIjoiNjUzYTJmNzFlMjMzMGFjMzY5ZTkzYzliIiwiZXhwIjoxNjk5MTE1MTQxfQ.l-yfrvG282TdOXrkR5rUsokNI97OimWNf4eI3uR4UPY";