Skip to content

Commit

Permalink
Updated BaseInfoPage factory
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyLabsDev committed Feb 12, 2024
1 parent 44b37ea commit 115b7da
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions lib/pages/TestPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class TestPageState extends State {
mainImageAsset: "assets/img/button_bg_art.png",
logoImageAsset: "assets/img/logo_art_big.png",
isScrollable: false,
isPaddingEnabled: false,
content: ImageGallery(),
);
}
Expand Down
17 changes: 12 additions & 5 deletions lib/pages/base/BaseInfoPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ class BaseInfoPage extends StatelessWidget {
final String logoImageAsset;
final Widget content;
bool isScrollable;
bool isPaddingEnabled;

BaseInfoPage(
{super.key,
required this.title,
required this.mainImageAsset,
required this.logoImageAsset,
required this.content,
this.isScrollable = true});
this.isScrollable = true,
this.isPaddingEnabled = true});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -62,16 +64,21 @@ class BaseInfoPage extends StatelessWidget {
if (isScrollable) {
return SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Padding(
padding: EdgeInsets.all(32.0),
child: content,
)
child: _buildContentByPadding(content)
);
} else {
return _buildContentByPadding(content);
}
}

Widget _buildContentByPadding(Widget content) {
if (isPaddingEnabled) {
return Padding(
padding: EdgeInsets.all(32.0),
child: content,
);
} else {
return content;
}
}
}
27 changes: 10 additions & 17 deletions lib/widgets/base/ImageGallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,23 @@ class SimpleGalleryState extends State {
}

return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextTitle(
text: "W: ${constraints.maxWidth} H: ${constraints.maxHeight}"),
Row(
child: Row(
children: [
InkWell(
onTap: () {},
onHover: (isHovered) {
_updateWidths(isHovered, 0);
},
child: AnimatedContainer(
height: constraints.maxHeight - 48,
height: constraints.maxHeight,
width: widthsList[0],
curve: Curves.fastOutSlowIn,
duration: Durations.medium4,
child: Image.asset(
"assets/img/button_bg_bio.png",
fit: BoxFit.cover,
height:
constraints.maxHeight - 48, //48 - external padding
constraints.maxHeight, //48 - external padding
),
),
),
Expand All @@ -60,15 +55,15 @@ class SimpleGalleryState extends State {
_updateWidths(isHovered, 1);
},
child: AnimatedContainer(
height: constraints.maxHeight - 48,
height: constraints.maxHeight,
width: widthsList[1],
curve: Curves.fastOutSlowIn,
duration: Durations.medium4,
child: Image.asset(
"assets/img/button_bg_skills.png",
fit: BoxFit.cover,
height:
constraints.maxHeight - 48, //48 - external padding
constraints.maxHeight, //48 - external padding
),
),
),
Expand All @@ -78,15 +73,15 @@ class SimpleGalleryState extends State {
_updateWidths(isHovered, 2);
},
child: AnimatedContainer(
height: constraints.maxHeight - 48,
height: constraints.maxHeight,
width: widthsList[2],
curve: Curves.fastOutSlowIn,
duration: Durations.medium4,
child: Image.asset(
"assets/img/button_bg_contacts.png",
fit: BoxFit.cover,
height:
constraints.maxHeight - 48, //48 - external padding
constraints.maxHeight, //48 - external padding
),
),
),
Expand All @@ -96,22 +91,20 @@ class SimpleGalleryState extends State {
_updateWidths(isHovered, 3);
},
child: AnimatedContainer(
height: constraints.maxHeight - 48,
height: constraints.maxHeight,
width: widthsList[3],
curve: Curves.fastOutSlowIn,
duration: Durations.medium4,
child: Image.asset(
"assets/img/button_bg_art.png",
fit: BoxFit.cover,
height:
constraints.maxHeight - 48, //48 - external padding
constraints.maxHeight, //48 - external padding
),
),
),
],
)
],
),
),
);
});
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96
sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c
url: "https://pub.dev"
source: hosted
version: "6.2.3"
version: "6.2.4"
url_launcher_android:
dependency: transitive
description:
Expand Down

0 comments on commit 115b7da

Please sign in to comment.