diff --git a/lib/ui/widgets/post_create_form_widget.dart b/lib/ui/widgets/post_create_form_widget.dart index 08b0a5e..951f61c 100644 --- a/lib/ui/widgets/post_create_form_widget.dart +++ b/lib/ui/widgets/post_create_form_widget.dart @@ -74,12 +74,15 @@ class _PostCreateFormWidgetState extends State { return Column( children: [ // Post text content - TextField( - controller: _postTextController, - minLines: 3, - maxLines: 10, - decoration: InputDecoration(hintText: tr("Create a new post...")), - onChanged: (s) => setState(() {}), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: TextField( + controller: _postTextController, + minLines: 3, + maxLines: 10, + decoration: InputDecoration(hintText: tr("Create a new post...")), + onChanged: (s) => setState(() {}), + ), ), // Post options @@ -88,13 +91,23 @@ class _PostCreateFormWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + // Text post button + _PostOptionWidget( + icon: Icons.text_format, + selected: postKind == PostKind.TEXT, + onTap: _resetPostSelection), + // Include image button _PostOptionWidget( icon: Icons.image, - selected: hasImage, + selected: postKind == PostKind.IMAGE, onTap: _pickImageForPost, ), + Expanded( + child: Container(), + ), + // Post visibility level _PostOptionWidget( icon: PostVisibilityLevelsMapIcons[_postVisibilityLevel], @@ -132,12 +145,21 @@ class _PostCreateFormWidgetState extends State { setState(() => _postVisibilityLevel = newLevel); } + /// Remove all data attached to the post (image, etc...) + void _resetPostSelection() { + setState(() { + _postImage = null; + }); + } + /// Pick an image for the new post Future _pickImageForPost() async { final image = await pickImage(context); if (image == null) return; + _resetPostSelection(); + setState(() { this._postImage = image; });