Browse Source

Merge remote-tracking branch 'origin/remove_uniapp' into remove_uniapp

ff_new
fmk 3 years ago
parent
commit
e7d6fc3c8a
  1. 17
      lib/community/community_page.dart
  2. 143
      lib/community/community_view/community_dynamic.dart
  3. 8
      lib/community/headlines/activity_top_list.dart
  4. 185
      lib/mine/mine_page.dart
  5. 32
      lib/store/store_order.dart
  6. 5
      lib/view_widget/custom_image.dart

17
lib/community/community_page.dart

@ -82,12 +82,17 @@ class _CommunityPage extends State<CommunityPage>
onTap: () { onTap: () {
_toRelease(); _toRelease();
}, },
action: SvgPicture.asset( action: GestureDetector(
"assets/svg/shequ_fabu.svg", behavior: HitTestBehavior.opaque,
fit: BoxFit.contain, child: Container(color: Colors.transparent,
width: 24, padding: EdgeInsets.only(left: 20,right: 20),
height: 24, child: SvgPicture.asset(
), "assets/svg/shequ_fabu.svg",
fit: BoxFit.contain,
width: 24,
height: 24,
),)
)
), ),
body: Container( body: Container(
padding: EdgeInsets.only(bottom: 76.h), padding: EdgeInsets.only(bottom: 76.h),

143
lib/community/community_view/community_dynamic.dart

@ -19,7 +19,6 @@ import 'package:video_player/video_player.dart';
import '../photo_view_gallery_screen.dart'; import '../photo_view_gallery_screen.dart';
class CommunityDynamic extends StatefulWidget { class CommunityDynamic extends StatefulWidget {
final int itemCount; final int itemCount;
final Function(double height) heightFun; final Function(double height) heightFun;
@ -77,11 +76,9 @@ class _CommunityDynamic extends State<CommunityDynamic> {
String filePath; String filePath;
initVideo() async { initVideo() async {
if(widget?.article?.content == null) if (widget?.article?.content == null) return;
return;
var cnt = jsonDecode(widget.article.content); var cnt = jsonDecode(widget.article.content);
if (cnt["type"] == "video" && if (cnt["type"] == "video" && cnt["video"] != null) {
cnt["video"] != null) {
if (widget.isList) { if (widget.isList) {
videoPlayerController = VideoPlayerController.network( videoPlayerController = VideoPlayerController.network(
cnt["video"], cnt["video"],
@ -116,11 +113,12 @@ class _CommunityDynamic extends State<CommunityDynamic> {
} }
//// ////
_vipFollow(followId,isFollow) async { _vipFollow(followId, isFollow) async {
BaseData baseData = await apiService.follow(followId); BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
widget.exitFull(); widget.exitFull();
SmartDialog.showToast(isFollow?"关注成功":"取关成功", alignment: Alignment.center); SmartDialog.showToast(isFollow ? "关注成功" : "取关成功",
alignment: Alignment.center);
setState(() {}); setState(() {});
} else { } else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center); // SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -173,26 +171,29 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: Row( child: Row(
children: [ children: [
GestureDetector( GestureDetector(
onTap: (){ onTap: () {
if(widget?.article?.authorHeadImg == ""){ Navigator.push(
SmartDialog.showToast("用户暂未设置头像", alignment: Alignment.center); context,
return; MaterialPageRoute(
} builder: (context) => PhotoViewGalleryScreen(
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( images: [(widget?.article?.authorHeadImg ?? "").isEmpty?
images:[widget?.article?.authorHeadImg ?? ""],//list "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":widget?.article?.authorHeadImg
index: 0,//index ], //list
), )); index: 0, //index
}, ),
child: MImage( ));
widget?.article?.authorHeadImg ?? "", },
width: 44, child:
height: 44, MImage(
isCircle: true, (widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg") + "?imageView2/1/w/200/h/200/format/jpg/q/75",
fit: BoxFit.cover, width: 44,
errorSrc: "assets/image/default_1.png", height: 44,
fadeSrc: "assets/image/default_1.png", isCircle: true,
), fit: BoxFit.cover,
), errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
SizedBox( SizedBox(
width: 8, width: 8,
), ),
@ -228,7 +229,8 @@ class _CommunityDynamic extends State<CommunityDynamic> {
if (widget.commentType == 0) { if (widget.commentType == 0) {
widget.article.liked = widget.article.liked =
!(widget.article.liked ?? false); !(widget.article.liked ?? false);
_vipFollow(widget.article.updateUser,widget.article.liked ?? false); _vipFollow(widget.article.updateUser,
widget.article.liked ?? false);
} else { } else {
showDeleteDialog(); showDeleteDialog();
} }
@ -261,11 +263,14 @@ class _CommunityDynamic extends State<CommunityDynamic> {
size: 15, size: 15,
), ),
)) ))
: Padding(padding: EdgeInsets.all(20),child:Icon( : Padding(
Icons.close, padding: EdgeInsets.all(20),
color: Colors.black, child: Icon(
size: 16, Icons.close,
),), color: Colors.black,
size: 16,
),
),
), ),
], ],
), ),
@ -344,34 +349,41 @@ class _CommunityDynamic extends State<CommunityDynamic> {
} }
var cnt = jsonDecode(subjectInfo); var cnt = jsonDecode(subjectInfo);
Widget itemWidget = Container(); Widget itemWidget = Container();
if (cnt["type"] == "image"&& cnt["images"] != null && cnt["images"].length > 0) { if (cnt["type"] == "image" &&
cnt["images"] != null &&
cnt["images"].length > 0) {
if (cnt["images"].length == 1) { if (cnt["images"].length == 1) {
itemWidget = Container( itemWidget = Container(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
// ImagePickers.previewImages(subjectInfo.images,0); // ImagePickers.previewImages(subjectInfo.images,0);
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( Navigator.push(
images:cnt["images"],//list context,
index: 0,//index MaterialPageRoute(
), ), ); builder: (context) => PhotoViewGalleryScreen(
}, images: cnt["images"], //list
child: MImage( index: 0, //index
cnt["images"][0], ),
fit: BoxFit.cover, ),
radius: BorderRadius.circular(2), );
width: MediaQuery.of(context).size.width / 1.5, },
height: MediaQuery.of(context).size.width / 1.5, child: MImage(
errorSrc: "assets/image/default_2_1.png", cnt["images"][0].replaceAll(".jpg", ".jpg?imageView2/0/q/75"),
fadeSrc: "assets/image/default_2_1.png", fit: BoxFit.contain,
)), radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width/1.5,
height:MediaQuery.of(context).size.width,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
)),
); );
} else { } else {
itemWidget = GridView.builder( itemWidget = GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: (cnt["images"].length == 2 || crossAxisCount:
cnt["images"].length == 4) (cnt["images"].length == 2 || cnt["images"].length == 4)
? 2 ? 2
: 3, : 3,
crossAxisSpacing: 12.w, crossAxisSpacing: 12.w,
mainAxisSpacing: 12.w, mainAxisSpacing: 12.w,
childAspectRatio: 1, childAspectRatio: 1,
@ -384,13 +396,19 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
// ImagePickers.previewImages(subjectInfo.images, position); // ImagePickers.previewImages(subjectInfo.images, position);
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( Navigator.push(
images:cnt["images"],//list context,
index: position,//index MaterialPageRoute(
), ), ); builder: (context) => PhotoViewGalleryScreen(
images: cnt["images"], //list
index: position, //index
),
),
);
}, },
child: MImage( child: MImage(
cnt["images"][position], cnt["images"][position]
.replaceAll(".jpg", ".jpg?imageView2/0/q/75"),
fit: BoxFit.cover, fit: BoxFit.cover,
aspectRatio: 1, aspectRatio: 1,
radius: BorderRadius.circular(1), radius: BorderRadius.circular(1),
@ -403,15 +421,16 @@ class _CommunityDynamic extends State<CommunityDynamic> {
itemCount: cnt["images"].length, itemCount: cnt["images"].length,
); );
} }
} } else if (cnt["type"] == "video" &&
else if (cnt["type"] == "video" && cnt["video"]!= null && cnt["video"].isNotEmpty) { cnt["video"] != null &&
cnt["video"].isNotEmpty) {
itemWidget = videoWidget( itemWidget = videoWidget(
MediaQuery.of(context).size.width - 32, MediaQuery.of(context).size.width - 32,
videoPlayerController != null videoPlayerController != null
? (MediaQuery.of(context).size.width - 32) / ? (MediaQuery.of(context).size.width - 32) /
videoPlayerController.value.aspectRatio videoPlayerController.value.aspectRatio
: MediaQuery.of(context).size.width / 2, : MediaQuery.of(context).size.width / 2,
!widget.isList ? cnt["video"] : widget.article.coverImg, cnt["video"].replaceAll(".mp4", "_poster.jpg"),
); );
} }
return Column( return Column(

8
lib/community/headlines/activity_top_list.dart

@ -47,9 +47,11 @@ class _ActivityTopList extends State<ActivityTopList> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed('/router/web_page',
'/router/headlines_column_details', arguments: {"articleId": widget.articleTop[position].id});
arguments: {"id": widget.articleTop[position].id}); widget.articleTop[position].viewers =
(widget.articleTop[position].viewers + 1);
setState(() {});
}, },
child: headlinesCollectionItem(widget.articleTop[position], position), child: headlinesCollectionItem(widget.articleTop[position], position),
); );

185
lib/mine/mine_page.dart

@ -53,12 +53,9 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
if (_refreshController != null) if (_refreshController != null) _refreshController.dispose();
_refreshController.dispose();
} }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -118,7 +115,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
_onRefresh(){ _onRefresh() {
queryUserInfo(); queryUserInfo();
querySocialInfo(); querySocialInfo();
} }
@ -134,7 +131,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
); );
BaseData<SocialInfo> baseData = BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) { await apiService.socialInfo().catchError((onError) {
_refreshController.refreshFailed(); _refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -203,9 +200,12 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
tag: "vip", tag: "vip",
ranks: ranks, ranks: ranks,
userInfo: userInfo, userInfo: userInfo,
rank: double.tryParse(userInfo?.expendAmount??"0").toInt(), rank: double.tryParse(
rankMax: userInfo?.memberRankVo?.nextOrigin??0, userInfo?.expendAmount ?? "0")
createTime: userInfo?.createTime??"", .toInt(),
rankMax:
userInfo?.memberRankVo?.nextOrigin ?? 0,
createTime: userInfo?.createTime ?? "",
), ),
], ],
), ),
@ -309,10 +309,10 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
} }
///// /////
Widget attention(){ Widget attention() {
return Container( return Container(
margin: EdgeInsets.only(left: 16,top: 10,right: 16), margin: EdgeInsets.only(left: 16, top: 10, right: 16),
padding: EdgeInsets.only(top: 16,bottom: 16), // padding: EdgeInsets.only(top: 16,bottom: 16),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -325,36 +325,35 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
), ),
], ],
), ),
child:GestureDetector( child: Row(
onTap:(){ mainAxisAlignment: MainAxisAlignment.spaceAround,
Navigator.of(context).pushNamed( crossAxisAlignment: CrossAxisAlignment.start,
'/router/communityFollow', children: [
arguments: {}, Expanded(
); child: GestureDetector(
}, behavior: HitTestBehavior.opaque,
child: Row( onTap: () {
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap:(){
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/communityFollow', '/router/communityFollow',
arguments: {}, arguments: {},
); );
}, },
child: child: Container(
Column( color: Colors.transparent,
padding: EdgeInsets.all(16),
child: Column(
children: [ children: [
Text( Text(
infoNumber != null ?infoNumber.follow.toString() :"0", infoNumber != null ? infoNumber.follow.toString() : "0",
style: TextStyle( style: TextStyle(
color: Color(0xFF000000), color: Color(0xFF000000),
fontSize: 15.sp, fontSize: 15.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
), ),
), ),
SizedBox(height:4,), SizedBox(
height: 4,
),
Text( Text(
S.of(context).guanzhu, S.of(context).guanzhu,
style: TextStyle( style: TextStyle(
@ -364,70 +363,86 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
), ),
), ),
], ],
), )),
), ),
GestureDetector( ),
onTap:(){ Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/communityFollow', '/router/communityFollow',
arguments: {}, arguments: {},
); );
}, },
child: child: Container(
Column( color: Colors.transparent,
children: [ padding: EdgeInsets.all(16),
Text( child: Column(
infoNumber != null ?infoNumber.fans.toString() :"0", children: [
style: TextStyle( Text(
color: Color(0xFF000000), infoNumber != null ? infoNumber.fans.toString() : "0",
fontSize: 15.sp, style: TextStyle(
fontWeight: MyFontWeight.medium, color: Color(0xFF000000),
), fontSize: 15.sp,
), fontWeight: MyFontWeight.medium,
SizedBox(height:4,), ),
Text( ),
S.of(context).fensi, SizedBox(
style: TextStyle( height: 4,
color: Color(0xFF000000), ),
fontSize: 14.sp, Text(
fontWeight: MyFontWeight.regular, S.of(context).fensi,
), style: TextStyle(
), color: Color(0xFF000000),
], fontSize: 14.sp,
), fontWeight: MyFontWeight.regular,
),
),
],
)),
), ),
GestureDetector( ),
onTap:(){ Expanded(
Navigator.of(context).pushNamed( child: GestureDetector(
'/router/mine_attainment_page', behavior: HitTestBehavior.opaque,
arguments: {"userInfo":userInfo}, onTap: () {
); Navigator.of(context).pushNamed(
}, '/router/mine_attainment_page',
child: arguments: {"userInfo": userInfo},
Column( );
children: [ },
Text( child: Container(
infoNumber != null ?infoNumber.achievementNumber.toString() :"0", color: Colors.transparent,
style: TextStyle( padding: EdgeInsets.all(16),
color: Color(0xFF000000), child: Column(
fontSize: 15.sp, children: [
fontWeight: MyFontWeight.medium, Text(
), infoNumber != null
), ? infoNumber.achievementNumber.toString()
SizedBox(height:4,), : "0",
Text( style: TextStyle(
"成就", color: Color(0xFF000000),
style: TextStyle( fontSize: 15.sp,
color: Color(0xFF000000), fontWeight: MyFontWeight.medium,
fontSize: 14.sp, ),
fontWeight: MyFontWeight.regular, ),
), SizedBox(
height: 4,
),
Text(
"成就",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
), ),
], )),
), )
), ],
],
),
), ),
); );
} }

32
lib/store/store_order.dart

@ -202,17 +202,19 @@ class _StoreOrderPage extends State<StoreOrderPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return
onWillPop: () async { // WillPopScope(
if (dialogShowing) { // onWillPop: () async {
debugPrint("ssssasdadsasdadasd"); // if (dialogShowing) {
SmartDialog.dismiss(); // debugPrint("ssssasdadsasdadasd");
return false; // SmartDialog.dismiss();
} else { // return false;
return true; // } else {
} // return true;
}, // }
child: Container( // },
// child:
Container(
color: Colors.white, color: Colors.white,
child: Stack( child: Stack(
children: [ children: [
@ -241,10 +243,14 @@ class _StoreOrderPage extends State<StoreOrderPage>
stretch: false, stretch: false,
brightness: Brightness.light, brightness: Brightness.light,
leading: GestureDetector( leading: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Container( child: Container(
width: double.infinity,
height: double.infinity,
color: Colors.transparent,
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10), margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
@ -484,8 +490,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
), ),
], ],
), ),
), );
); // );
} }
/// ///

5
lib/view_widget/custom_image.dart

@ -34,12 +34,15 @@ class MImage extends StatelessWidget {
Widget image = LayoutBuilder( Widget image = LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
String imageUrl = ""; String imageUrl = "";
///
if (src != null && src != "" && src.startsWith("http")) { if (src != null && src != "" && src.startsWith("http")) {
String oper = src.contains("?") ? "" :"?";
imageUrl = imageUrl =
"$src?imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}"
"x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100";
} }
// print(imageUrl);
// print("constrainWidth: ${constraints.constrainWidth()}"); // print("constrainWidth: ${constraints.constrainWidth()}");
// print("constrainHeight: ${constraints.constrainHeight()}"); // print("constrainHeight: ${constraints.constrainHeight()}");

Loading…
Cancel
Save