Skip to content

Commit

Permalink
update staggared grid view to fit new api
Browse files Browse the repository at this point in the history
  • Loading branch information
tmthecoder committed Jul 26, 2023
1 parent 68e9ab1 commit 73c9807
Showing 1 changed file with 91 additions and 65 deletions.
156 changes: 91 additions & 65 deletions lib/ui/projects.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:portfolio/widgets/user_project_list_item.dart';

class Projects extends StatefulWidget {
static final String route = 'projects';

///CreateState method
///Sets the state of the app (rebuilt each time a UI change is needed)
@override
Expand All @@ -29,7 +30,7 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_){
WidgetsBinding.instance.addPostFrameCallback((_) {
RouteController.of(context)?.updateRoute("projects");
});
WidgetsBinding.instance.addObserver(this);
Expand Down Expand Up @@ -66,41 +67,53 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
List<Widget> developerItems = getDeveloperItems();
//Get the width and use it to get the axis count and dynamic padding size
double width = MediaQuery.of(context).size.width;
double paddingSize = CommonMethods.getDynamicPaddingSize(width, width/5000/1.5);
int axisCount = CommonMethods.getGridAxisCount(MediaQuery.of(context).size.width, paddingSize, 300);
double paddingSize =
CommonMethods.getDynamicPaddingSize(width, width / 5000 / 1.5);
int axisCount = CommonMethods.getGridAxisCount(
MediaQuery.of(context).size.width, paddingSize, 300);
return Scrollbar(
child: SingleChildScrollView(
primary: true,
child: Padding(
padding: EdgeInsets.fromLTRB(paddingSize, 10, paddingSize, 10),
child: Column(
children: [
Text("Users", style: Theme.of(context).textTheme.headline4,),
Padding(padding: EdgeInsets.all(10),),
StaggeredGridView.countBuilder(
Text(
"Users",
style: Theme.of(context).textTheme.headline4,
),
Padding(
padding: EdgeInsets.all(10),
),
MasonryGridView.count(
shrinkWrap: true,
physics: ClampingScrollPhysics(),
key: UniqueKey(),
crossAxisCount: axisCount,
itemCount: userItems.length,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
itemBuilder: (context, index) => userItems[index],
staggeredTileBuilder: (index) => StaggeredTile.fit(1),
itemBuilder: (context, index) => userItems[index],
),
Padding(
padding: EdgeInsets.all(10),
),
Text(
"Developers",
style: Theme.of(context).textTheme.headline4,
),
Padding(padding: EdgeInsets.all(10),),
Text("Developers", style: Theme.of(context).textTheme.headline4,),
Padding(padding: EdgeInsets.all(10),),
StaggeredGridView.countBuilder(
Padding(
padding: EdgeInsets.all(10),
),
MasonryGridView.count(
shrinkWrap: true,
physics: const ClampingScrollPhysics(),
key: UniqueKey(),
crossAxisCount: axisCount,
itemCount: developerItems.length,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
itemBuilder: (context, index) => developerItems[index],
staggeredTileBuilder: (index) => StaggeredTile.fit(1),
itemBuilder: (context, index) => developerItems[index],
),
],
),
Expand All @@ -115,43 +128,47 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
return [
//CrossClip's listing
UserProjectListItem(
image: AssetImage("assets/projects/crossclip/website_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png"),
image: AssetImage(
"assets/projects/crossclip/website_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png"),
title: "CrossClip",
description: "A secure, versatile, and seamless cross-platform clipboard manager and file transfer agent",
description:
"A secure, versatile, and seamless cross-platform clipboard manager and file transfer agent",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconLink(
icon: Icons.link,
link: "https://cclip.app",
padding: const EdgeInsets.all(10),
)
]
),
linkRow:
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
IconLink(
icon: Icons.link,
link: "https://cclip.app",
padding: const EdgeInsets.all(10),
)
]),
),

//FTC Scouting and Scoring's listing
UserProjectListItem(
image: AssetImage("assets/projects/ftcscoutscore/website_logo.png"),
title: "FTC Scouring and Scoring",
description: "An intuitive, real-time, cloud-based Scouting and Scoring application built for ease and synchronization",
description:
"An intuitive, real-time, cloud-based Scouting and Scoring application built for ease and synchronization",
projectStatus: ProjectStatus.RELEASED,
),

//blinkOS's listing
UserProjectListItem(
image: AssetImage("assets/projects/blinkos/website_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png"),
image: AssetImage(
"assets/projects/blinkos/website_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png"),
title: "blinkOS - A hackSugar Project",
description: "An Android-based operating system build to ensure the user's privacy, security, and anonymity.",
description:
"An Android-based operating system build to ensure the user's privacy, security, and anonymity.",
projectStatus: ProjectStatus.ALPHA,
),

//Weasel's listing
UserProjectListItem(
image: AssetImage("assets/projects/weasel/website_logo.png"),
title: "Weasel - A hackSugar Project",
description: "An encrypted messaging client built to secure and improve upon the already widespread SMS protocol.",
description:
"An encrypted messaging client built to secure and improve upon the already widespread SMS protocol.",
projectStatus: ProjectStatus.DEVELOPMENT,
),
];
Expand All @@ -164,14 +181,16 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
//dargon2's listing
DeveloperProjectListItem(
title: "dargon2",
description: "A simple, versatile, and full-featured library for hashing in dart with the Argon2 Password Hash Algorithm",
description:
"A simple, versatile, and full-featured library for hashing in dart with the Argon2 Password Hash Algorithm",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageLink(
link: "https://github.com/tmthecoder/dargon2",
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
assetUri:
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
ImageLink(
Expand All @@ -192,14 +211,16 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
//dargon2_fluter's Listing
DeveloperProjectListItem(
title: "dargon2_flutter",
description: "A Flutter plugin to hash with the Argon2 Algorithm which inherits its bindings from dargon2_core",
description:
"A Flutter plugin to hash with the Argon2 Algorithm which inherits its bindings from dargon2_core",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageLink(
link: "https://github.com/tmthecoder/dargon2_flutter",
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
assetUri:
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
ImageLink(
Expand Down Expand Up @@ -228,7 +249,8 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
children: [
ImageLink(
link: "https://github.com/tmthecoder/dargon2_core",
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
assetUri:
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
ImageLink(
Expand All @@ -249,14 +271,16 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
//Argon2Swift's Listing
DeveloperProjectListItem(
title: "Argon2Swift",
description: "A Swift plugin to hash with the Argon2 Algorithm built utilizing the reference Argon2 library",
description:
"A Swift plugin to hash with the Argon2 Algorithm built utilizing the reference Argon2 library",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageLink(
link: "https://github.com/tmthecoder/Argon2Swift",
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
assetUri:
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
ImageLink(
Expand All @@ -275,42 +299,45 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
),
// xotp's Listing
DeveloperProjectListItem(
title: "xotp",
description: "A Rust Crate that provides pure-rust implementations of the HOTP and TOTP algorithms",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageLink(
link: "https://github.com/tmthecoder/xotp",
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
ImageLink(
link: "https://crates.io/crates/xotp",
assetUri: "assets/third_party/cargo_logo.png",
edgeInsets: const EdgeInsets.all(10),
),
IconLink(
icon: Icons.code,
link: "https://docs.tmthecoder.dev/xotp",
padding: const EdgeInsets.all(10),
)
],
),
linkName: "xotp"
),
title: "xotp",
description:
"A Rust Crate that provides pure-rust implementations of the HOTP and TOTP algorithms",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageLink(
link: "https://github.com/tmthecoder/xotp",
assetUri:
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
ImageLink(
link: "https://crates.io/crates/xotp",
assetUri: "assets/third_party/cargo_logo.png",
edgeInsets: const EdgeInsets.all(10),
),
IconLink(
icon: Icons.code,
link: "https://docs.tmthecoder.dev/xotp",
padding: const EdgeInsets.all(10),
)
],
),
linkName: "xotp"),
//OdometryCore's Listing
DeveloperProjectListItem(
title: "Odometry Core",
description: "A java library that houses and abstracts the core algorithm for three-encoder robot motion tracking",
description:
"A java library that houses and abstracts the core algorithm for three-encoder robot motion tracking",
projectStatus: ProjectStatus.RELEASED,
linkRow: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ImageLink(
link: "https://github.com/tmthecoder/OdometryCore",
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
assetUri:
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
edgeInsets: const EdgeInsets.all(10),
),
IconLink(
Expand All @@ -324,5 +351,4 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
),
];
}

}

0 comments on commit 73c9807

Please sign in to comment.