feat:增加朋友圈评论显示模块
This commit is contained in:
@@ -33,6 +33,10 @@ class MomentCard extends StatelessWidget {
|
||||
_buildTime(),
|
||||
const SizedBox(height: 5),
|
||||
_buildActionButtons(),
|
||||
if (moment.commentList!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
_buildCommentList(),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -189,4 +193,55 @@ class MomentCard extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCommentItem(Comment comment) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: comment.username,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
fontFamily: 'CustomFont',
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: ': ', style: TextStyle(color: Colors.black)),
|
||||
TextSpan(
|
||||
text: comment.content,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'CustomFont',
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCommentList() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[100],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: moment.commentList!.length,
|
||||
separatorBuilder: (context, index) => SizedBox(height: 8),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildCommentItem(moment.commentList![index]);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,19 +27,18 @@ class _RecipeListState extends State<RecipeList> {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
return Container(
|
||||
width: 150,
|
||||
width: 140,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: colors.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.grey[200]!),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: DropdownButton<String>(
|
||||
value: provider.queryCategory,
|
||||
hint: Text('请选择菜谱类别', style: TextStyle(color: Colors.grey[500])),
|
||||
isExpanded: true,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
dropdownColor: Colors.white,
|
||||
dropdownColor: colors.surfaceContainer,
|
||||
elevation: 6,
|
||||
underline: Container(),
|
||||
items:
|
||||
|
||||
Reference in New Issue
Block a user