mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-18 18:13:46 +02:00
fix: post_overview_screen
This commit is contained in:
parent
32fe08a7af
commit
971a030b5c
5 changed files with 27 additions and 52 deletions
|
@ -3,9 +3,10 @@ import 'package:flutter/material.dart';
|
|||
/// This class contains the paddings used in the timeline options
|
||||
class 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 =
|
||||
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.categoryButtonTextPadding,
|
||||
});
|
||||
|
|
|
@ -177,7 +177,6 @@ class _TimelinePostCreationScreenState
|
|||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
// input field for the content
|
||||
Text(
|
||||
widget.options.translations.uploadImage,
|
||||
style: theme.textTheme.titleMedium,
|
||||
|
@ -186,7 +185,6 @@ class _TimelinePostCreationScreenState
|
|||
widget.options.translations.uploadImageDescription,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
// image picker field
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
|
@ -194,7 +192,6 @@ class _TimelinePostCreationScreenState
|
|||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
// open a dialog to choose between camera and gallery
|
||||
var result = await showModalBottomSheet<Uint8List?>(
|
||||
context: context,
|
||||
builder: (context) => Container(
|
||||
|
|
|
@ -20,6 +20,7 @@ class TimelinePostOverviewScreen extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var theme = Theme.of(context);
|
||||
// the timelinePost.category is a key so we need to get the category object
|
||||
var timelineCategoryName = options.categoriesOptions.categoriesBuilder
|
||||
?.call(context)
|
||||
|
@ -55,7 +56,7 @@ class TimelinePostOverviewScreen extends StatelessWidget {
|
|||
buttonText,
|
||||
enabled: true,
|
||||
) ??
|
||||
ElevatedButton(
|
||||
FilledButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor:
|
||||
WidgetStatePropertyAll(Theme.of(context).primaryColor),
|
||||
|
@ -64,14 +65,10 @@ class TimelinePostOverviewScreen extends StatelessWidget {
|
|||
onPostSubmit(timelinePost);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
buttonText,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
style: theme.textTheme.displayLarge,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -364,13 +364,17 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
|||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${post.likes} ${widget.options.translations.likesTitle}',
|
||||
style: widget
|
||||
.options.theme.textStyles.postLikeTitleAndAmount ??
|
||||
theme.textTheme.titleSmall
|
||||
?.copyWith(color: Colors.black),
|
||||
),
|
||||
if (widget.isOverviewScreen != null
|
||||
? !widget.isOverviewScreen!
|
||||
: false) ...[
|
||||
Text(
|
||||
'${post.likes} ${widget.options.translations.likesTitle}',
|
||||
style: widget.options.theme.textStyles
|
||||
.postLikeTitleAndAmount ??
|
||||
theme.textTheme.titleSmall
|
||||
?.copyWith(color: Colors.black),
|
||||
),
|
||||
],
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: widget.options.nameBuilder?.call(post.creator) ??
|
||||
|
@ -385,42 +389,15 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
|||
text: post.title,
|
||||
style:
|
||||
widget.options.theme.textStyles.postTitleStyle ??
|
||||
theme.textTheme.titleSmall!.copyWith(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
theme.textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Html(
|
||||
data: post.content,
|
||||
style: {
|
||||
'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,
|
||||
),
|
||||
},
|
||||
Text(
|
||||
post.content,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
|
@ -428,7 +405,10 @@ class _TimelinePostScreenState extends State<TimelinePostScreen> {
|
|||
style: theme.textTheme.labelSmall,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (post.reactionEnabled) ...[
|
||||
// ignore: avoid_bool_literals_in_conditional_expressions
|
||||
if (post.reactionEnabled || widget.isOverviewScreen != null
|
||||
? !widget.isOverviewScreen!
|
||||
: false) ...[
|
||||
Text(
|
||||
widget.options.translations.commentsTitleOnPost,
|
||||
style: theme.textTheme.titleSmall!
|
||||
|
|
|
@ -33,7 +33,7 @@ class _CategorySelectorState extends State<CategorySelector> {
|
|||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
|
|
Loading…
Reference in a new issue