Skip to content

Commit 73c9807

Browse files
committed
update staggared grid view to fit new api
1 parent 68e9ab1 commit 73c9807

File tree

1 file changed

+91
-65
lines changed

1 file changed

+91
-65
lines changed

lib/ui/projects.dart

Lines changed: 91 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:portfolio/widgets/user_project_list_item.dart';
1515

1616
class Projects extends StatefulWidget {
1717
static final String route = 'projects';
18+
1819
///CreateState method
1920
///Sets the state of the app (rebuilt each time a UI change is needed)
2021
@override
@@ -29,7 +30,7 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
2930
@override
3031
void initState() {
3132
super.initState();
32-
WidgetsBinding.instance.addPostFrameCallback((_){
33+
WidgetsBinding.instance.addPostFrameCallback((_) {
3334
RouteController.of(context)?.updateRoute("projects");
3435
});
3536
WidgetsBinding.instance.addObserver(this);
@@ -66,41 +67,53 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
6667
List<Widget> developerItems = getDeveloperItems();
6768
//Get the width and use it to get the axis count and dynamic padding size
6869
double width = MediaQuery.of(context).size.width;
69-
double paddingSize = CommonMethods.getDynamicPaddingSize(width, width/5000/1.5);
70-
int axisCount = CommonMethods.getGridAxisCount(MediaQuery.of(context).size.width, paddingSize, 300);
70+
double paddingSize =
71+
CommonMethods.getDynamicPaddingSize(width, width / 5000 / 1.5);
72+
int axisCount = CommonMethods.getGridAxisCount(
73+
MediaQuery.of(context).size.width, paddingSize, 300);
7174
return Scrollbar(
7275
child: SingleChildScrollView(
7376
primary: true,
7477
child: Padding(
7578
padding: EdgeInsets.fromLTRB(paddingSize, 10, paddingSize, 10),
7679
child: Column(
7780
children: [
78-
Text("Users", style: Theme.of(context).textTheme.headline4,),
79-
Padding(padding: EdgeInsets.all(10),),
80-
StaggeredGridView.countBuilder(
81+
Text(
82+
"Users",
83+
style: Theme.of(context).textTheme.headline4,
84+
),
85+
Padding(
86+
padding: EdgeInsets.all(10),
87+
),
88+
MasonryGridView.count(
8189
shrinkWrap: true,
8290
physics: ClampingScrollPhysics(),
8391
key: UniqueKey(),
8492
crossAxisCount: axisCount,
8593
itemCount: userItems.length,
8694
crossAxisSpacing: 10,
8795
mainAxisSpacing: 10,
88-
itemBuilder: (context, index) => userItems[index],
89-
staggeredTileBuilder: (index) => StaggeredTile.fit(1),
96+
itemBuilder: (context, index) => userItems[index],
97+
),
98+
Padding(
99+
padding: EdgeInsets.all(10),
100+
),
101+
Text(
102+
"Developers",
103+
style: Theme.of(context).textTheme.headline4,
90104
),
91-
Padding(padding: EdgeInsets.all(10),),
92-
Text("Developers", style: Theme.of(context).textTheme.headline4,),
93-
Padding(padding: EdgeInsets.all(10),),
94-
StaggeredGridView.countBuilder(
105+
Padding(
106+
padding: EdgeInsets.all(10),
107+
),
108+
MasonryGridView.count(
95109
shrinkWrap: true,
96110
physics: const ClampingScrollPhysics(),
97111
key: UniqueKey(),
98112
crossAxisCount: axisCount,
99113
itemCount: developerItems.length,
100114
crossAxisSpacing: 10,
101115
mainAxisSpacing: 10,
102-
itemBuilder: (context, index) => developerItems[index],
103-
staggeredTileBuilder: (index) => StaggeredTile.fit(1),
116+
itemBuilder: (context, index) => developerItems[index],
104117
),
105118
],
106119
),
@@ -115,43 +128,47 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
115128
return [
116129
//CrossClip's listing
117130
UserProjectListItem(
118-
image: AssetImage("assets/projects/crossclip/website_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png"),
131+
image: AssetImage(
132+
"assets/projects/crossclip/website_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png"),
119133
title: "CrossClip",
120-
description: "A secure, versatile, and seamless cross-platform clipboard manager and file transfer agent",
134+
description:
135+
"A secure, versatile, and seamless cross-platform clipboard manager and file transfer agent",
121136
projectStatus: ProjectStatus.RELEASED,
122-
linkRow: Row(
123-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
124-
children: [
125-
IconLink(
126-
icon: Icons.link,
127-
link: "https://cclip.app",
128-
padding: const EdgeInsets.all(10),
129-
)
130-
]
131-
),
137+
linkRow:
138+
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
139+
IconLink(
140+
icon: Icons.link,
141+
link: "https://cclip.app",
142+
padding: const EdgeInsets.all(10),
143+
)
144+
]),
132145
),
133146

134147
//FTC Scouting and Scoring's listing
135148
UserProjectListItem(
136149
image: AssetImage("assets/projects/ftcscoutscore/website_logo.png"),
137150
title: "FTC Scouring and Scoring",
138-
description: "An intuitive, real-time, cloud-based Scouting and Scoring application built for ease and synchronization",
151+
description:
152+
"An intuitive, real-time, cloud-based Scouting and Scoring application built for ease and synchronization",
139153
projectStatus: ProjectStatus.RELEASED,
140154
),
141155

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

150166
//Weasel's listing
151167
UserProjectListItem(
152168
image: AssetImage("assets/projects/weasel/website_logo.png"),
153169
title: "Weasel - A hackSugar Project",
154-
description: "An encrypted messaging client built to secure and improve upon the already widespread SMS protocol.",
170+
description:
171+
"An encrypted messaging client built to secure and improve upon the already widespread SMS protocol.",
155172
projectStatus: ProjectStatus.DEVELOPMENT,
156173
),
157174
];
@@ -164,14 +181,16 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
164181
//dargon2's listing
165182
DeveloperProjectListItem(
166183
title: "dargon2",
167-
description: "A simple, versatile, and full-featured library for hashing in dart with the Argon2 Password Hash Algorithm",
184+
description:
185+
"A simple, versatile, and full-featured library for hashing in dart with the Argon2 Password Hash Algorithm",
168186
projectStatus: ProjectStatus.RELEASED,
169187
linkRow: Row(
170188
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
171189
children: [
172190
ImageLink(
173191
link: "https://github.com/tmthecoder/dargon2",
174-
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
192+
assetUri:
193+
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
175194
edgeInsets: const EdgeInsets.all(10),
176195
),
177196
ImageLink(
@@ -192,14 +211,16 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
192211
//dargon2_fluter's Listing
193212
DeveloperProjectListItem(
194213
title: "dargon2_flutter",
195-
description: "A Flutter plugin to hash with the Argon2 Algorithm which inherits its bindings from dargon2_core",
214+
description:
215+
"A Flutter plugin to hash with the Argon2 Algorithm which inherits its bindings from dargon2_core",
196216
projectStatus: ProjectStatus.RELEASED,
197217
linkRow: Row(
198218
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
199219
children: [
200220
ImageLink(
201221
link: "https://github.com/tmthecoder/dargon2_flutter",
202-
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
222+
assetUri:
223+
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
203224
edgeInsets: const EdgeInsets.all(10),
204225
),
205226
ImageLink(
@@ -228,7 +249,8 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
228249
children: [
229250
ImageLink(
230251
link: "https://github.com/tmthecoder/dargon2_core",
231-
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
252+
assetUri:
253+
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
232254
edgeInsets: const EdgeInsets.all(10),
233255
),
234256
ImageLink(
@@ -249,14 +271,16 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
249271
//Argon2Swift's Listing
250272
DeveloperProjectListItem(
251273
title: "Argon2Swift",
252-
description: "A Swift plugin to hash with the Argon2 Algorithm built utilizing the reference Argon2 library",
274+
description:
275+
"A Swift plugin to hash with the Argon2 Algorithm built utilizing the reference Argon2 library",
253276
projectStatus: ProjectStatus.RELEASED,
254277
linkRow: Row(
255278
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
256279
children: [
257280
ImageLink(
258281
link: "https://github.com/tmthecoder/Argon2Swift",
259-
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
282+
assetUri:
283+
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
260284
edgeInsets: const EdgeInsets.all(10),
261285
),
262286
ImageLink(
@@ -275,42 +299,45 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
275299
),
276300
// xotp's Listing
277301
DeveloperProjectListItem(
278-
title: "xotp",
279-
description: "A Rust Crate that provides pure-rust implementations of the HOTP and TOTP algorithms",
280-
projectStatus: ProjectStatus.RELEASED,
281-
linkRow: Row(
282-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
283-
children: [
284-
ImageLink(
285-
link: "https://github.com/tmthecoder/xotp",
286-
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
287-
edgeInsets: const EdgeInsets.all(10),
288-
),
289-
ImageLink(
290-
link: "https://crates.io/crates/xotp",
291-
assetUri: "assets/third_party/cargo_logo.png",
292-
edgeInsets: const EdgeInsets.all(10),
293-
),
294-
IconLink(
295-
icon: Icons.code,
296-
link: "https://docs.tmthecoder.dev/xotp",
297-
padding: const EdgeInsets.all(10),
298-
)
299-
],
300-
),
301-
linkName: "xotp"
302-
),
302+
title: "xotp",
303+
description:
304+
"A Rust Crate that provides pure-rust implementations of the HOTP and TOTP algorithms",
305+
projectStatus: ProjectStatus.RELEASED,
306+
linkRow: Row(
307+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
308+
children: [
309+
ImageLink(
310+
link: "https://github.com/tmthecoder/xotp",
311+
assetUri:
312+
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
313+
edgeInsets: const EdgeInsets.all(10),
314+
),
315+
ImageLink(
316+
link: "https://crates.io/crates/xotp",
317+
assetUri: "assets/third_party/cargo_logo.png",
318+
edgeInsets: const EdgeInsets.all(10),
319+
),
320+
IconLink(
321+
icon: Icons.code,
322+
link: "https://docs.tmthecoder.dev/xotp",
323+
padding: const EdgeInsets.all(10),
324+
)
325+
],
326+
),
327+
linkName: "xotp"),
303328
//OdometryCore's Listing
304329
DeveloperProjectListItem(
305330
title: "Odometry Core",
306-
description: "A java library that houses and abstracts the core algorithm for three-encoder robot motion tracking",
331+
description:
332+
"A java library that houses and abstracts the core algorithm for three-encoder robot motion tracking",
307333
projectStatus: ProjectStatus.RELEASED,
308334
linkRow: Row(
309335
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
310336
children: [
311337
ImageLink(
312338
link: "https://github.com/tmthecoder/OdometryCore",
313-
assetUri: "assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
339+
assetUri:
340+
"assets/third_party/github_logo_${ThemeController.of(context).isDark ? "dark" : "light"}.png",
314341
edgeInsets: const EdgeInsets.all(10),
315342
),
316343
IconLink(
@@ -324,5 +351,4 @@ class ProjectsState extends State<Projects> with WidgetsBindingObserver {
324351
),
325352
];
326353
}
327-
328354
}

0 commit comments

Comments
 (0)