feat: remove the more options button from posts

This commit is contained in:
sBubshait 2025-08-03 10:20:35 +03:00
parent 45228099bd
commit a3f67cf962
2 changed files with 170 additions and 170 deletions

View File

@ -34,7 +34,7 @@ class _CreatePostScreenState extends State<CreatePostScreen> {
try { try {
final result = await PostService.createPost(_bodyController.text.trim()); final result = await PostService.createPost(_bodyController.text.trim());
if (result['success']) { if (result['success']) {
Navigator.of(context).pop(true); // Return true to indicate success Navigator.of(context).pop(true); // Return true to indicate success
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
@ -73,182 +73,190 @@ class _CreatePostScreenState extends State<CreatePostScreen> {
return PopScope( return PopScope(
canPop: true, // Allow back navigation to go back to feed page only canPop: true, // Allow back navigation to go back to feed page only
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Create Post', style: TextStyle(fontWeight: FontWeight.w600)), title: Text(
backgroundColor: Colors.white, 'Create Post',
foregroundColor: Color(0xFF6A4C93), style: TextStyle(fontWeight: FontWeight.w600),
elevation: 0,
bottom: PreferredSize(
preferredSize: Size.fromHeight(1),
child: Container(height: 1, color: Colors.grey[200]),
),
actions: [
TextButton(
onPressed: _isLoading || isOverLimit || _bodyController.text.trim().isEmpty
? null
: _createPost,
child: _isLoading
? SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFF6A4C93)),
),
)
: Text(
'Post',
style: TextStyle(
color: _bodyController.text.trim().isEmpty || isOverLimit
? Colors.grey
: Color(0xFF6A4C93),
fontWeight: FontWeight.w600,
fontSize: 16,
),
),
), ),
SizedBox(width: 16), backgroundColor: Colors.white,
], foregroundColor: Color(0xFF6A4C93),
), elevation: 0,
body: Container( bottom: PreferredSize(
decoration: BoxDecoration( preferredSize: Size.fromHeight(1),
gradient: LinearGradient( child: Container(height: 1, color: Colors.grey[200]),
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF32B0A5).withOpacity(0.05),
Color(0xFF4600B9).withOpacity(0.05),
],
), ),
), actions: [
child: Padding( TextButton(
padding: EdgeInsets.all(16), onPressed:
child: Column( _isLoading ||
crossAxisAlignment: CrossAxisAlignment.start, isOverLimit ||
children: [ _bodyController.text.trim().isEmpty
Container( ? null
decoration: BoxDecoration( : _createPost,
color: Colors.white, child: _isLoading
borderRadius: BorderRadius.circular(12), ? SizedBox(
boxShadow: [ width: 20,
BoxShadow( height: 20,
color: Colors.black.withOpacity(0.05), child: CircularProgressIndicator(
blurRadius: 10, strokeWidth: 2,
offset: Offset(0, 2), valueColor: AlwaysStoppedAnimation<Color>(
Color(0xFF6A4C93),
),
),
)
: Text(
'Post',
style: TextStyle(
color:
_bodyController.text.trim().isEmpty || isOverLimit
? Colors.grey
: Color(0xFF6A4C93),
fontWeight: FontWeight.w600,
fontSize: 16,
),
), ),
], ),
), SizedBox(width: 16),
child: Padding( ],
padding: EdgeInsets.all(16), ),
child: Column( body: Container(
crossAxisAlignment: CrossAxisAlignment.start, decoration: BoxDecoration(
children: [ gradient: LinearGradient(
Text( begin: Alignment.topLeft,
"What's on your mind?", end: Alignment.bottomRight,
style: TextStyle( colors: [
fontSize: 18, Color(0xFF32B0A5).withOpacity(0.05),
fontWeight: FontWeight.w600, Color(0xFF4600B9).withOpacity(0.05),
color: Color(0xFF6A4C93), ],
), ),
),
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: Offset(0, 2),
), ),
SizedBox(height: 16),
TextField(
controller: _bodyController,
maxLines: 6,
decoration: InputDecoration(
hintText: 'Share your thoughts...',
hintStyle: TextStyle(color: Colors.grey[500]),
border: InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
),
style: TextStyle(
fontSize: 16,
height: 1.4,
color: Colors.black87,
),
onChanged: (text) {
setState(() {});
},
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Share your thoughts with the community',
style: TextStyle(
color: Colors.grey[600],
fontSize: 12,
),
),
Text(
'$remainingChars',
style: TextStyle(
color: isOverLimit ? Colors.red : Colors.grey[600],
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
],
),
if (isOverLimit)
Padding(
padding: EdgeInsets.only(top: 8),
child: Text(
'Post is too long. Please keep it under $_maxCharacters characters.',
style: TextStyle(
color: Colors.red,
fontSize: 12,
),
),
),
], ],
), ),
), child: Padding(
), padding: EdgeInsets.all(16),
SizedBox(height: 24), child: Column(
Container( crossAxisAlignment: CrossAxisAlignment.start,
decoration: BoxDecoration( children: [
color: Colors.white, Text(
borderRadius: BorderRadius.circular(12), "What's on your mind?",
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: Offset(0, 2),
),
],
),
child: Padding(
padding: EdgeInsets.all(16),
child: Row(
children: [
Icon(
Icons.lightbulb_outline,
color: Color(0xFF6A4C93),
size: 20,
),
SizedBox(width: 12),
Expanded(
child: Text(
'Keep it friendly and respectful. Your post will be visible to everyone in the community.',
style: TextStyle( style: TextStyle(
color: Colors.grey[700], fontSize: 18,
fontSize: 13, fontWeight: FontWeight.w600,
height: 1.3, color: Color(0xFF6A4C93),
), ),
), ),
SizedBox(height: 16),
TextField(
controller: _bodyController,
maxLines: 6,
decoration: InputDecoration(
hintText: 'Share your thoughts...',
hintStyle: TextStyle(color: Colors.grey[500]),
border: InputBorder.none,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
),
style: TextStyle(
fontSize: 16,
height: 1.4,
color: Colors.black87,
),
onChanged: (text) {
setState(() {});
},
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Share your thoughts with the community',
style: TextStyle(
color: Colors.grey[600],
fontSize: 12,
),
),
Text(
'$remainingChars',
style: TextStyle(
color: isOverLimit
? Colors.red
: Colors.grey[600],
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
],
),
if (isOverLimit)
Padding(
padding: EdgeInsets.only(top: 8),
child: Text(
'Post is too long. Please keep it under $_maxCharacters characters.',
style: TextStyle(color: Colors.red, fontSize: 12),
),
),
],
),
),
),
SizedBox(height: 24),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: Offset(0, 2),
), ),
], ],
), ),
child: Padding(
padding: EdgeInsets.all(16),
child: Row(
children: [
Icon(
Icons.lightbulb_outline,
color: Color(0xFF6A4C93),
size: 20,
),
SizedBox(width: 12),
Expanded(
child: Text(
'Keep it friendly and respectful. Your post will be visible to everyone in the community.',
style: TextStyle(
color: Colors.grey[700],
fontSize: 13,
height: 1.3,
),
),
),
],
),
),
), ),
), ],
], ),
), ),
), ),
),
), ),
); );
} }
} }

View File

@ -411,14 +411,6 @@ class _PostCardState extends State<PostCard> {
], ],
), ),
), ),
IconButton(
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('More options pressed')),
);
},
icon: Icon(Icons.more_horiz, color: Colors.grey[600]),
),
], ],
), ),
SizedBox(height: 12), SizedBox(height: 12),