Skip to content

Commit

Permalink
Fix tablet card aspect ratio and description limit formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodepapaya committed Aug 30, 2021
1 parent 8c33763 commit b3c76f4
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 21 deletions.
13 changes: 11 additions & 2 deletions lib/blogs/blog_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,17 @@ class BlogCard extends StatelessWidget {
),
],
),
Text(data.title, style: Theme.of(context).textTheme.headline6),
Text(data.description),
Text(
data.title,
style: Theme.of(context).textTheme.headline6,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
data.description,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/blogs/blog_data.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:portfolio/utils/constants.dart';

class BlogData {
BlogData({
required this.title,
required this.description,
required this.tags,
required this.url,
required this.read,
});
}) : assert(description.length < Constants.charLimitCardDesc);

final String title;
final String description;
Expand Down
2 changes: 1 addition & 1 deletion lib/blogs/blogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Blogs extends StatelessWidget {
children: [
SizedBox(height: Constants.cardTitleSpacing),
GridView.count(
childAspectRatio: Constants.cardAspectRatio,
childAspectRatio: Constants.cardAspectRatioTablet,
mainAxisSpacing: Constants.cardSpacing,
crossAxisSpacing: Constants.cardSpacing,
shrinkWrap: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/portfolio_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PortfolioCard extends StatelessWidget {
vertical: Constants.cardPaddingVert,
horizontal: Constants.cardPaddingHori,
),
width: Constants.cardAspectRatio * Constants.cardHeight,
width: Constants.cardAspectRatioDesktop * Constants.cardHeight,
height: Constants.cardHeight,
child: child,
),
Expand Down
5 changes: 2 additions & 3 deletions lib/experience/experience.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Experience extends StatelessWidget {
children: [
SizedBox(height: Constants.cardTitleSpacing),
GridView.count(
childAspectRatio: Constants.cardAspectRatio,
childAspectRatio: Constants.cardAspectRatioTablet,
mainAxisSpacing: Constants.cardSpacing,
crossAxisSpacing: Constants.cardSpacing,
shrinkWrap: true,
Expand All @@ -56,8 +56,7 @@ final data = [
ExperienceData(
organizationName: "Some Company",
position: "SDE",
description:
"I worked on x with y to achieve z without doing p or q. I worked on x with y to achieve z without doing p or q.",
description: "I worked on x with y to achieve z without doing p or q.",
startYearMonth: "Aug 21",
endYearMonth: "Present",
),
Expand Down
14 changes: 11 additions & 3 deletions lib/experience/experience_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@ class ExperienceCard extends StatelessWidget {
CardTag(tag: data.position),
],
),
Text(data.organizationName,
style: Theme.of(context).textTheme.headline6),
Text(data.description),
Text(
data.organizationName,
style: Theme.of(context).textTheme.headline6,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
data.description,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/experience/experience_data.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:portfolio/utils/constants.dart';

class ExperienceData {
ExperienceData({
required this.organizationName,
required this.position,
required this.description,
required this.startYearMonth,
required this.endYearMonth,
}) : assert(description.length < 120);
}) : assert(description.length < Constants.charLimitCardDesc);

final String organizationName;
final String position;
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void main() {
ResponsiveSizingConfig.instance.setCustomBreakpoints(
ScreenBreakpoints(
desktop: (Constants.halfScreenWidth + Constants.globalPadding) * 2,
tablet: 1024,
tablet: 880,
watch: 200,
),
);
Expand Down
13 changes: 11 additions & 2 deletions lib/projects/project_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ class ProjectCard extends StatelessWidget {
),
],
),
Text(data.title, style: Theme.of(context).textTheme.headline6),
Text(data.description),
Text(
data.title,
style: Theme.of(context).textTheme.headline6,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
data.description,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/projects/project_data.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import 'package:portfolio/utils/constants.dart';

class ProjectData {
ProjectData({
required this.title,
required this.description,
required this.gitHub,
required this.link,
this.technologies = const [],
}) : assert(description.length < 120);
}) : assert(description.length < Constants.charLimitCardDesc);

final String title;
final String description;
Expand Down
4 changes: 2 additions & 2 deletions lib/projects/projects.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Projects extends StatelessWidget {
children: [
SizedBox(height: Constants.cardTitleSpacing),
GridView.count(
childAspectRatio: Constants.cardAspectRatio,
childAspectRatio: Constants.cardAspectRatioTablet,
mainAxisSpacing: Constants.cardSpacing,
crossAxisSpacing: Constants.cardSpacing,
shrinkWrap: true,
Expand All @@ -56,7 +56,7 @@ final data = [
ProjectData(
title: "Sweet title",
description:
"The quick brown fox jumped upon the lazy dog. The quick brown fox jumped upon the lazy dog.",
"The quick brown fox jumped upon the lazy dog. The quick brown fox jumped upon the lazy dog. The quick brown fox jumped upon the lazy dog. The quick brown fox jumped",
gitHub: "",
link: "",
technologies: ["Flutter", "Firebase"],
Expand Down
12 changes: 9 additions & 3 deletions lib/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
class Constants {
static const int charLimitCardDesc = 180;

static const double halfScreenWidth = 700.0;
static const double globalPadding = 8.0;

// Desktop only About
static const double aboutDesktopTopPadding = 120.0;
static const double aboutDesktopBottomPadding = 120.0;
static const double aboutDesktopLeftPadding = 0.0;
static const double aboutDesktopRightPadding = 80.0;

// Tablet only
// Tablet only About
static const double aboutTabletTopPadding = 20.0;
static const double aboutTabletBottomPadding = 0.0;
static const double aboutTabletLeftPadding = 20.0;
static const double aboutTabletRightPadding = 20.0;

// Icon sizes
static const double faIconSizeRegular = 20.0;
static const double faIconSizeCard = 12.0;
static const double faIconSizeCardHeader = 16.0;

// Desktop Card
static const double cardHeight = 180.0;
static const double cardAspectRatio = 3.3;
static const double cardAspectRatioDesktop = 3.3;
static const double cardPaddingVert = 20;
static const double cardPaddingHori = 30;
static const double cardIconSplash = 25;
static const double cardMargin = 4;

// Tablet only
// Tablet Card
static const double cardAspectRatioTablet = 2.2;
static const double cardSpacing = 10;
static const double cardTitleSpacing = 15;
}

0 comments on commit b3c76f4

Please sign in to comment.