2022-07-03 13:47:24 +00:00
import ' package:flutter/material.dart ' ;
class Post extends StatefulWidget {
const Post ( { Key ? key } ) : super ( key: key ) ;
@ override
State < Post > createState ( ) = > _PostState ( ) ;
}
class _PostState extends State < Post > {
@ override
Widget build ( BuildContext context ) {
return Column (
children: [
2022-07-03 14:56:41 +00:00
const DisplayName ( ) ,
postBody ( context ) ,
postActionBar ( context ) ,
] ,
) ;
}
}
class DisplayName extends StatelessWidget {
const DisplayName ( {
Key ? key ,
} ) : super ( key: key ) ;
@ override
Widget build ( BuildContext context ) {
return Row (
children: [
const Icon (
Icons . face ,
size: 64 ,
) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
2022-07-03 13:47:24 +00:00
children: [
2022-07-03 14:56:41 +00:00
Text (
" first name display last name name " ,
style: Theme . of ( context ) . textTheme . titleMedium ,
2022-07-03 13:47:24 +00:00
) ,
2022-07-03 14:56:41 +00:00
Text (
" @alice_exampleuser@example.com " ,
style: Theme . of ( context ) . textTheme . bodySmall ,
2022-07-03 13:47:24 +00:00
) ,
] ,
) ,
] ,
) ;
}
}
Widget postBody ( context ) {
return Container (
padding: const EdgeInsets . fromLTRB ( 24 , 6 , 6 , 6 ) ,
decoration: BoxDecoration (
border: Border (
left: BorderSide ( color: Theme . of ( context ) . colorScheme . onSurface ) ,
2022-07-03 14:56:41 +00:00
bottom: BorderSide ( color: Theme . of ( context ) . colorScheme . onSurface ) ,
top: BorderSide ( color: Theme . of ( context ) . colorScheme . onSurface ) ,
2022-07-03 13:47:24 +00:00
) ,
) ,
child: RichText (
textAlign: TextAlign . start ,
text: const TextSpan (
text:
" Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Risus commodo viverra maecenas accumsan lacus vel facilisis volutpat est. Diam in arcu cursus euismod quis viverra. Elementum sagittis vitae et leo duis. " ) ,
) ,
) ;
}
Widget postActionBar ( context ) {
return Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
IconButton (
onPressed: ( ) { } ,
icon: const Icon ( Icons . reply ) ,
) ,
IconButton (
onPressed: ( ) { } ,
icon: const Icon ( Icons . repeat ) ,
) ,
IconButton (
onPressed: ( ) { } ,
icon: const Icon ( Icons . favorite_outline ) ,
) ,
IconButton (
onPressed: ( ) { } ,
icon: const Icon ( Icons . more_horiz ) ,
)
] ,
) ;
}