Skip to content

Commit

Permalink
chore: retouched the birthday ui page
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMuuo committed Jul 19, 2024
1 parent 0f5e222 commit 78f8fdb
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 51 deletions.
1 change: 1 addition & 0 deletions assets/lotties/birthday.json

Large diffs are not rendered by default.

25 changes: 0 additions & 25 deletions lib/pages/courses/courses_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,6 @@ class _CoursesPageState extends State<CoursesPage> {
},
icon: const Icon(Ionicons.information_circle_outline),
),
IconButton(
onPressed: () async {
final result = await coursesController.fetchUserCourses();
result.fold(
(l) => showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text("Oops!"),
content: Text(l),
actions: [
FilledButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("Ooh, ok"),
)
],
),
), (r) {
setState(
() {},
);
});
},
icon: Icon(Ionicons.refresh)),
],
),
SliverPadding(
Expand Down
53 changes: 51 additions & 2 deletions lib/pages/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:academia/exports/barrel.dart';
import 'package:academia/models/core/course/course_model.dart';
import 'package:get/get.dart';

class DashBoard extends StatelessWidget {
Expand Down Expand Up @@ -142,7 +141,57 @@ class DashBoard extends StatelessWidget {
maintainState: true,
enableFeedback: true,
title: Text(
"Courses Today",
"Courses",
style: Theme.of(context).textTheme.headlineSmall,
),
children: [
Container(
color: Theme.of(context).colorScheme.primaryContainer,
padding: const EdgeInsets.all(12),
width: double.infinity,
child: Text("Hi"),
)
],
),
),
),
),

SliverPadding(
padding: const EdgeInsets.all(12),
sliver: SliverVisibility(
sliver: SliverToBoxAdapter(
child: ExpansionTile(
initiallyExpanded: true,
maintainState: true,
enableFeedback: true,
title: Text(
"Todos",
style: Theme.of(context).textTheme.headlineSmall,
),
children: [
Container(
color: Theme.of(context).colorScheme.primaryContainer,
padding: const EdgeInsets.all(12),
width: double.infinity,
child: Text("Hi"),
)
],
),
),
),
),

SliverPadding(
padding: const EdgeInsets.all(12),
sliver: SliverVisibility(
sliver: SliverToBoxAdapter(
child: ExpansionTile(
initiallyExpanded: true,
maintainState: true,
enableFeedback: true,
title: Text(
"Tips",
style: Theme.of(context).textTheme.headlineSmall,
),
children: [
Expand Down
1 change: 1 addition & 0 deletions lib/tools/birthday/birthday.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'pages/pages.dart';
24 changes: 0 additions & 24 deletions lib/tools/birthday/birthday_page.dart

This file was deleted.

65 changes: 65 additions & 0 deletions lib/tools/birthday/pages/birthday_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:academia/exports/barrel.dart';
import 'package:lottie/lottie.dart';

class BirthDayPage extends StatelessWidget {
BirthDayPage({super.key});

final UserController userController = Get.find<UserController>();
int get years {
DateFormat inputFormat = DateFormat('yyyy-MM-dd');

var dob =
inputFormat.parse(userController.user.value!.dateOfBirth.toString());
return DateTime.now().year - dob.year;
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar(
leading: IconButton.outlined(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(Ionicons.close),
),
),
const SliverPadding(
padding: EdgeInsets.all(16),
sliver: SliverToBoxAdapter(
child: ProfilePictureWidget(
profileSize: 80,
),
),
),
SliverPadding(
padding: const EdgeInsets.all(16),
sliver: SliverToBoxAdapter(
child: Text(
"Happy birthday ${userController.user.value!.firstName} ${Emojis.activites_confetti_ball}",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineLarge,
),
),
),
SliverToBoxAdapter(
child: Lottie.asset("assets/lotties/birthday.json"),
),
SliverPadding(
padding: const EdgeInsets.all(12),
sliver: SliverToBoxAdapter(
child: Text(
"""Academia wishes you a happy $years birthday!Remember you're one year older from your birth and one closer to your death\nWe celebrate you!""",
textAlign: TextAlign.center,
),
),
)
],
),
);
}
}
1 change: 1 addition & 0 deletions lib/tools/birthday/pages/pages.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'birthday_page.dart';
1 change: 1 addition & 0 deletions lib/tools/tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export 'stories/stories.dart';
export 'events/events.dart';
export 'fees/fees.dart';
export 'gpa_calculator/gpacalculator.dart';
export 'birthday/birthday.dart';

0 comments on commit 78f8fdb

Please sign in to comment.