1
0
mirror of https://github.com/Uttkarsh-raj/Plannerly.git synced 2025-11-29 21:57:34 +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; final successState = state as HomeLoadedSuccessState;
return Scaffold( return Scaffold(
backgroundColor: AppColors.backgroundDark, backgroundColor: AppColors.backgroundDark,
body: SingleChildScrollView( body: Padding(
child: Padding( padding: const EdgeInsets.all(14.0),
padding: const EdgeInsets.all(14.0), child: Stack(
child: Column( children: [
crossAxisAlignment: CrossAxisAlignment.start, SingleChildScrollView(
children: [ child: Column(
SizedBox(height: size.height * 0.03), crossAxisAlignment: CrossAxisAlignment.start,
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Icon( SizedBox(height: size.height * 0.03),
Icons.menu_outlined, const Row(
size: 28, mainAxisAlignment: MainAxisAlignment.spaceBetween,
color: AppColors.white, children: [
Icon(
Icons.menu_outlined,
size: 28,
color: AppColors.white,
),
Icon(
Icons.notifications_outlined,
size: 28,
color: AppColors.white,
),
],
), ),
Icon( SizedBox(height: size.height * 0.03),
Icons.notifications_outlined, const Text(
size: 28, "Hi, Jason",
color: AppColors.white, style: TextStyle(
), color: AppColors.white,
], fontSize: 18,
), fontWeight: FontWeight.w300,
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.01),
), const Text(
SizedBox(height: size.height * 0.025), "Be productivity today",
Center( style: TextStyle(
child: Container( color: AppColors.white,
decoration: BoxDecoration( fontSize: 24,
color: AppColors.backgroundLight, fontWeight: FontWeight.w500,
borderRadius: BorderRadius.circular(18), ),
), ),
child: Padding( SizedBox(height: size.height * 0.038),
padding: const EdgeInsets.all(18.0), Center(
child: Row( child: Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, decoration: BoxDecoration(
children: [ color: AppColors.backgroundLight,
Expanded( borderRadius: BorderRadius.circular(18),
child: Column( ),
crossAxisAlignment: child: Padding(
CrossAxisAlignment.start, padding: const EdgeInsets.all(5.0),
children: [ child: Row(
const Text( mainAxisAlignment:
"Task Progress", MainAxisAlignment.spaceBetween,
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(
children: [ children: [
SizedBox( const Expanded(
height: size.height * 0.07, child: TextField(
width: size.height * 0.07, decoration: InputDecoration(
child: CircularProgressIndicator( border: InputBorder.none,
value: ((state.totalRegularTasksCompleted + hintText: 'Search task',
state hintStyle: TextStyle(
.totalUrgentTasksCompleted) == color: AppColors.grey,
0) fontSize: 18,
? 0 ),
: (state.totalRegularTasksCompleted + contentPadding: EdgeInsets.all(10),
state ),
.totalUrgentTasksCompleted) /
(state.totalRegularTasks +
state.totalUrgentTasks),
strokeWidth: 7,
valueColor:
const AlwaysStoppedAnimation(
AppColors.buttonBlue),
backgroundColor:
AppColors.white.withOpacity(0.2),
color: AppColors.white,
), ),
), ),
SizedBox( IconButton(
height: size.height * 0.07, onPressed: () {},
width: size.height * 0.07, icon: Icon(
child: Center( Icons.search_outlined,
child: Text( size: 28,
((state.totalRegularTasksCompleted + color: AppColors.white.withOpacity(0.6),
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( SizedBox(height: size.height * 0.025),
height: size.height * 0.25, Center(
width: size.width * 0.45, child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.backgroundLight, color: AppColors.backgroundLight,
borderRadius: BorderRadius.circular(18), borderRadius: BorderRadius.circular(18),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(5.0) padding: const EdgeInsets.all(18.0),
.copyWith(top: 12, bottom: 12), child: Row(
child: Column( mainAxisAlignment:
children: [ MainAxisAlignment.spaceBetween,
Column( children: [
crossAxisAlignment: Expanded(
CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment:
const Text( CrossAxisAlignment.start,
"Regular Tasks Progress", children: [
textAlign: TextAlign.center, const Text(
style: TextStyle( "Task Progress",
color: AppColors.white, style: TextStyle(
fontSize: 18, color: AppColors.white,
fontWeight: FontWeight.w500, 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( Stack(
child: Stack( children: [
children: [ SizedBox(
SizedBox( height: size.height * 0.07,
height: size.height * 0.1, width: size.height * 0.07,
width: size.height * 0.1, child: CircularProgressIndicator(
child: CircularProgressIndicator( value: ((state.totalRegularTasksCompleted +
value: (state
.totalRegularTasksCompleted ==
0)
? 0
: (state.totalRegularTasksCompleted /
state state
.totalRegularTasks), .totalUrgentTasksCompleted) ==
strokeWidth: 7, 0)
valueColor: ? 0
AlwaysStoppedAnimation( : (state.totalRegularTasksCompleted +
Colors.green[400]), state
backgroundColor: AppColors.white .totalUrgentTasksCompleted) /
.withOpacity(0.2), (state.totalRegularTasks +
color: AppColors.white, state.totalUrgentTasks),
), strokeWidth: 7,
), valueColor:
SizedBox( const AlwaysStoppedAnimation(
height: size.height * 0.1, AppColors.buttonBlue),
width: size.height * 0.1, backgroundColor: AppColors.white
child: Center( .withOpacity(0.2),
child: Text( color: AppColors.white,
(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.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(
SizedBox(height: size.height * 0.045), mainAxisAlignment: MainAxisAlignment.spaceBetween,
Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, const Text(
children: [ "Urgent Tasks",
const Text( style: TextStyle(
"Urgent Tasks", color: AppColors.white,
style: TextStyle( fontSize: 24,
color: AppColors.white, fontWeight: FontWeight.w500,
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( ListView.separated(
onPressed: () { shrinkWrap: true,
homeBloc physics: const NeverScrollableScrollPhysics(),
.add(HomeUrgentTasksViewAllClickedEvent()); 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', SizedBox(height: size.height * 0.04),
style: TextStyle( Row(
color: AppColors.buttonBlue, mainAxisAlignment: MainAxisAlignment.spaceBetween,
fontSize: 14, children: [
fontWeight: FontWeight.w500, 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,
ListView.separated( physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, itemBuilder: (context, index) => Task(
physics: const NeverScrollableScrollPhysics(), bloc: homeBloc,
itemBuilder: (context, index) => Task( task: successState.regularTasks[index],
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,
), ),
), itemCount: (successState.regularTasks.length < 2)
TextButton( ? successState.regularTasks.length
onPressed: () { : 2,
homeBloc separatorBuilder:
.add(HomeRegularTasksViewAllClickedEvent()); (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( style: TextStyle(
color: AppColors.buttonBlue, color: AppColors.white,
fontSize: 14, fontSize: 20,
fontWeight: FontWeight.w500, 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 //just for testing
var baseUrl = "http://192.168.235.52:8000"; var baseUrl = "http://192.168.2.52:8000";
var token = var token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6ImpvaG4uZG9lQGdtYWlsLmNvbSIsIkZpcnN0X25hbWUiOiJKb2huIiwiTGFzdF9uYW1lIjoiRG9lIiwiVWlkIjoiNjUzYTJmNzFlMjMzMGFjMzY5ZTkzYzliIiwiZXhwIjoxNjk5MDI4NDM4fQ.1doJ9tOyRHosZAYM3dD1rxGhbxPg3laHVzYvGeGHKGQ"; "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6ImpvaG4uZG9lQGdtYWlsLmNvbSIsIkZpcnN0X25hbWUiOiJKb2huIiwiTGFzdF9uYW1lIjoiRG9lIiwiVWlkIjoiNjUzYTJmNzFlMjMzMGFjMzY5ZTkzYzliIiwiZXhwIjoxNjk5MTE1MTQxfQ.l-yfrvG282TdOXrkR5rUsokNI97OimWNf4eI3uR4UPY";