Skip to content

Commit 27ee9b2

Browse files
committed
WIP Bio/about info content with adaptive layout
1 parent 0ada54b commit 27ee9b2

File tree

2 files changed

+82
-8
lines changed

2 files changed

+82
-8
lines changed

lib/pages/UiTestPage.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import 'dart:core';
22

33
import 'package:flutter/material.dart';
44
import 'package:threeactions_area/pages/base/BaseInfoPage.dart';
5-
import 'package:threeactions_area/resources/Resources.dart';
6-
7-
import '../widgets/cv_elements/EventsBlock.dart';
5+
import '../widgets/bio_elements/BioInfoContent.dart';
86

97
class UiTestpage extends StatefulWidget {
108
@override
@@ -20,9 +18,15 @@ class UiTestPageState extends State {
2018
title: "UiTestPage",
2119
mainImageAsset: "assets/img/button_bg_skills.png",
2220
logoImageAsset: "assets/img/logo_skills_big.png",
23-
content: EventsBlock(titleColor: AppColors.ContentDarkBlue,));
21+
content: BioInfoContent(
22+
data: [
23+
BioInfoModel("assets/img/img_gallery_2.jpg", "title", "description"),
24+
BioInfoModel("assets/img/img_gallery_2.jpg", "title", "description"),
25+
BioInfoModel("assets/img/img_gallery_2.jpg", "title", "description"),
26+
BioInfoModel("assets/img/img_gallery_2.jpg", "title", "description"),
27+
BioInfoModel("assets/img/img_gallery_2.jpg", "title", "description"),
28+
],
29+
)
30+
);
2431
}
25-
}
26-
27-
28-
32+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import 'package:collection/collection.dart';
2+
import 'package:flutter/widgets.dart';
3+
4+
import '../base/TextContentBig.dart';
5+
import '../base/TextSubtitle.dart';
6+
7+
class BioInfoModel {
8+
String resourcePath;
9+
String title;
10+
String description;
11+
12+
BioInfoModel(this.resourcePath, this.title, this.description);
13+
}
14+
15+
class BioInfoContent extends StatelessWidget {
16+
final List<BioInfoModel> data;
17+
18+
const BioInfoContent({super.key, required this.data});
19+
20+
@override
21+
Widget build(BuildContext context) {
22+
return Wrap(
23+
children: data.mapIndexed((int index, BioInfoModel item) {
24+
bool isFullScreenWidth = (index + 1) % 3 == 0;
25+
return BioInfoCard(isFullWidth: isFullScreenWidth, model: item);
26+
}).toList());
27+
}
28+
}
29+
30+
class BioInfoCard extends StatelessWidget {
31+
bool isFullWidth = false;
32+
BioInfoModel model;
33+
34+
BioInfoCard({super.key, this.isFullWidth = false, required this.model});
35+
36+
@override
37+
Widget build(BuildContext context) {
38+
return LayoutBuilder(
39+
builder: (BuildContext context, BoxConstraints constraints) {
40+
bool enableVerticalScreenMode = constraints.maxWidth <= 600;
41+
42+
double? containerWidth;
43+
44+
if (enableVerticalScreenMode || isFullWidth) {
45+
containerWidth = constraints.maxWidth;
46+
} else {
47+
containerWidth = constraints.maxWidth / 2;
48+
}
49+
50+
return Container(
51+
width: containerWidth,
52+
height: 320.0,
53+
padding: EdgeInsets.all(4.0),
54+
child: Container(
55+
decoration: BoxDecoration(
56+
image: DecorationImage(
57+
image: AssetImage(model.resourcePath), fit: BoxFit.fitWidth)),
58+
child: Column(
59+
mainAxisAlignment: MainAxisAlignment.center,
60+
crossAxisAlignment: CrossAxisAlignment.center,
61+
children: [
62+
TextSubtitle(text: model.title),
63+
TextContentBig(text: model.description)
64+
],
65+
),
66+
)
67+
);
68+
});
69+
}
70+
}

0 commit comments

Comments
 (0)