-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9115e48
commit 6e866e1
Showing
6 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
lib/src/features/dashboard/screen/dashboard/dashboard_screen.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:courses_app/src/widgets/common/FilledCard.dart'; | ||
import 'package:courses_app/src/widgets/common/OutlinedCard.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'widgets/subject_card.dart'; | ||
|
||
class DashboardScreen extends StatelessWidget { | ||
const DashboardScreen({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Hi Ravindra'), | ||
), | ||
body: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: CustomScrollView( | ||
slivers: <Widget>[ | ||
SliverList( | ||
delegate: SliverChildBuilderDelegate((context, index) { | ||
return SubjectCard( | ||
subjectName: 'Subject $index', | ||
attended: 20, | ||
classes: 30, | ||
onTap: () { | ||
print('open card $index'); | ||
}, | ||
); | ||
}, childCount: 8), | ||
) | ||
], | ||
), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: () {}, | ||
child: const Icon(Icons.add), | ||
), | ||
); | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
lib/src/features/dashboard/screen/dashboard/widgets/subject_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import 'package:courses_app/src/widgets/common/OutlinedCard.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class SubjectCard extends StatelessWidget { | ||
SubjectCard({ | ||
super.key, | ||
required this.subjectName, | ||
required this.attended, | ||
required this.classes, | ||
this.onTap | ||
}); | ||
|
||
String subjectName; | ||
int classes; | ||
int attended; | ||
Function? onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: const EdgeInsets.symmetric(vertical: 10.0), | ||
child: OutlinedCard( | ||
child: InkWell( | ||
onTap: () => onTap!(), | ||
child: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Row( | ||
children: [ | ||
Expanded( | ||
child: Text( | ||
subjectName, | ||
style: Theme.of(context).textTheme.titleLarge?.apply( | ||
color: Theme.of(context).colorScheme.primary), | ||
), | ||
), | ||
IconButton( | ||
onPressed: () {}, | ||
icon: const Icon(Icons.arrow_forward), | ||
) | ||
], | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 8.0), | ||
child: Divider( | ||
color: Theme.of(context).colorScheme.onSecondaryContainer, | ||
), | ||
), | ||
Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Expanded( | ||
child: Text( | ||
'${(attended / classes * 100).toStringAsFixed(1).toString()}%', | ||
style: Theme.of(context).textTheme.displayMedium?.apply( | ||
color: Theme.of(context).colorScheme.tertiary), | ||
), | ||
), | ||
Row( | ||
children: [ | ||
SizedBox( | ||
width: 16.0, | ||
height: 16.0, | ||
child: CircularProgressIndicator( | ||
value: 0.60, | ||
color: Theme.of(context).colorScheme.tertiary, | ||
strokeWidth: 3.0, | ||
), | ||
), | ||
const SizedBox( | ||
width: 10.0, | ||
), | ||
Column( | ||
crossAxisAlignment: CrossAxisAlignment.end, | ||
children: [ | ||
Text( | ||
'${classes.toString()} classes', | ||
style: Theme.of(context).textTheme.bodySmall, | ||
), | ||
Text( | ||
'${attended.toString()} attended', | ||
style: Theme.of(context).textTheme.bodySmall, | ||
), | ||
], | ||
), | ||
], | ||
) | ||
], | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class FilledCard extends StatelessWidget { | ||
FilledCard({ | ||
Key? key, | ||
required this.child, | ||
}) : super(key: key); | ||
|
||
Widget child; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Card( | ||
elevation: 0, | ||
color: Theme.of(context).colorScheme.surfaceVariant, | ||
child: child, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class OutlinedCard extends StatelessWidget { | ||
OutlinedCard({ | ||
Key? key, | ||
required this.child, | ||
}) : super(key: key); | ||
|
||
Widget child; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Card( | ||
elevation: 0, | ||
shape: RoundedRectangleBorder( | ||
side: BorderSide( | ||
color: Theme.of(context).colorScheme.outline | ||
), | ||
borderRadius: const BorderRadius.all(Radius.circular(12)) | ||
), | ||
child: child, | ||
); | ||
} | ||
} |