Skip to content

Commit

Permalink
fixing active project
Browse files Browse the repository at this point in the history
  • Loading branch information
firgia committed Nov 1, 2021
1 parent 7d0d8dd commit d457a2b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ part of dashboard;

class _ActiveProjectCard extends StatelessWidget {
const _ActiveProjectCard({
required this.data,
required this.child,
required this.onPressedSeeAll,
Key? key,
}) : super(key: key);

final List<ProjectCardData> data;
final Widget child;
final Function() onPressedSeeAll;

@override
Expand All @@ -32,11 +32,7 @@ class _ActiveProjectCard extends StatelessWidget {
height: kSpacing,
),
const SizedBox(height: kSpacing),
Row(
children: data
.map((e) => Expanded(child: ProjectCard(data: e)))
.toList(),
)
child,
],
),
),
Expand Down
22 changes: 20 additions & 2 deletions lib/app/features/dashboard/views/screens/dashboard_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class DashboardScreen extends GetView<DashboardController> {
const SizedBox(height: kSpacing * 2),
_buildActiveProject(
data: controller.getActiveProject(),
crossAxisCount: 6,
crossAxisCellCount: (constraints.maxWidth < 1360) ? 3 : 2,
),
const SizedBox(height: kSpacing),
],
Expand Down Expand Up @@ -188,12 +190,28 @@ class DashboardScreen extends GetView<DashboardController> {
);
}

Widget _buildActiveProject({required List<ProjectCardData> data}) {
Widget _buildActiveProject({
required List<ProjectCardData> data,
int crossAxisCount = 6,
int crossAxisCellCount = 2,
}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: kSpacing),
child: _ActiveProjectCard(
onPressedSeeAll: () {},
data: data,
child: StaggeredGridView.countBuilder(
crossAxisCount: crossAxisCount,
itemCount: data.length,
addAutomaticKeepAlives: false,
mainAxisSpacing: kSpacing,
crossAxisSpacing: kSpacing,
shrinkWrap: true,
itemBuilder: (context, index) {
return ProjectCard(data: data[index]);
},
staggeredTileBuilder: (int index) =>
StaggeredTile.fit(crossAxisCellCount),
),
),
);
}
Expand Down

0 comments on commit d457a2b

Please sign in to comment.