Browse Source

砍价;

zyh
w-R 3 years ago
parent
commit
19bf43902c
  1. 2
      lib/main.dart
  2. 12
      lib/order/bargain_group_order.dart
  3. 2
      lib/order/order_history_page.dart
  4. 2
      lib/store/shopping/shopping_goods_details.dart
  5. 332
      lib/store/shopping/shopping_home/bargain_details.dart
  6. 2
      pubspec.lock

2
lib/main.dart

@ -359,7 +359,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/group_details': (context, {arguments}) => '/router/group_details': (context, {arguments}) =>
GroupDetails(arguments:arguments), GroupDetails(arguments:arguments),
'/router/bargain_details': (context, {arguments}) => '/router/bargain_details': (context, {arguments}) =>
BargainDetails(), BargainDetails(arguments:arguments),
'/router/group_page_details': (context, {arguments}) => '/router/group_page_details': (context, {arguments}) =>
GroupPageDetails(arguments:arguments), GroupPageDetails(arguments:arguments),
'/router/photo_view_gallery_screen': (context, {arguments}) => '/router/photo_view_gallery_screen': (context, {arguments}) =>

12
lib/order/bargain_group_order.dart

@ -131,7 +131,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
List<ActivityOrderList> activityOrderList = []; List<ActivityOrderList> activityOrderList = [];
RefreshController _refreshController = RefreshController _refreshController =
RefreshController(initialRefresh: false); RefreshController(initialRefresh: false);
int type = 0;
@override @override
void initState() { void initState() {
@ -302,7 +301,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
// orderInfo.sendStatus, // orderInfo.sendStatus,
// orderInfo.isTakeOut) // orderInfo.isTakeOut)
// : "", // : "",
(type == 1)?(activityOrderList.howManyMore != 0 ? "还差${activityOrderList?.howManyMore ?? 0}人拼团成功" : "拼团成功") (widget.type == 1)?(activityOrderList.howManyMore != 0 ? "还差${activityOrderList?.howManyMore ?? 0}人拼团成功" : "拼团成功")
:(activityOrderList.howManyMoney != 0 ? "还差¥${activityOrderList?.howManyMoney ?? 0}砍价成功" : "成功"), :(activityOrderList.howManyMoney != 0 ? "还差¥${activityOrderList?.howManyMoney ?? 0}砍价成功" : "成功"),
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -443,12 +442,19 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if(widget.type == 1) {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/group_details', arguments: { .pushNamed('/router/group_details', arguments: {
"actRecordId": activityOrderList.actRecordId, "actRecordId": activityOrderList.actRecordId,
"actProduct":activityOrderList,
"limitNumber":activityOrderList.successNumber, "limitNumber":activityOrderList.successNumber,
}); });
}else{
Navigator.of(context)
.popAndPushNamed('/router/bargain_details',arguments: {
"actRecordId": activityOrderList.actRecordId,
"limitNumber":activityOrderList.successNumber,
});
}
}, },
child: RoundButton( child: RoundButton(
height: 25.h, height: 25.h,

2
lib/order/order_history_page.dart

@ -156,7 +156,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
); );
}) })
: NoDataView( : NoDataView(
src: "assets/image/icon_empty.png", src: "assets/image/ding_dan.png",
isShowBtn: false, isShowBtn: false,
text: "目前暂无订单,快去下一单吧~", text: "目前暂无订单,快去下一单吧~",
fontSize: 16.sp, fontSize: 16.sp,

2
lib/store/shopping/shopping_goods_details.dart

@ -898,7 +898,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
.popAndPushNamed('/router/bargain_details',arguments: { .popAndPushNamed('/router/bargain_details',arguments: {
// "actRecordId": activityDetails.actRecordAndJoinlDTOList[0] // "actRecordId": activityDetails.actRecordAndJoinlDTOList[0]
// .actRecordJoinList[index].actRecordId, // .actRecordJoinList[index].actRecordId,
"actProduct":activityDetails.actProduct, // "actProduct":activityDetails.actProduct,
}); });
}, },
child: Container( child: Container(

332
lib/store/shopping/shopping_home/bargain_details.dart

@ -1,6 +1,12 @@
import 'dart:async';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/retrofit/data/activity_actRecord_details.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
@ -8,8 +14,13 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class BargainDetails extends StatefulWidget { class BargainDetails extends StatefulWidget {
final Map<String, dynamic> arguments;
BargainDetails({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _BargainDetails(); return _BargainDetails();
@ -17,22 +28,92 @@ class BargainDetails extends StatefulWidget {
} }
class _BargainDetails extends State<BargainDetails> { class _BargainDetails extends State<BargainDetails> {
ApiService apiService; MinApiService minService;
String actRecordId;
@override ActivityActRecordDetails activityActRecordDetails;
void initState() { bool isDispose = false;
super.initState(); Timer _timer;
} String testTime = "2021-12-30 10:00:00";
int tempDay = 0;
int tempHour = 0;
int tempM = 0;
int tempS = 0;
final SwiperController controller = SwiperController(); final SwiperController controller = SwiperController();
final RefreshController refreshController = RefreshController();
int limitNumber = 0;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
if (refreshController != null) refreshController.dispose(); if (refreshController != null) refreshController.dispose();
isDispose = true;
if (_timer != null) {
_timer.cancel();
}
} }
final RefreshController refreshController = RefreshController(); @override
void initState() {
super.initState();
actRecordId = widget.arguments["actRecordId"];
limitNumber = widget.arguments["limitNumber"];
startCountdownTimer();
SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken");
String tenant = value.getString("tenant");
String storeId = value.getString("storeId");
minService = MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
);
queryShowOneAct(actRecordId);
});
}
////
startCountdownTimer() {
if (_timer != null) return;
const oneSec = const Duration(seconds: 1);
var callback = ((timer) {
if (isDispose) return;
setState(() {
var tempDateTime =
DateTime.parse(activityActRecordDetails?.actRecord?.endTime)
.difference(DateTime.now());
if (tempDateTime.inSeconds < 0) {
tempDay = 0;
tempHour = 0;
tempM = 0;
tempS = 0;
return;
}
tempDay = tempDateTime.inDays;
tempHour = tempDateTime.inHours - (tempDateTime.inDays * 24);
tempM = tempDateTime.inMinutes - (tempDateTime.inHours * 60);
tempS = tempDateTime.inSeconds - (tempDateTime.inMinutes * 60);
});
});
_timer = Timer.periodic(oneSec, callback);
}
///
queryShowOneAct(actRecordId) async {
BaseData<ActivityActRecordDetails> baseData =
await minService.showOneAct(actRecordId).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
setState(() {
activityActRecordDetails = baseData.data;
});
refreshController.refreshCompleted();
} else {
refreshController.loadFailed();
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -122,23 +203,14 @@ class _BargainDetails extends State<BargainDetails> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
ClipRRect( MImage(
borderRadius: BorderRadius.circular(2), activityActRecordDetails?.actProduct?.productImg ?? "",
child: Image.asset(
"assets/image/icon_story_td.png",
width: 85, width: 85,
height: 85, height: 85,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
), ),
),
// MImage(
// "",
// width: double.infinity,
// height: 166,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
@ -150,7 +222,7 @@ class _BargainDetails extends State<BargainDetails> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"[生态小农]山林放养鸡蛋30枚/盒备份 2", activityActRecordDetails?.actProduct?.productName ?? "",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -160,7 +232,9 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
Text( Text(
"套盒装", (activityActRecordDetails?.skuName != "")
? (activityActRecordDetails?.skuName ?? "")
: "x1",
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -179,7 +253,9 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
TextSpan( TextSpan(
text: "284.00", text: activityActRecordDetails
?.actProduct?.productPrice ??
"",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -218,14 +294,15 @@ class _BargainDetails extends State<BargainDetails> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container(margin: EdgeInsets.only(left: 10),child: Container(
Stack( margin: EdgeInsets.only(left: 10),
child: Stack(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
children: [ children: [
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
width:67, width: 67,
height:23.h, height: 23.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
color: Color(0xFF9476F7), color: Color(0xFF9476F7),
@ -241,23 +318,25 @@ class _BargainDetails extends State<BargainDetails> {
), ),
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: child: Container(
Container(height:8,child: Icon( height: 8,
child: Icon(
Icons.arrow_drop_down, Icons.arrow_drop_down,
color: Color(0xFF9476F7), color: Color(0xFF9476F7),
size: 18, size: 18,
),), ),
),
), ),
], ],
),), ),
SizedBox(height:10), ),
SizedBox(height: 10),
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(6.5), borderRadius: BorderRadius.circular(6.5),
child: child: Stack(
Stack(
children: [ children: [
Container( Container(
width:double.infinity, width: double.infinity,
height: 8.h, height: 8.h,
color: Color(0xFFF5F5F5), color: Color(0xFFF5F5F5),
), ),
@ -272,24 +351,28 @@ class _BargainDetails extends State<BargainDetails> {
) )
], ],
)), )),
SizedBox(height: 3,), SizedBox(
height: 3,
),
Row( Row(
children: [ children: [
Expanded(child:Text( Expanded(
child: Text(
"原价¥284.00", "原价¥284.00",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF8D8D8D), color: Color(0xFF8D8D8D),
), ),
),), ),
),
Text.rich( Text.rich(
TextSpan( TextSpan(
children: [ children: [
TextSpan( TextSpan(
text: "最低价¥", text: "最低价¥",
style: TextStyle( style: TextStyle(
fontSize:9.sp, fontSize: 9.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF9476F7), color: Color(0xFF9476F7),
), ),
@ -302,20 +385,21 @@ class _BargainDetails extends State<BargainDetails> {
color: Color(0xFF9476F7), color: Color(0xFF9476F7),
), ),
), ),
], ],
), ),
), ),
], ],
), ),
SizedBox(height:16), SizedBox(height: 16),
Row(children: [ Row(
Expanded(child: GestureDetector( children: [
child:Container( Expanded(
child: GestureDetector(
child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width:double.infinity, width: double.infinity,
height:54.h, height: 54.h,
margin: EdgeInsets.only(left:6.w), margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27), borderRadius: BorderRadius.circular(27),
border: Border.all( border: Border.all(
@ -362,12 +446,13 @@ class _BargainDetails extends State<BargainDetails> {
// ), // ),
// ) // )
// ),), // ),),
Expanded(child:GestureDetector( Expanded(
child: GestureDetector(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width:double.infinity, width: double.infinity,
height:54.h, height: 54.h,
margin: EdgeInsets.only(left:6.w), margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFE5E5E5), color: Color(0xFFE5E5E5),
borderRadius: BorderRadius.circular(27), borderRadius: BorderRadius.circular(27),
@ -388,9 +473,19 @@ class _BargainDetails extends State<BargainDetails> {
color: Color(0xFF858585), color: Color(0xFF858585),
), ),
), ),
) )),
),), ),
],), ],
),
SizedBox(height: 11.h),
Text(
"剩余时间 ${((tempDay == 0) ? "" : (tempDay.toString() + ":")).toString()} ${tempHour.toString()} : ${tempM.toString()} : ${tempS.toString()}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
),
// Container( // Container(
// alignment: Alignment.center, // alignment: Alignment.center,
// width:double.infinity, // width:double.infinity,
@ -481,7 +576,7 @@ class _BargainDetails extends State<BargainDetails> {
Text( Text(
"砍价规则", "砍价规则",
style: TextStyle( style: TextStyle(
fontSize:15.sp, fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: Colors.black, color: Colors.black,
), ),
@ -518,7 +613,7 @@ class _BargainDetails extends State<BargainDetails> {
"1.选择自己喜欢的商品,邀请好友砍价,每次砍价金额以页面显示为主,邀请的越多,砍价成功的几率越高。", "1.选择自己喜欢的商品,邀请好友砍价,每次砍价金额以页面显示为主,邀请的越多,砍价成功的几率越高。",
style: TextStyle( style: TextStyle(
color: Color(0xFF4C4C4C), color: Color(0xFF4C4C4C),
fontSize:12.sp, fontSize: 12.sp,
height: 1.5, height: 1.5,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
), ),
@ -527,7 +622,7 @@ class _BargainDetails extends State<BargainDetails> {
"2.砍价成功后,点击立即购买,将以最终价格进行结算。", "2.砍价成功后,点击立即购买,将以最终价格进行结算。",
style: TextStyle( style: TextStyle(
color: Color(0xFF4C4C4C), color: Color(0xFF4C4C4C),
fontSize:12.sp, fontSize: 12.sp,
height: 1.5, height: 1.5,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
), ),
@ -536,7 +631,7 @@ class _BargainDetails extends State<BargainDetails> {
"3.砍价商品不享受平台活动,优惠券以及会员折扣。", "3.砍价商品不享受平台活动,优惠券以及会员折扣。",
style: TextStyle( style: TextStyle(
color: Color(0xFF4C4C4C), color: Color(0xFF4C4C4C),
fontSize:12.sp, fontSize: 12.sp,
height: 1.5, height: 1.5,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
), ),
@ -598,7 +693,7 @@ class _BargainDetails extends State<BargainDetails> {
Text( Text(
"好友砍价榜", "好友砍价榜",
style: TextStyle( style: TextStyle(
fontSize:15.sp, fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: Colors.black, color: Colors.black,
), ),
@ -629,7 +724,7 @@ class _BargainDetails extends State<BargainDetails> {
], ],
), ),
SizedBox( SizedBox(
height:20, height: 20,
), ),
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -639,30 +734,17 @@ class _BargainDetails extends State<BargainDetails> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemCount: 3, itemCount: activityActRecordDetails?.actRecordJoinList != null
? activityActRecordDetails.actRecordJoinList.length
: 0,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {},
child: bargainFriendsItem(), child: bargainFriendsItem(activityActRecordDetails, position),
); );
}, },
), ),
// (coupons != null && coupons.length > 0) // NoDataView(
// ? ListView.builder(
// padding: EdgeInsets.symmetric(vertical: 8.h),
// itemBuilder: (context, position) {
// return GestureDetector(
// onTap: () {
// Navigator.of(context).pushNamed(
// '/router/vip_details_page',
// arguments: {"id": coupons[position].id});
// },
// child: vipCardItem(coupons[position]),
// );
// },
// itemCount: coupons != null ? coupons.length : 0,
// )
// : NoDataView(
// isShowBtn: false, // isShowBtn: false,
// text: "暂无好友帮忙砍价~", // text: "暂无好友帮忙砍价~",
// fontSize: 16.sp, // fontSize: 16.sp,
@ -670,45 +752,46 @@ class _BargainDetails extends State<BargainDetails> {
// ), // ),
), ),
SizedBox( SizedBox(
height:20, height: 20,
), ),
], ],
), ),
); );
} }
Widget bargainFriendsItem() { Widget bargainFriendsItem(
ActivityActRecordDetails activityActRecordDetails, index) {
return Container( return Container(
height: 36.h, height: 36.h,
margin: EdgeInsets.only(bottom:10), margin: EdgeInsets.only(bottom: 10),
child:Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
// MImage( MImage(
// "", activityActRecordDetails.actRecordJoinList[index]?.memberAvatar ??
// width:34, "",
// height:34,
// fit: BoxFit.cover,
// isCircle: true,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
Image.asset(
"assets/image/icon_story_td.png",
width: 34, width: 34,
height: 34, height: 34,
fit: BoxFit.cover, fit: BoxFit.cover,
isCircle: true,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
), ),
SizedBox(width: 4,), SizedBox(
Expanded(child:Column( width: 4,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
"张三", activityActRecordDetails
.actRecordJoinList[index]?.memberNickname ??
"",
style: TextStyle( style: TextStyle(
fontSize:12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
@ -716,7 +799,7 @@ class _BargainDetails extends State<BargainDetails> {
Text( Text(
"3分钟前", "3分钟前",
style: TextStyle( style: TextStyle(
fontSize:10.sp, fontSize: 10.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFFACACAC), color: Color(0xFFACACAC),
), ),
@ -735,9 +818,19 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
TextSpan( TextSpan(
text: "23.00元", text: activityActRecordDetails
.actRecordJoinList[index]?.actPrice ??
"0",
style: TextStyle( style: TextStyle(
fontSize:11.sp, fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF9476F7),
),
),
TextSpan(
text: "",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF9476F7), color: Color(0xFF9476F7),
), ),
@ -746,8 +839,39 @@ class _BargainDetails extends State<BargainDetails> {
), ),
), ),
], ],
) ));
);
} }
// static handleDate(String oldTime) {
// String nowTime =
// new DateTime.now().toString().split('.')[0].replaceAll('-', '/');
//
// int nowyear = int.parse(nowTime.split(" ")[0].split('/')[0]);
// int nowmonth = int.parse(nowTime.split(" ")[0].split('/')[1]);
// int nowday = int.parse(nowTime.split(" ")[0].split('/')[2]);
// int nowhour = int.parse(nowTime.split(" ")[1].split(':')[0]);
// int nowmin = int.parse(nowTime.split(" ")[1].split(':')[1]);
//
// int oldyear = int.parse(oldTime.split(" ")[0].split('/')[0]);
// int oldmonth = int.parse(oldTime.split(" ")[0].split('/')[1]);
// int oldday = int.parse(oldTime.split(" ")[0].split('/')[2]);
// int oldhour = int.parse(oldTime.split(" ")[1].split(':')[0]);
// int oldmin = int.parse(oldTime.split(" ")[1].split(':')[1]);
//
// var now = new DateTime(nowyear, nowmonth, nowday, nowhour, nowmin);
// var old = new DateTime(oldyear, oldmonth, oldday, oldhour, oldmin);
// var difference = now.difference(old);
//
// if (difference.inDays > 1) {
// return (difference.inDays).toString() + '天前';
// } else if (difference.inDays == 1) {
// return '昨天'.toString();
// } else if (difference.inHours >= 1 && difference.inHours < 24) {
// return (difference.inHours).toString() + '小时前';
// } else if (difference.inMinutes > 5 && difference.inMinutes < 60) {
// return (difference.inMinutes).toString() + '分钟前';
// } else if (difference.inMinutes <= 5) {
// return '刚刚';
// }
// }
} }

2
pubspec.lock

@ -255,7 +255,7 @@ packages:
name: flutter_screenutil name: flutter_screenutil
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.3.0" version: "5.3.1"
flutter_smart_dialog: flutter_smart_dialog:
dependency: "direct main" dependency: "direct main"
description: description:

Loading…
Cancel
Save