1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-24 11:58:51 +00:00

Create post container

This commit is contained in:
Pierre HUBERT 2020-05-16 09:10:09 +02:00
parent 7f1130aca8
commit fbe22c5031
2 changed files with 44 additions and 17 deletions

View File

@ -16,6 +16,7 @@ import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/countdown_widget.dart';
import 'package:comunic/ui/widgets/like_widget.dart';
import 'package:comunic/ui/widgets/network_image_widget.dart';
import 'package:comunic/ui/widgets/post_container_widget.dart';
import 'package:comunic/ui/widgets/survey_widget.dart';
import 'package:comunic/ui/widgets/text_widget.dart';
import 'package:comunic/utils/date_utils.dart';
@ -229,24 +230,26 @@ class _PostTileState extends State<PostTile> {
@override
Widget build(BuildContext context) {
return Card(
elevation: 1.0,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
_buildHeaderRow(),
_buildContentRow(),
_buildButtonsArea(),
],
return PostContainer(
child: Card(
elevation: 1.0,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
_buildHeaderRow(),
_buildContentRow(),
_buildButtonsArea(),
],
),
),
),
Container(
child: widget.post.hasComments ? _buildComments() : null,
),
],
Container(
child: widget.post.hasComments ? _buildComments() : null,
),
],
),
),
);
}

View File

@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
/// Here is a widget used to contain a post
///
/// @author Pierre Hubert
class PostContainer extends StatelessWidget {
final Widget child;
const PostContainer({Key key, @required this.child})
: assert(child != null),
super(key: key);
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.center,
child: ConstrainedBox(
constraints: BoxConstraints.loose(Size.fromWidth(500)),
child: child,
),
);
}
}