Browse Source

safety

master
fmk 3 years ago
parent
commit
5b511a63d6
  1. 11
      lib/community/community_child_page.dart
  2. 98
      lib/community/community_view/community_dynamic.dart

11
lib/community/community_child_page.dart

@ -108,15 +108,18 @@ class _CommunityChildPage extends State<CommunityChildPage> {
0, 0,
userId: userId, userId: userId,
isList: true, isList: true,
exitFull: (){setState(() { exitFull: () {
_onRefresh(); setState(() {
});}, _onRefresh();
});
},
), ),
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/community_details', '/router/community_details',
arguments: { arguments: {
"comment": comments[position],"userId":userId, "comment": comments[position],
"userId": userId,
}, },
); );
}, },

98
lib/community/community_view/community_dynamic.dart

@ -1,6 +1,4 @@
import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:chewie/chewie.dart'; import 'package:chewie/chewie.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -16,7 +14,6 @@ import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_pickers/image_pickers.dart'; import 'package:image_pickers/image_pickers.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
@ -40,7 +37,7 @@ class CommunityDynamic extends StatefulWidget {
this.isDetails = false, this.isDetails = false,
this.removalDynamic, this.removalDynamic,
this.exitFull, this.exitFull,
this.userId, this.userId,
this.isList = false, this.isList = false,
}) : super(key: key); }) : super(key: key);
@ -59,7 +56,6 @@ class _CommunityDynamic extends State<CommunityDynamic> {
ChewieController chewieAudioController; ChewieController chewieAudioController;
Chewie chewies; Chewie chewies;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -119,6 +115,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
widget.exitFull(); widget.exitFull();
SmartDialog.showToast("关注成功", alignment: Alignment.center); SmartDialog.showToast("关注成功", alignment: Alignment.center);
setState(() {});
} else { } else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center); // SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -130,6 +127,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
widget.exitFull(); widget.exitFull();
SmartDialog.showToast("删除成功", alignment: Alignment.center); SmartDialog.showToast("删除成功", alignment: Alignment.center);
setState(() {});
} else { } else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center); // SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -169,14 +167,14 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: Row( child: Row(
children: [ children: [
MImage( MImage(
widget?.comment?.memberInfo?.avatar ?? "", widget?.comment?.memberInfo?.avatar ?? "",
width: 44, width: 44,
height: 44, height: 44,
isCircle: true, isCircle: true,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",
), ),
SizedBox( SizedBox(
width: 8, width: 8,
), ),
@ -205,14 +203,14 @@ class _CommunityDynamic extends State<CommunityDynamic> {
], ],
), ),
), ),
if(widget?.comment?.memberInfo?.mid != widget.userId??"") if (widget?.comment?.memberInfo?.mid != widget.userId ?? "")
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
if (widget.commentType == 0) { if (widget.commentType == 0) {
widget.comment.selfFollow = widget.comment.selfFollow =
!(widget.comment.selfFollow ?? false); !(widget.comment.selfFollow ?? false);
_vipFollow(widget.comment.memberInfo.mid); _vipFollow(widget.comment.memberInfo?.mid);
} else { } else {
showDeleteDialog(); showDeleteDialog();
} }
@ -220,39 +218,39 @@ class _CommunityDynamic extends State<CommunityDynamic> {
}, },
child: (widget.commentType == 0) child: (widget.commentType == 0)
? Container( ? Container(
width: 56.w, width: 56.w,
height: 21.h, height: 21.h,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(11.w), borderRadius: BorderRadius.circular(11.w),
color: Color(0xFF32A060), color: Color(0xFF32A060),
), ),
child: RoundButton( child: RoundButton(
backgroup: (widget.comment.selfFollow ?? false) backgroup: (widget.comment.selfFollow ?? false)
? Color(0xFFE6E6E6) ? Color(0xFFE6E6E6)
: Color(0xFF32A060), : Color(0xFF32A060),
textColor: (widget.comment.selfFollow ?? false) textColor: (widget.comment.selfFollow ?? false)
? Color(0xFF808080) ? Color(0xFF808080)
: Colors.white, : Colors.white,
text: (widget.comment.selfFollow ?? false) text: (widget.comment.selfFollow ?? false)
? "已关注" ? "已关注"
: "关注", : "关注",
radius: 20, radius: 20,
icons: Icon( icons: Icon(
(widget.comment.selfFollow ?? false) (widget.comment.selfFollow ?? false)
? Icons.check ? Icons.check
: Icons.add, : Icons.add,
color: (widget.comment.selfFollow ?? false) color: (widget.comment.selfFollow ?? false)
? Color(0xFF808080) ? Color(0xFF808080)
: Colors.white, : Colors.white,
size: 15, size: 15,
), ),
)) ))
: Icon( : Icon(
Icons.close, Icons.close,
color: Colors.black, color: Colors.black,
size: 16, size: 16,
), ),
), ),
], ],
), ),
@ -294,9 +292,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
iconSize: 16, iconSize: 16,
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: () {},
},
child: IconText( child: IconText(
"${widget.comment.likes ?? 0}", "${widget.comment.likes ?? 0}",
space: 4.w, space: 4.w,

Loading…
Cancel
Save