-
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.
- Loading branch information
Showing
21 changed files
with
712 additions
and
260 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
org.gradle.jvmargs=-Xmx8192m | ||
org.gradle.parallel=true | ||
android.useAndroidX=true | ||
android.enableJetifier=true |
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
33 changes: 33 additions & 0 deletions
33
lib/app/features/feed/widgets/article_header/article_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,33 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; | ||
|
||
class ArticleHeader extends StatelessWidget { | ||
const ArticleHeader({ | ||
super.key, | ||
required this.headerText, | ||
this.isMainHeader = false, | ||
}); | ||
|
||
final String headerText; | ||
final bool isMainHeader; | ||
|
||
TextStyle getStyle(BuildContext context) { | ||
final Color color = context.theme.appColors.sharkText; | ||
if (isMainHeader) { | ||
return context.theme.appTextThemes.headline2.copyWith(color: color); | ||
} | ||
return context.theme.appTextThemes.title.copyWith(color: color); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ScreenSideOffset.small( | ||
child: Text( | ||
headerText, | ||
style: getStyle(context), | ||
), | ||
); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
lib/app/features/feed/widgets/article_header/widgetbook.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,31 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/features/feed/widgets/article_header/article_header.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
|
||
@widgetbook.UseCase( | ||
name: 'article header', | ||
type: ArticleHeader, | ||
) | ||
Widget plainArticleHeader(BuildContext context) { | ||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
ArticleHeader( | ||
headerText: context.knobs.string( | ||
label: 'Article Header', | ||
initialValue: | ||
'Coinbase Launches USDC Yields for Global Customers Amid US Crackdown', | ||
), | ||
isMainHeader: true, | ||
), | ||
ArticleHeader( | ||
headerText: context.knobs.string( | ||
label: 'Article Header', | ||
initialValue: | ||
'In 22 years, AI will perform 50% of work tasks, These are the results of McKinsey study', | ||
), | ||
), | ||
], | ||
); | ||
} |
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,81 @@ | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
import 'package:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
import 'package:ice/app/features/feed/widgets/read_time_tile/read_time_tile.dart'; | ||
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart'; | ||
import 'package:ice/utils/Image_utils.dart'; | ||
|
||
double borderRadius = 12.0.w; | ||
|
||
class PostImage extends StatelessWidget { | ||
const PostImage({ | ||
super.key, | ||
required this.imageUrl, | ||
this.minutesToRead, | ||
this.minutesToReadAlignment, | ||
}); | ||
|
||
final String imageUrl; | ||
final int? minutesToRead; | ||
final Alignment? minutesToReadAlignment; | ||
|
||
BorderRadius getOverlayBorderRadius(Alignment alignment) { | ||
if (alignment == Alignment.bottomRight || alignment == Alignment.topLeft) { | ||
return BorderRadius.only( | ||
topLeft: Radius.circular(borderRadius), | ||
bottomRight: Radius.circular(borderRadius), | ||
); | ||
} | ||
if (alignment == Alignment.topRight || alignment == Alignment.bottomLeft) { | ||
return BorderRadius.only( | ||
topRight: Radius.circular(borderRadius), | ||
bottomLeft: Radius.circular(borderRadius), | ||
); | ||
} | ||
return BorderRadius.all(Radius.circular(borderRadius)); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final double paddingHorizontal = ScreenSideOffset.defaultSmallMargin; | ||
final double imageWidth = | ||
MediaQuery.of(context).size.width - paddingHorizontal * 2; | ||
|
||
final Alignment alignment = minutesToReadAlignment ?? Alignment.bottomRight; | ||
|
||
return Padding( | ||
padding: EdgeInsets.symmetric(horizontal: paddingHorizontal), | ||
child: ClipRRect( | ||
borderRadius: BorderRadius.circular(borderRadius), | ||
child: Stack( | ||
alignment: alignment, | ||
children: <Widget>[ | ||
CachedNetworkImage( | ||
imageUrl: ImageUtils.getAdaptiveImageUrl(imageUrl, imageWidth), | ||
width: imageWidth, | ||
fit: BoxFit.cover, | ||
), | ||
if (minutesToRead != null) ...<Widget>[ | ||
Container( | ||
padding: | ||
EdgeInsets.symmetric(horizontal: 8.0.w, vertical: 4.0.w), | ||
decoration: BoxDecoration( | ||
color: context.theme.appColors.tertararyBackground, | ||
border: Border.all( | ||
color: context.theme.appColors.onTerararyFill, | ||
), | ||
borderRadius: getOverlayBorderRadius(alignment), | ||
), | ||
child: ReadTimeTile( | ||
minutesToRead: minutesToRead!, | ||
), | ||
), | ||
], | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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,27 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice/app/features/feed/widgets/post_image/post_image.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
|
||
@widgetbook.UseCase( | ||
name: 'base case', | ||
type: PostImage, | ||
) | ||
Widget baseUseCase(BuildContext context) { | ||
return const PostImage( | ||
imageUrl: | ||
'https://ice.io/wp-content/uploads/2023/03/Pre-Release-600x403.png', | ||
); | ||
} | ||
|
||
@widgetbook.UseCase( | ||
name: 'with read time overlay', | ||
type: PostImage, | ||
) | ||
Widget withReadTimeUseCase(BuildContext context) { | ||
return const PostImage( | ||
imageUrl: | ||
'https://ice.io/wp-content/uploads/2023/03/Pre-Release-600x403.png', | ||
minutesToRead: 7, | ||
minutesToReadAlignment: Alignment.topRight, | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
lib/app/features/feed/widgets/read_time_tile/read_time_tile.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:flutter_screenutil/flutter_screenutil.dart'; | ||
import 'package:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
|
||
double iconSize = 16.0.w; | ||
|
||
class ReadTimeTile extends StatelessWidget { | ||
const ReadTimeTile({super.key, required this.minutesToRead}); | ||
|
||
final int minutesToRead; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: <Widget>[ | ||
Icon( | ||
Icons.access_time, | ||
size: iconSize, | ||
color: context.theme.appColors.sharkText, | ||
), | ||
SizedBox(width: 3.0.w), | ||
Text( | ||
context.i18n.read_time_in_mins(minutesToRead), | ||
style: context.theme.appTextThemes.caption | ||
.copyWith(color: context.theme.appColors.sharkText), | ||
), | ||
], | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
lib/app/features/feed/widgets/read_time_tile/widgetbook.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:ice/app/extensions/build_context.dart'; | ||
import 'package:ice/app/extensions/theme_data.dart'; | ||
import 'package:ice/app/features/feed/widgets/read_time_tile/read_time_tile.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook; | ||
|
||
@widgetbook.UseCase( | ||
name: 'base case', | ||
type: ReadTimeTile, | ||
) | ||
Widget baseUseCase(BuildContext context) { | ||
return ColoredBox( | ||
color: context.theme.appColors.onTerararyFill, | ||
child: ReadTimeTile( | ||
minutesToRead: context.knobs.int.slider( | ||
label: 'Minutes To Read', | ||
initialValue: 7, | ||
max: 120, | ||
), | ||
), | ||
); | ||
} |
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
Oops, something went wrong.