Skip to content

Commit

Permalink
Frontend: Implement Dashboard screen UI
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamsinghshubham777 committed Sep 21, 2024
1 parent 6baf29a commit 5cbcc77
Show file tree
Hide file tree
Showing 35 changed files with 1,154 additions and 75 deletions.
Binary file added frontend/assets/fonts/ElMessiri-Bold.ttf
Binary file not shown.
Binary file added frontend/assets/fonts/ElMessiri-Medium.ttf
Binary file not shown.
Binary file added frontend/assets/fonts/ElMessiri-Regular.ttf
Binary file not shown.
Binary file added frontend/assets/fonts/ElMessiri-SemiBold.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions frontend/assets/icons/arrow_forward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions frontend/lib/common/view/custom_package_advertisement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class CustomPackageAdvertisement extends StatelessWidget {
Text(
'Are you tired?',
style: context.titleLarge?.copyWith(
color: appColors.secondaryDark,
fontFamily: Constants.fontDMSerifDisplay,
),
),
Expand All @@ -43,7 +42,6 @@ class CustomPackageAdvertisement extends StatelessWidget {
child: Text(
'Tired of looking through every single vendor of each service type? We will select a tailored package that best fits your interests.',
style: context.labelSmall?.copyWith(
color: appColors.secondaryDark.withOpacity(0.8),
fontFamily: Constants.fontKantumruy,
height: 1.5,
),
Expand Down
15 changes: 10 additions & 5 deletions frontend/lib/common/view/dta_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import 'package:frontend/constants/assets.dart';
import 'package:frontend/utils/constants.dart';

class DTAAppBar extends StatelessWidget {
const DTAAppBar({super.key, this.onDrawerOpen});
const DTAAppBar({
required this.title,
super.key,
this.onDrawerOpen,
});

final String title;
final VoidCallback? onDrawerOpen;

static Size appBarSize(BuildContext context) => Size(
Expand Down Expand Up @@ -36,15 +41,15 @@ class DTAAppBar extends StatelessWidget {
children: [
Align(
child: Text(
'Welcome',
title,
style: context.bodyLarge?.copyWith(
fontFamily: Constants.fontDMSerifDisplay,
),
),
),
Align(
alignment: Alignment.centerLeft,
child: ZoomTapAnimation(
child: ZoomTapDetector(
onTap: onDrawerOpen,
child: Container(
decoration: BoxDecoration(
Expand Down Expand Up @@ -75,12 +80,12 @@ class DTAAppBar extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ZoomTapAnimation(
ZoomTapDetector(
onTap: () {},
child: SvgPicture.asset(Assets.iconsBiBell),
),
const SizedBox(width: 20),
ZoomTapAnimation(
ZoomTapDetector(
onTap: () {},
child: SvgPicture.asset(Assets.iconsOcticonPerson),
),
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/common/view/dta_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DTAButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ZoomTapAnimation(
return ZoomTapDetector(
onTap: enabled ? onTap : null,
child: AnimatedOpacity(
duration: Durations.short4,
Expand Down
25 changes: 6 additions & 19 deletions frontend/lib/common/view/dta_horizontal_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:frontend/common/view/app_colors.dart';
import 'package:frontend/common/view/dta_icon.dart';
import 'package:frontend/common/view/section_header.dart';
import 'package:frontend/common/view/underlined_text.dart';
import 'package:frontend/common/view/zoom_tap_animation.dart';
import 'package:frontend/constants/assets.dart';
import 'package:frontend/features/home/model/dta_horizontal_list_data.dart';
Expand Down Expand Up @@ -31,13 +33,7 @@ class DTAHorizontalList extends StatelessWidget {
if (title != null)
Padding(
padding: const EdgeInsets.only(left: 20, top: 24),
child: Text(
title!,
style: context.titleLarge?.copyWith(
color: appColors.secondaryDark,
fontFamily: Constants.fontDMSerifDisplay,
),
),
child: SectionHeader(title: title!),
),
if (tags.isNotEmpty)
Padding(
Expand All @@ -51,17 +47,9 @@ class DTAHorizontalList extends StatelessWidget {
itemBuilder: (listContext, index) {
return Padding(
padding: const EdgeInsets.only(right: 8),
child: ZoomTapAnimation(
child: ZoomTapDetector(
onTap: () {},
child: Text(
tags[index],
style: context.bodySmall?.copyWith(
color: appColors.accent,
fontFamily: Constants.fontKantumruy,
decoration: TextDecoration.underline,
decorationColor: appColors.accent,
),
),
child: UnderlinedText(tags[index]),
),
);
},
Expand All @@ -81,7 +69,7 @@ class DTAHorizontalList extends StatelessWidget {
scrollDirection: Axis.horizontal,
itemBuilder: (listContext, index) {
final itemData = items[index];
return ZoomTapAnimation(
return ZoomTapDetector(
onTap: itemData.onTap,
child: Padding(
padding: const EdgeInsets.only(right: 16),
Expand Down Expand Up @@ -123,7 +111,6 @@ class DTAHorizontalList extends StatelessWidget {
child: Text(
itemData.itemTitle!,
style: listContext.titleSmall?.copyWith(
color: appColors.secondaryDark,
fontFamily: Constants.fontKantumruy,
fontWeight:
itemSize == DTAHorizontalListItemSize.medium
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/common/view/dta_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DtaIcon extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ZoomTapAnimation(
return ZoomTapDetector(
onTap: onTap,
child: SvgPicture.asset(
asset,
Expand Down
41 changes: 41 additions & 0 deletions frontend/lib/common/view/indicator_legend.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:frontend/utils/constants.dart';

class IndicatorLegend extends StatelessWidget {
const IndicatorLegend({required this.text, required this.color, super.key});

final String text;
final Color color;

@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
),
width: 16,
height: 16,
),
const SizedBox(width: 16),
Flexible(
child: Opacity(
opacity: 0.8,
child: Text(
text,
style: const TextStyle(
fontFamily: Constants.fontKantumruy,
fontSize: 12,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
],
);
}
}
57 changes: 57 additions & 0 deletions frontend/lib/common/view/section_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import 'package:flutter/material.dart';
import 'package:frontend/common/view/app_colors.dart';
import 'package:frontend/common/view/dta_icon.dart';
import 'package:frontend/common/view/underlined_text.dart';
import 'package:frontend/common/view/zoom_tap_animation.dart';
import 'package:frontend/constants/assets.dart';
import 'package:frontend/utils/constants.dart';

class SectionHeader extends StatelessWidget {
const SectionHeader({
required this.title,
super.key,
this.actionText = 'View All',
this.onActionTap,
this.dense = false,
});

final String title;
final String actionText;
final VoidCallback? onActionTap;
final bool dense;

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
title,
style: TextStyle(
fontFamily: Constants.fontDMSerifDisplay,
fontSize: dense ? 16 : 24,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
if (onActionTap != null)
Row(
children: [
ZoomTapDetector(
onTap: onActionTap,
child: UnderlinedText(actionText),
),
const SizedBox(width: 8),
DtaIcon(
Assets.iconsArrowForward,
color: appColors.accent,
width: 8,
)
],
),
],
);
}
}
23 changes: 23 additions & 0 deletions frontend/lib/common/view/underlined_text.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:frontend/common/view/app_colors.dart';
import 'package:frontend/utils/constants.dart';

class UnderlinedText extends StatelessWidget {
const UnderlinedText(this.text, {super.key});

final String text;

@override
Widget build(BuildContext context) {
return Text(
text,
style: TextStyle(
color: appColors.accent,
fontFamily: Constants.fontKantumruy,
fontSize: 12,
decoration: TextDecoration.underline,
decorationColor: appColors.accent,
),
);
}
}
10 changes: 5 additions & 5 deletions frontend/lib/common/view/zoom_tap_animation.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:async';
import 'package:flutter/widgets.dart';

class ZoomTapAnimation extends StatefulWidget {
const ZoomTapAnimation({
class ZoomTapDetector extends StatefulWidget {
const ZoomTapDetector({
required this.child,
super.key,
this.onTap,
Expand Down Expand Up @@ -50,11 +50,11 @@ class ZoomTapAnimation extends StatefulWidget {
// behavior: the hit test behavior of the GestureDetector.
final HitTestBehavior behavior;
@override
State<StatefulWidget> createState() => _ZoomTapAnimationState();
State<StatefulWidget> createState() => _ZoomTapDetectorState();
}

class _ZoomTapAnimationState extends State<ZoomTapAnimation>
with SingleTickerProviderStateMixin<ZoomTapAnimation> {
class _ZoomTapDetectorState extends State<ZoomTapDetector>
with SingleTickerProviderStateMixin<ZoomTapDetector> {
// make AnimationController nullable to make sure to not use it if it's null
AnimationController? _controller;
late Animation<double> _animation;
Expand Down
2 changes: 2 additions & 0 deletions frontend/lib/constants/assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
class Assets {
Assets._();

static const String iconsArrowForward = "assets/icons/arrow_forward.svg";

static const String iconsBiBell = "assets/icons/bi_bell.svg";

static const String iconsBottomNavCollab = "assets/icons/bottom_nav_collab.svg";
Expand Down
2 changes: 1 addition & 1 deletion frontend/lib/features/auth/view/sign_up_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class _SignUpDialogState extends ConsumerState<SignUpDialog> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: Gender.values.map((g) {
return ZoomTapAnimation(
return ZoomTapDetector(
onTap: () => setState(() => gender = g),
child: AnimatedContainer(
duration: Durations.short4,
Expand Down
Loading

0 comments on commit 5cbcc77

Please sign in to comment.