fix: post_overview_screen

This commit is contained in:
mike doornenbal 2024-07-30 15:08:45 +02:00
parent 32fe08a7af
commit 971a030b5c
5 changed files with 27 additions and 52 deletions

View file

@ -3,9 +3,10 @@ import 'package:flutter/material.dart';
/// This class contains the paddings used in the timeline options /// This class contains the paddings used in the timeline options
class TimelinePaddingOptions { class TimelinePaddingOptions {
const TimelinePaddingOptions({ const TimelinePaddingOptions({
this.mainPadding = const EdgeInsets.only(left: 32, top: 20, right: 32), this.mainPadding =
const EdgeInsets.only(left: 32, top: 20, right: 32, bottom: 40),
this.postPadding = this.postPadding =
const EdgeInsets.only(left: 12.0, top: 6, right: 12.0, bottom: 8), const EdgeInsets.only(left: 12.0, top: 12, right: 12.0, bottom: 8),
this.postOverviewButtonBottomPadding = 30.0, this.postOverviewButtonBottomPadding = 30.0,
this.categoryButtonTextPadding, this.categoryButtonTextPadding,
}); });

View file

@ -177,7 +177,6 @@ class _TimelinePostCreationScreenState
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
// input field for the content
Text( Text(
widget.options.translations.uploadImage, widget.options.translations.uploadImage,
style: theme.textTheme.titleMedium, style: theme.textTheme.titleMedium,
@ -186,7 +185,6 @@ class _TimelinePostCreationScreenState
widget.options.translations.uploadImageDescription, widget.options.translations.uploadImageDescription,
style: theme.textTheme.bodySmall, style: theme.textTheme.bodySmall,
), ),
// image picker field
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
@ -194,7 +192,6 @@ class _TimelinePostCreationScreenState
children: [ children: [
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
// open a dialog to choose between camera and gallery
var result = await showModalBottomSheet<Uint8List?>( var result = await showModalBottomSheet<Uint8List?>(
context: context, context: context,
builder: (context) => Container( builder: (context) => Container(

View file

@ -20,6 +20,7 @@ class TimelinePostOverviewScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var theme = Theme.of(context);
// the timelinePost.category is a key so we need to get the category object // the timelinePost.category is a key so we need to get the category object
var timelineCategoryName = options.categoriesOptions.categoriesBuilder var timelineCategoryName = options.categoriesOptions.categoriesBuilder
?.call(context) ?.call(context)
@ -55,7 +56,7 @@ class TimelinePostOverviewScreen extends StatelessWidget {
buttonText, buttonText,
enabled: true, enabled: true,
) ?? ) ??
ElevatedButton( FilledButton(
style: ButtonStyle( style: ButtonStyle(
backgroundColor: backgroundColor:
WidgetStatePropertyAll(Theme.of(context).primaryColor), WidgetStatePropertyAll(Theme.of(context).primaryColor),
@ -64,14 +65,10 @@ class TimelinePostOverviewScreen extends StatelessWidget {
onPostSubmit(timelinePost); onPostSubmit(timelinePost);
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(8),
child: Text( child: Text(
buttonText, buttonText,
style: const TextStyle( style: theme.textTheme.displayLarge,
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.w800,
),
), ),
), ),
), ),

View file

@ -364,13 +364,17 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Text( if (widget.isOverviewScreen != null
'${post.likes} ${widget.options.translations.likesTitle}', ? !widget.isOverviewScreen!
style: widget : false) ...[
.options.theme.textStyles.postLikeTitleAndAmount ?? Text(
theme.textTheme.titleSmall '${post.likes} ${widget.options.translations.likesTitle}',
?.copyWith(color: Colors.black), style: widget.options.theme.textStyles
), .postLikeTitleAndAmount ??
theme.textTheme.titleSmall
?.copyWith(color: Colors.black),
),
],
Text.rich( Text.rich(
TextSpan( TextSpan(
text: widget.options.nameBuilder?.call(post.creator) ?? text: widget.options.nameBuilder?.call(post.creator) ??
@ -385,42 +389,15 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
text: post.title, text: post.title,
style: style:
widget.options.theme.textStyles.postTitleStyle ?? widget.options.theme.textStyles.postTitleStyle ??
theme.textTheme.titleSmall!.copyWith( theme.textTheme.bodySmall,
color: Colors.black,
fontWeight: FontWeight.w500,
),
), ),
], ],
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Html( Text(
data: post.content, post.content,
style: { style: theme.textTheme.bodySmall,
'body': Style(
padding: HtmlPaddings.zero,
margin: Margins.zero,
fontFamily: theme.textTheme.titleSmall?.fontFamily,
),
'#': Style(
maxLines: 3,
textOverflow: TextOverflow.ellipsis,
padding: HtmlPaddings.zero,
margin: Margins.zero,
),
'H1': Style(
padding: HtmlPaddings.zero,
margin: Margins.zero,
),
'H2': Style(
padding: HtmlPaddings.zero,
margin: Margins.zero,
),
'H3': Style(
padding: HtmlPaddings.zero,
margin: Margins.zero,
),
},
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
@ -428,7 +405,10 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
style: theme.textTheme.labelSmall, style: theme.textTheme.labelSmall,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
if (post.reactionEnabled) ...[ // ignore: avoid_bool_literals_in_conditional_expressions
if (post.reactionEnabled || widget.isOverviewScreen != null
? !widget.isOverviewScreen!
: false) ...[
Text( Text(
widget.options.translations.commentsTitleOnPost, widget.options.translations.commentsTitleOnPost,
style: theme.textTheme.titleSmall! style: theme.textTheme.titleSmall!

View file

@ -33,7 +33,7 @@ class _CategorySelectorState extends State<CategorySelector> {
return SingleChildScrollView( return SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row( child: Row(
children: [ children: [
SizedBox( SizedBox(