fix: button text

This commit is contained in:
mike doornenbal 2024-08-01 09:38:43 +02:00
parent 3bd7b0951f
commit 1dc79b8d74
3 changed files with 38 additions and 32 deletions

View file

@ -75,7 +75,7 @@ class TimelineTranslations {
this.allowCommentsDescription =
'Indicate whether people are allowed to respond',
this.commentsTitleOnPost = 'Comments',
this.checkPost = 'Check post overview',
this.checkPost = 'Overview',
this.deletePost = 'Delete post',
this.deleteConfirmationTitle = 'Delete Post',
this.deleteConfirmationMessage =
@ -93,7 +93,7 @@ class TimelineTranslations {
this.timelineSelectionDescription = 'Choose a category',
this.searchHint = 'Search...',
this.postOverview = 'Post Overview',
this.postIn = 'Post in',
this.postIn = 'Post',
this.postCreation = 'add post',
this.yes = 'Yes',
this.no = 'No',

View file

@ -351,19 +351,27 @@ class _TimelinePostCreationScreenState
) ??
Padding(
padding: const EdgeInsets.symmetric(horizontal: 48),
child: DefaultFilledButton(
onPressed: titleIsValid && contentIsValid
? () async {
if (formkey.currentState!.validate()) {
await onPostCreated();
await widget.service.postService
.fetchPosts(null);
}
}
: null,
buttonText: widget.enablePostOverviewScreen
? widget.options.translations.checkPost
: widget.options.translations.postCreation,
child: Row(
children: [
Expanded(
child: DefaultFilledButton(
onPressed: titleIsValid && contentIsValid
? () async {
if (formkey.currentState!
.validate()) {
await onPostCreated();
await widget.service.postService
.fetchPosts(null);
}
}
: null,
buttonText: widget.enablePostOverviewScreen
? widget.options.translations.checkPost
: widget
.options.translations.postCreation,
),
),
],
),
),
),

View file

@ -1,6 +1,3 @@
// ignore_for_file: prefer_expression_function_bodies
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_timeline_interface/flutter_timeline_interface.dart';
import 'package:flutter_timeline_view/flutter_timeline_view.dart';
@ -21,11 +18,6 @@ class TimelinePostOverviewScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
var timelineCategoryName = service.postService.categories
.firstWhereOrNull((element) => element.key == timelinePost.category)
?.title ??
timelinePost.category;
var buttonText = '${options.translations.postIn} $timelineCategoryName';
var isSubmitted = false;
return Column(
mainAxisSize: MainAxisSize.max,
@ -45,27 +37,33 @@ class TimelinePostOverviewScreen extends StatelessWidget {
() {
onPostSubmit(timelinePost);
},
buttonText,
options.translations.postIn,
) ??
options.buttonBuilder?.call(
context,
() {
onPostSubmit(timelinePost);
},
buttonText,
options.translations.postIn,
enabled: true,
) ??
SafeArea(
bottom: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 80),
child: DefaultFilledButton(
onPressed: () async {
if (isSubmitted) return;
isSubmitted = true;
onPostSubmit(timelinePost);
},
buttonText: buttonText,
child: Row(
children: [
Expanded(
child: DefaultFilledButton(
onPressed: () async {
if (isSubmitted) return;
isSubmitted = true;
onPostSubmit(timelinePost);
},
buttonText: options.translations.postIn,
),
),
],
),
),
),