-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: feed base post, content scaling, font (#29)
* add base feed post (footer, header + text as body) * add NotoSans font, apply it for all app text themes * add font scaling * fix icon scaling * adjust feed screen offsets
- Loading branch information
Showing
49 changed files
with
425 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,4 @@ SPEC CHECKSUMS: | |
|
||
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 | ||
|
||
COCOAPODS: 1.14.3 | ||
COCOAPODS: 1.15.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
lib/app/features/core/views/components/content_scaler.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
|
||
class ContentScaler extends StatelessWidget { | ||
const ContentScaler({ | ||
super.key, | ||
required this.child, | ||
}); | ||
|
||
final Widget child; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ScreenUtilInit( | ||
designSize: const Size(375, 812), | ||
builder: (BuildContext context, Widget? widget) => MediaQuery( | ||
data: MediaQuery.of(context) | ||
.copyWith(textScaler: TextScaler.linear(1.0.sp)), | ||
child: child, | ||
), | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/app/features/feed/components/post/components/post_body/post_body.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/components/screen_side_offset/screen_side_offset.dart'; | ||
import 'package:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
|
||
class PostBody extends StatelessWidget { | ||
const PostBody({ | ||
super.key, | ||
required this.content, | ||
}); | ||
|
||
final String content; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ScreenSideOffset.small( | ||
child: Text( | ||
content, | ||
style: context.theme.appTextThemes.body2 | ||
.copyWith(color: context.theme.appColors.sharkText), | ||
), | ||
); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
lib/app/features/feed/components/post/components/post_footer/post_engagement_metric.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/num.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
|
||
class PostEngagementMetric extends StatelessWidget { | ||
const PostEngagementMetric({ | ||
super.key, | ||
required this.icon, | ||
required this.onPressed, | ||
this.value, | ||
}); | ||
|
||
static double get horizontalHitSlop => 12.0.s; | ||
static double get verticalHitSlop => 6.0.s; | ||
|
||
final Widget icon; | ||
final VoidCallback onPressed; | ||
final String? value; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return TextButton( | ||
onPressed: onPressed, | ||
child: Padding( | ||
padding: EdgeInsets.symmetric( | ||
vertical: verticalHitSlop, | ||
horizontal: horizontalHitSlop, | ||
), | ||
child: Row( | ||
children: <Widget>[ | ||
IconTheme( | ||
data: IconThemeData( | ||
size: 16.0.s, | ||
color: context.theme.appColors.onTertararyBackground, | ||
), | ||
child: icon, | ||
), | ||
if (value != null) | ||
Padding( | ||
padding: EdgeInsets.only(left: 4.0.s), | ||
child: Text( | ||
value!, | ||
style: context.theme.appTextThemes.caption2.copyWith( | ||
color: context.theme.appColors.onTertararyBackground, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
lib/app/features/feed/components/post/components/post_footer/post_footer.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'dart:math'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/components/screen_side_offset/screen_side_offset.dart'; | ||
import 'package:ice/app/extensions/asset_gen_image.dart'; | ||
import 'package:ice/app/extensions/num.dart'; | ||
import 'package:ice/app/features/feed/components/post/components/post_footer/post_engagement_metric.dart'; | ||
import 'package:ice/app/features/feed/components/post/components/post_footer/post_metric_space.dart'; | ||
import 'package:ice/generated/assets.gen.dart'; | ||
|
||
class PostFooter extends StatelessWidget { | ||
const PostFooter({super.key}); | ||
|
||
static double get horizontalPadding => max( | ||
ScreenSideOffset.defaultSmallMargin - | ||
PostEngagementMetric.horizontalHitSlop, | ||
0, | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: EdgeInsets.fromLTRB( | ||
horizontalPadding, | ||
10.0.s, | ||
horizontalPadding, | ||
0, | ||
), | ||
child: Row( | ||
children: <Widget>[ | ||
PostMetricSpace( | ||
child: PostEngagementMetric( | ||
onPressed: () {}, | ||
icon: Assets.images.icons.iconBlockComment.icon(size: 16.0.s), | ||
value: '121k', | ||
), | ||
), | ||
PostMetricSpace( | ||
child: PostEngagementMetric( | ||
onPressed: () {}, | ||
icon: Assets.images.icons.iconBlockRepost.icon(size: 16.0.s), | ||
value: '442k', | ||
), | ||
), | ||
PostMetricSpace( | ||
child: PostEngagementMetric( | ||
onPressed: () {}, | ||
icon: Assets.images.icons.iconVideoLikeOff.icon(size: 16.0.s), | ||
value: '121k', | ||
), | ||
), | ||
PostMetricSpace( | ||
child: PostEngagementMetric( | ||
onPressed: () {}, | ||
icon: Assets.images.icons.iconButtonIceStroke.icon(size: 16.0.s), | ||
value: '7', | ||
), | ||
), | ||
PostEngagementMetric( | ||
onPressed: () {}, | ||
icon: Assets.images.icons.iconBlockShare.icon(size: 16.0.s), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
lib/app/features/feed/components/post/components/post_footer/post_metric_space.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class PostMetricSpace extends StatelessWidget { | ||
const PostMetricSpace({super.key, required this.child}); | ||
|
||
final Widget child; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Expanded( | ||
child: Container( | ||
alignment: Alignment.centerLeft, | ||
child: IntrinsicWidth( | ||
child: child, | ||
), | ||
), | ||
); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
lib/app/features/feed/components/post/components/post_header/post_header.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/components/list_item/list_item.dart'; | ||
import 'package:ice/app/components/screen_side_offset/screen_side_offset.dart'; | ||
import 'package:ice/app/extensions/num.dart'; | ||
|
||
class PostHeader extends StatelessWidget { | ||
const PostHeader({ | ||
super.key, | ||
this.trailing, | ||
}); | ||
|
||
final Widget? trailing; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ScreenSideOffset.small( | ||
child: Padding( | ||
padding: EdgeInsets.only(top: 2.0.s), | ||
child: ListItem.user( | ||
title: const Text('Arnold Grey'), | ||
subtitle: const Text('@arnoldgrey'), | ||
profilePicture: | ||
'https://ice-staging.b-cdn.net/profile/default-profile-picture-16.png', | ||
trailing: trailing, | ||
constraints: BoxConstraints(minHeight: 55.0.s), | ||
iceBadge: true, | ||
verifiedBadge: true, | ||
), | ||
), | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
lib/app/features/feed/components/post/components/post_header/post_menu.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/extensions/asset_gen_image.dart'; | ||
import 'package:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/num.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
import 'package:ice/generated/assets.gen.dart'; | ||
|
||
class PostMenu extends StatelessWidget { | ||
const PostMenu({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
width: 48.0.s, | ||
height: 48.0.s, | ||
transform: Matrix4.translationValues(12.0.s, 0, 0), | ||
child: IconButton( | ||
onPressed: () {}, | ||
icon: Assets.images.icons.iconMorePopup.icon( | ||
color: context.theme.appColors.onTertararyBackground, | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.