Skip to content

Instantly share code, notes, and snippets.

@xaif
Created February 19, 2024 06:47
Show Gist options
  • Save xaif/6bd7641c0067087f528c6ca0d786112a to your computer and use it in GitHub Desktop.
Save xaif/6bd7641c0067087f528c6ca0d786112a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Course Dashboard'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: <Widget>[
CourseCard(),
SizedBox(height: 20),
CourseProgress(),
],
),
),
);
}
}
class CourseCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Online Digital Marketing Course', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
SizedBox(height: 10),
Text('Learn about the fascinating world of marketing & gain insightful knowledge of essential concepts, ranging from basic website creation to content to performance analysis. You will learn vital collaboration & communication skills, along with effectively managing & marketing your brand.', style: TextStyle(fontSize: 16)),
],
),
),
);
}
}
class CourseProgress extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Text('Course Progress', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ProgressTile(title: 'Assignment', progress: 5, total: 9),
ProgressTile(title: 'Exam', progress: 13, total: 14),
],
),
SizedBox(height: 20),
LinearProgressIndicator(value: 0, backgroundColor: Colors.grey[300],),
SizedBox(height: 5),
Text('Batch Video Progress', style: TextStyle(color: Colors.grey)),
SizedBox(height: 5),
LinearProgressIndicator(value: 0, backgroundColor: Colors.grey[300],),
],
),
),
);
}
}
class ProgressTile extends StatelessWidget {
final String title;
final int progress;
final int total;
const ProgressTile({
Key key,
@required this.title,
@required this.progress,
@required this.total,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Text(title, style: TextStyle(fontWeight: FontWeight.bold)),
SizedBox(height: 5),
Text('$progress / $total'),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment