Skip to content

Commit

Permalink
[article] add support for the atomPullQuote article part
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed Oct 17, 2023
1 parent 68cb63e commit f106af6
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/Screens/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class TestScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const ArticleScreen(
'3wxsajxBvFzSUkn4Z19wEu',
'yt video',
'gNNm6u0VT260LtqZzgeY6',
'quote',
true,
);
}
Expand Down
126 changes: 110 additions & 16 deletions lib/api/article_parts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ class WidgetsList extends StatelessWidget {
)
: element['contentType'] == 'atomImageGallery'
? ImageGallery(
element['fields']['imageGallery'])
element['fields']['imageGallery'],
)
: element['contentType'] == 'atomSocialPost'
? element['fields']['postType'] ==
'Twitter'
Expand Down Expand Up @@ -1313,23 +1314,116 @@ class WidgetsList extends StatelessWidget {
),
),
)
: SizedBox(
height: 100,
child: Center(
child:
SelectableText(
'Unsupported widget ¯\\_(ツ)_/¯\nType: ${element['contentType']}\nArticle id: ${article.articleId}',
style:
TextStyle(
color: useDarkMode
? Colors
.white
: Colors
.black,
: element['contentType'] ==
'atomPullQuote'
? Column(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Row(
mainAxisSize:
MainAxisSize
.min,
children: [
Expanded(
flex:
1,
child:
Padding(
padding:
const EdgeInsets.only(left: 5),
child:
Text(
'“',
style: TextStyle(
color: useDarkMode ? Colors.grey[400] : Colors.grey[800],
fontSize: 50,
),
),
),
),
Expanded(
flex:
20,
child:
Align(
alignment:
Alignment.center,
child:
Padding(
padding: const EdgeInsets.fromLTRB(15, 10, 15, 10),
child: Text(
element['fields']['quoteText'],
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 22,
fontStyle: FontStyle.italic,
),
),
),
),
),
Expanded(
flex:
1,
child:
Padding(
padding:
const EdgeInsets.only(right: 5),
child:
Text(
'”',
style: TextStyle(
color: useDarkMode ? Colors.grey[400] : Colors.grey[800],
fontSize: 50,
),
),
),
),
],
),
Padding(
padding:
const EdgeInsets
.only(
left:
10,
),
child:
Text(
element['fields']
[
'quoteCitation'],
style:
TextStyle(
color: useDarkMode
? Colors.grey[400]
: Colors.grey[800],
fontSize:
17,
fontWeight:
FontWeight.w500,
),
),
),
],
)
: SizedBox(
height: 100,
child: Center(
child:
SelectableText(
'Unsupported widget ¯\\_(ツ)_/¯\nType: ${element['contentType']}\nArticle id: ${article.articleId}',
style:
TextStyle(
color: useDarkMode
? Colors.white
: Colors.black,
),
),
),
),
),
),

// author

Expand Down
2 changes: 1 addition & 1 deletion lib/api/news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2388,7 +2388,7 @@ class _ImageGalleryState extends State<ImageGallery> {
],
options: CarouselOptions(
viewportFraction: 1,
aspectRatio: 16 / 9,
//aspectRatio: 16 / 9,
enableInfiniteScroll: false,
enlargeCenterPage: true,
autoPlay: true,
Expand Down

0 comments on commit f106af6

Please sign in to comment.