Skip to content

Commit

Permalink
Merge pull request #212 from atharva-khewle/main
Browse files Browse the repository at this point in the history
Half made ui
  • Loading branch information
atharva-khewle authored Jul 20, 2024
2 parents 6af0e22 + e7bb8f4 commit 7d8127a
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 103 deletions.
2 changes: 2 additions & 0 deletions lib/new_ui/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
const commonbgblack = Color(0xff18191b);
const commonbgLightblack = Color(0xff242527);
const commonbgLLightblack = Color(0xff323232);
const commonbgL3ightblack = Color(0xff444444);
const commonbgL4ightblack = Color(0xff555555);
const cardcolorblue = Color(0xff0077b6);
const oldDateSelectBlue = Color(0xff2196F3);
const cardlightblue = Color(0xff90e0ef);
Expand Down
56 changes: 32 additions & 24 deletions lib/new_ui/screens/attendance_screen/attendance_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:tsec_app/new_ui/colors.dart';
import 'package:tsec_app/new_ui/screens/attendance_screen/widgets/attendance_subject_widget.dart';

//make this a consumer widget later
Expand All @@ -7,55 +8,62 @@ class AttendanceScreen extends StatelessWidget {

@override
Widget build(BuildContext context) {
var present =8;
var totalLec=10;
//put the attendance from a provider here
double attendance = 0.5;
double attendance = present/totalLec;
var size = MediaQuery.of(context).size;
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(height: 20,),
Text(
attendance < 0.75 ? 'Your attendance is low' : 'Your attendance is good',
style: TextStyle(color: Colors.white, fontSize: 20),
),
// const SizedBox(height: 20,),
// Text(
// attendance < 0.75 ? 'Your attendance is low' : 'Your attendance is good',
// style: TextStyle(color: Colors.white, fontSize: 20),
// ),
const SizedBox(height: 30,),
Stack(
children: [
Positioned.fill(
child: Align(
alignment: Alignment.center,
child: Text(
'${attendance * 100} %' ,
style: TextStyle(color: Colors.white, fontSize: 50),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'' ,
style: TextStyle(color: Colors.white, fontSize: 4),
),
Text(
'${attendance * 100}%' ,
style: TextStyle(color: Colors.white, fontSize: 17),
),
Text(
'${present}/${totalLec}' ,
style: TextStyle(color: Colors.white, fontSize: 14),
),
],
),
),
),
SizedBox(
width: size.width * 0.8,
height: size.height * 0.4,
width: 100,
height: 100,
child: CircularProgressIndicator(
value: attendance,
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
strokeWidth: 20,
strokeCap: StrokeCap.round,
valueColor: AlwaysStoppedAnimation<Color>(oldDateSelectBlue),
strokeWidth: 3,
strokeAlign: BorderSide.strokeAlignInside,
strokeCap: StrokeCap.butt,
),
),
],
),
const SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Present: 5", style: TextStyle(color: Colors.white),),
Text("Absent: 5", style: TextStyle(color: Colors.white),),
],
),
const SizedBox(height: 20,),
//put the subject attendance cards from here
AttendanceSubjectWidget(attendance: 0.5),
const SizedBox(height: 10,),
AttendanceSubjectWidget(attendance: 0.75),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,74 +1,103 @@
import 'package:flutter/material.dart';
import 'package:tsec_app/new_ui/colors.dart';

class AttendanceSubjectWidget extends StatelessWidget {
final double attendance;
const AttendanceSubjectWidget({super.key, required this.attendance});

@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;

return Card(
color: const Color(0xff464544),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
//crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'Subject Name',
style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold),
),
SizedBox(width: 5,),
Text(
'5/10',
style: TextStyle(color: Colors.white, fontSize: 12),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'50%',
style: TextStyle(color: Colors.white, fontSize: 16),
),
],
child: Container(
decoration: BoxDecoration(
border: Border.all(color: timePickerBorder, width: 1.0), // Change the color and width as needed
borderRadius: BorderRadius.circular(10.0),
color: timePickerBg,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
//crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'Subject Name',
style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold),
),
),
],
),
const SizedBox(height: 10,),
const Text("Not accepted", style: TextStyle(color: Colors.white, fontSize: 12),),
const SizedBox(height: 10,),
LinearProgressIndicator(
value: attendance,
backgroundColor: Colors.white,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.blue),
),
const SizedBox(height: 15,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ElevatedButton(
onPressed: (){},
child: const Text('Present', style: TextStyle(color: Colors.white),),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
),
SizedBox(width: 5,),
],
),
const SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'5/10',
style: TextStyle(color: Colors.white, fontSize: 14),
),
ElevatedButton(
onPressed: (){},
child: const Text('Absent', style: TextStyle(color: Colors.white),),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
),
Text(
'50%',
style: TextStyle(color: Colors.white, fontSize: 14),
),
],
)
],
],
),
const SizedBox(height: 10,),
LinearProgressIndicator(
value: attendance,
backgroundColor: Colors.white,
valueColor: const AlwaysStoppedAnimation<Color>(Colors.blue),
),
const SizedBox(height: 15,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ElevatedButton(
onPressed: (){},
child: const Text('Present', style: TextStyle(color: Colors.white),),
style: ElevatedButton.styleFrom(
backgroundColor: commonbgL3ightblack,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
),
),
ElevatedButton(
onPressed: (){},
child: Transform(
alignment: Alignment.center,
transform: Matrix4.identity()..scale(-1.0, 1.0, 1.0), // Flip horizontally
child: Icon(Icons.refresh_outlined, color: Colors.white),
)
,
style: ElevatedButton.styleFrom(
backgroundColor: commonbgL3ightblack,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
),
),
ElevatedButton(
onPressed: (){},
child: const Text('Absent', style: TextStyle(color: Colors.white),),
style: ElevatedButton.styleFrom(
backgroundColor: commonbgL3ightblack,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
),
),

],
),
const SizedBox(height: 10,),
Center(
child: Container(
height: 1,
width: size.width*0.88,
color: commonbgL4ightblack,
),
),
const SizedBox(height: 10,),
],
),
),
)
);
Expand Down
47 changes: 27 additions & 20 deletions lib/new_ui/screens/profile_screen/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,13 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
context: context,
builder: (context) {
return AlertDialog(

content: SizedBox(
height: 180,
child: Container(
padding: const EdgeInsets.all(20.0),
height: MediaQuery.of(context).size.height* 0.25,
padding: const EdgeInsets.all(5.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
RichText(
text: TextSpan(
Expand All @@ -375,23 +376,29 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("Cancel")
),
TextButton(
onPressed: () async {
bool changesSaved = await saveChanges(ref);
if (changesSaved) GoRouter.of(context).go('/main');
},
child: const Text("Proceed")
),
],
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: const Text("Cancel")
),
),
Container(
child: TextButton(
onPressed: () async {
bool changesSaved = await saveChanges(ref);
if (changesSaved) GoRouter.of(context).go('/main');
},
child: const Text("Proceed")
),
),
],
),
),
],
),
Expand Down

0 comments on commit 7d8127a

Please sign in to comment.