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

View file

@ -351,19 +351,27 @@ class _TimelinePostCreationScreenState
) ?? ) ??
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 48), padding: const EdgeInsets.symmetric(horizontal: 48),
child: DefaultFilledButton( child: Row(
onPressed: titleIsValid && contentIsValid children: [
? () async { Expanded(
if (formkey.currentState!.validate()) { child: DefaultFilledButton(
await onPostCreated(); onPressed: titleIsValid && contentIsValid
await widget.service.postService ? () async {
.fetchPosts(null); if (formkey.currentState!
} .validate()) {
} await onPostCreated();
: null, await widget.service.postService
buttonText: widget.enablePostOverviewScreen .fetchPosts(null);
? widget.options.translations.checkPost }
: widget.options.translations.postCreation, }
: 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/material.dart';
import 'package:flutter_timeline_interface/flutter_timeline_interface.dart'; import 'package:flutter_timeline_interface/flutter_timeline_interface.dart';
import 'package:flutter_timeline_view/flutter_timeline_view.dart'; import 'package:flutter_timeline_view/flutter_timeline_view.dart';
@ -21,11 +18,6 @@ class TimelinePostOverviewScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { 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; var isSubmitted = false;
return Column( return Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -45,27 +37,33 @@ class TimelinePostOverviewScreen extends StatelessWidget {
() { () {
onPostSubmit(timelinePost); onPostSubmit(timelinePost);
}, },
buttonText, options.translations.postIn,
) ?? ) ??
options.buttonBuilder?.call( options.buttonBuilder?.call(
context, context,
() { () {
onPostSubmit(timelinePost); onPostSubmit(timelinePost);
}, },
buttonText, options.translations.postIn,
enabled: true, enabled: true,
) ?? ) ??
SafeArea( SafeArea(
bottom: true, bottom: true,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 80), padding: const EdgeInsets.symmetric(horizontal: 80),
child: DefaultFilledButton( child: Row(
onPressed: () async { children: [
if (isSubmitted) return; Expanded(
isSubmitted = true; child: DefaultFilledButton(
onPostSubmit(timelinePost); onPressed: () async {
}, if (isSubmitted) return;
buttonText: buttonText, isSubmitted = true;
onPostSubmit(timelinePost);
},
buttonText: options.translations.postIn,
),
),
],
), ),
), ),
), ),