Skip to content

Commit 41f0a9b

Browse files
committed
Updated adaptive UI for BaseInfoPage
1 parent 77d0bf8 commit 41f0a9b

File tree

2 files changed

+61
-15
lines changed

2 files changed

+61
-15
lines changed

lib/pages/TestPage.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class TestPageState extends State {
233233
mainImageAsset: "assets/img/button_bg_contacts.png",
234234
logoImageAsset: "assets/img/logo_contacts_big.png",
235235
accentFilterColor: AppColors.ContentLightRed,
236-
subtitle: "Here you can find me",
236+
subtitle: "Find me here",
237237
content: Column(
238238
mainAxisAlignment: MainAxisAlignment.start,
239239
crossAxisAlignment: CrossAxisAlignment.start,

lib/pages/base/BaseInfoPage.dart

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class BaseInfoPage extends StatelessWidget {
6666
color: Colors.black54,
6767
colorBlendMode: BlendMode.darken,
6868
),
69-
_buildMainContent(content)
69+
_buildMainContent(content, isNeedToSwitchVertical)
7070
],
7171
// decoration: BoxDecoration(
7272
// image: DecorationImage(
@@ -120,7 +120,7 @@ class BaseInfoPage extends StatelessWidget {
120120
Expanded(
121121
child: Container(
122122
alignment: Alignment.topLeft,
123-
child: _buildMainContent(content)),
123+
child: _buildMainContent(content, isNeedToSwitchVertical)),
124124
),
125125
Transform.flip(
126126
flipX: true,
@@ -167,17 +167,54 @@ class BaseInfoPage extends StatelessWidget {
167167
});
168168
}
169169

170-
Widget _buildMainContent(Widget content) {
171-
if (subtitle != null) {
172-
return Column(
173-
mainAxisAlignment: MainAxisAlignment.start,
174-
crossAxisAlignment: CrossAxisAlignment.center,
175-
children: [
176-
Align(
177-
alignment: Alignment.bottomCenter,
178-
child: isPaddingEnabled
170+
Widget _buildAdaptiveSubtitle(
171+
bool isPaddingEnabled,
172+
bool isNeedToSwitchVertical,
173+
String logoImageAsset,
174+
Color? accentFilterColor) {
175+
176+
Widget bgImage = Padding(
177+
padding: EdgeInsets.all(16.0),
178+
child: Opacity(
179+
opacity: 0.7,
180+
child: Image.asset(
181+
logoImageAsset,
182+
height: 160.0,
183+
),
184+
),
185+
);
186+
187+
return Align(
188+
alignment: Alignment.bottomCenter,
189+
child: isNeedToSwitchVertical ? Stack(
190+
alignment: AlignmentDirectional.center,
191+
children: [
192+
RotatedBox(
193+
quarterTurns: 1,
194+
child: accentFilterColor != null
195+
? ColorFiltered(
196+
colorFilter: ColorFilter.mode(
197+
accentFilterColor, BlendMode.srcATop),
198+
child: bgImage,
199+
)
200+
: bgImage,
201+
),
202+
isPaddingEnabled
179203
? Padding(
180-
padding: EdgeInsets.only(top: 64.0),
204+
padding: EdgeInsets.only(top: 18.0, bottom: 18.0),
205+
child: TextTitle(
206+
text: subtitle!,
207+
textColor: accentFilterColor ?? AppColors.ContentWhite,
208+
),
209+
)
210+
: TextTitle(
211+
text: subtitle!,
212+
textColor: accentFilterColor ?? AppColors.ContentWhite,
213+
),
214+
],
215+
) : isPaddingEnabled
216+
? Padding(
217+
padding: EdgeInsets.only(top: 18.0, bottom: 18.0),
181218
child: TextTitleBig(
182219
text: subtitle!,
183220
textColor: accentFilterColor ?? AppColors.ContentWhite,
@@ -186,8 +223,17 @@ class BaseInfoPage extends StatelessWidget {
186223
: TextTitleBig(
187224
text: subtitle!,
188225
textColor: accentFilterColor ?? AppColors.ContentWhite,
189-
),
190-
),
226+
),);
227+
}
228+
229+
Widget _buildMainContent(Widget content, bool isNeedToSwitchVertical) {
230+
if (subtitle != null) {
231+
return Column(
232+
mainAxisAlignment: MainAxisAlignment.start,
233+
crossAxisAlignment: CrossAxisAlignment.center,
234+
children: [
235+
_buildAdaptiveSubtitle(isPaddingEnabled, isNeedToSwitchVertical,
236+
logoImageAsset, accentFilterColor),
191237
Flexible(child: _buildContentContainer(content))
192238
],
193239
);

0 commit comments

Comments
 (0)