@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import ' package:flutter/material.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter_screenutil/flutter_screenutil.dart ' ;
import ' package:flutter_screenutil/flutter_screenutil.dart ' ;
import ' ../components/comment_component.dart ' ;
import ' ../components/post_component.dart ' ;
import ' ../components/post_component.dart ' ;
import ' ../components/top_nav_bar_component.dart ' ;
import ' ../components/top_nav_bar_component.dart ' ;
import ' ../values/constants.dart ' ;
import ' ../values/constants.dart ' ;
@ -18,19 +19,27 @@ class _FeedScreenState extends State<FeedScreen>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
late AnimationController animationController ;
late AnimationController animationController ;
late Animation < double > animation ;
late Animation < double > animation ;
List < PostComponent > friendFeed = [
late List < PostComponent > friendFeed ;
PostComponent ( ) ,
late List < PostComponent > discoveryFeed ;
PostComponent ( ) ,
PostComponent ( ) ,
] ;
List < PostComponent > discoveryFeed = [
PostComponent ( ) ,
] ;
late List < PostComponent > displayFeed ;
late List < PostComponent > displayFeed ;
@ override
@ override
void initState ( ) {
void initState ( ) {
super . initState ( ) ;
super . initState ( ) ;
friendFeed = [
PostComponent (
callback: openDetailPost ,
) ,
PostComponent (
callback: openDetailPost ,
) ,
PostComponent (
callback: openDetailPost ,
) ,
] ;
discoveryFeed = [
PostComponent ( callback: openDetailPost ) ,
] ;
displayFeed = friendFeed ;
displayFeed = friendFeed ;
animationController = AnimationController (
animationController = AnimationController (
vsync: this ,
vsync: this ,
@ -60,6 +69,59 @@ class _FeedScreenState extends State<FeedScreen>
}
}
}
}
void openDetailPost ( ) {
showModalBottomSheet (
backgroundColor: bgModal ,
elevation: 1 ,
constraints: const BoxConstraints (
maxWidth: 600 ,
) ,
isScrollControlled: true ,
context: context ,
shape: const RoundedRectangleBorder (
borderRadius: BorderRadius . only (
topLeft: Radius . circular ( 20 ) , topRight: Radius . circular ( 20 ) ) ) ,
builder: ( ( context ) {
return Container (
height: 720. h ,
margin: EdgeInsets . only (
top: defaultPadding ,
left: defaultPadding ,
right: defaultPadding ) ,
child: Column (
children: [
Align (
child: Container (
width: 60 ,
height: 5 ,
decoration: BoxDecoration (
color: Colors . white ,
borderRadius: BorderRadius . circular ( 20 ) ) ) ,
) ,
Expanded (
child: SingleChildScrollView (
child: Wrap (
/ / to apply margin in the main axis of the wrap
runSpacing: 10 ,
children: [
PostComponent (
callback: null ,
) ,
Container ( height: 40 ) ,
CommentComponent ( ) ,
CommentComponent ( ) ,
CommentComponent ( ) ,
Container ( height: 10 ) ,
] ,
) ,
) ,
) ,
] ,
) ) ;
} ) ,
) ;
}
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Scaffold (
return Scaffold (
@ -69,13 +131,13 @@ class _FeedScreenState extends State<FeedScreen>
CircularRevealAnimation (
CircularRevealAnimation (
animation: animation ,
animation: animation ,
/ / centerAlignment: Alignment . centerRight ,
/ / centerAlignment: Alignment . centerRight ,
centerOffset: Offset ( 70, 0) ,
centerOffset: Offset ( 30.w , - 10 0) ,
child: SingleChildScrollView (
child: SingleChildScrollView (
child: SizedBox (
child: SizedBox (
width: double . infinity ,
width: double . infinity ,
child: Align (
child: Align (
child: ConstrainedBox (
child: ConstrainedBox (
constraints: BoxConstraints ( maxWidth: 5 00) ,
constraints: BoxConstraints ( maxWidth: 6 00) ,
child: Padding (
child: Padding (
padding: const EdgeInsets . symmetric (
padding: const EdgeInsets . symmetric (
horizontal: defaultPadding ) ,
horizontal: defaultPadding ) ,
@ -84,8 +146,8 @@ class _FeedScreenState extends State<FeedScreen>
child: Padding (
child: Padding (
padding: EdgeInsets . only ( top: 100. h ) ,
padding: EdgeInsets . only ( top: 100. h ) ,
child: SingleChildScrollView (
child: SingleChildScrollView (
child: Column (
child: Wrap (
crossAxisAlignment: CrossAxisAlignment . start ,
runSpacing: 60 ,
children: displayFeed ,
children: displayFeed ,
) ,
) ,
) ) ,
) ) ,