Browse Source
修改分享弹窗跳转; 修改下来刷新成功显示的颜色; 修改动态列表底部四个控件ui显示; 合并new分支代码; 兼容推送类型更改; 更改订单详情刷新颜色; 增加,app在后台高于5分钟后进入前台刷新应用;dart3_last
wurong
2 years ago
23 changed files with 595 additions and 345 deletions
@ -0,0 +1,229 @@
|
||||
import 'dart:convert'; |
||||
import 'dart:ui'; |
||||
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter/rendering.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import '../../generated/l10n.dart'; |
||||
import '../../utils/font_weight.dart'; |
||||
import '../retrofit/data/article.dart'; |
||||
import '../retrofit/data/base_data.dart'; |
||||
import '../view_widget/custom_image.dart'; |
||||
|
||||
class ShareTrends extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
ShareTrends({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _ShareTrends(); |
||||
} |
||||
} |
||||
|
||||
class _ShareTrends extends State<ShareTrends>{ |
||||
ApiService apiService; |
||||
bool topSetting = false; |
||||
final TextEditingController textController = TextEditingController(); |
||||
var commentFocus = FocusNode(); |
||||
Article article; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
queryDetails(widget.arguments["articleId"]); |
||||
} |
||||
|
||||
///详情接口 |
||||
queryDetails(id) async { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
if (apiService == null) |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
showLoading: true |
||||
); |
||||
BaseData<Article> baseData = |
||||
await apiService.informationInfo(id).catchError((onError) { |
||||
debugPrint(onError.toString()); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
article = baseData.data; |
||||
}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
backgroundColor: Color(0xFFF9FAF7), |
||||
// appBar: MyAppBar( |
||||
// title:"转发", |
||||
// titleColor: Colors.black, |
||||
// titleSize: 18.sp, |
||||
// background: Colors.white, |
||||
// leading: false, |
||||
// leadingColor: Colors.black, |
||||
// actions: [ |
||||
// Container( |
||||
// alignment: Alignment.center , |
||||
// color: Color(0xFF32A060), |
||||
// margin:EdgeInsets.only(right: 16.w) , |
||||
// child: Text( |
||||
// S.of(context).fabu, |
||||
// style: TextStyle( |
||||
// color: Colors.white, |
||||
// fontSize:12.sp, |
||||
// fontWeight: MyFontWeight.regular, |
||||
// ), |
||||
// ), |
||||
// ) |
||||
// ], |
||||
// ), |
||||
body: Container( |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
padding:EdgeInsets.only(top: MediaQuery.of(context).padding.top+11.h,bottom:14.w), |
||||
color: Colors.white, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(left:60.w,), |
||||
child: Text( |
||||
"转发", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize:17.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
),)), |
||||
Container( |
||||
alignment: Alignment.center , |
||||
margin:EdgeInsets.only(right: 16.w) , |
||||
padding: EdgeInsets.symmetric(horizontal: 16.w,vertical: 3.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(10.5), |
||||
), |
||||
child: Text( |
||||
S.of(context).fabu, |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize:12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Expanded(child: |
||||
Container( |
||||
margin: EdgeInsets.symmetric(vertical: 14.h), |
||||
width: double.infinity, |
||||
color: Colors.white, |
||||
padding: EdgeInsets.only(left: 20.w,right: 16.w), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
borderRadius: BorderRadius.circular(6), |
||||
), |
||||
margin: EdgeInsets.only(top: 30.w), |
||||
child: Container( |
||||
margin: EdgeInsets.only(left:16.w,right: 10.w,), |
||||
alignment: Alignment.topLeft, |
||||
child: TextField( |
||||
textInputAction:TextInputAction.send, |
||||
onEditingComplete: () { |
||||
}, |
||||
maxLines: 8, |
||||
minLines: 1, |
||||
focusNode:commentFocus, |
||||
controller: textController, |
||||
decoration: InputDecoration( |
||||
border: InputBorder.none, |
||||
hintText: "想说点什么...", |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF7C7C7C), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed( |
||||
'/router/scan_web', |
||||
arguments: { |
||||
"result": widget.arguments["shareUrl"], |
||||
"title":"", |
||||
}, |
||||
); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF2F2F2), |
||||
borderRadius: BorderRadius.circular(6), |
||||
), |
||||
padding: EdgeInsets.only(top: 8.h,bottom: 8.h,left: 8.w,right: 10.w), |
||||
margin: EdgeInsets.only(top: 12.w), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
if(article?.content != null && article.content.contains("images\":[\"") || (article?.coverImg ?? "")!= "") |
||||
MImage( |
||||
article?.content != null && |
||||
article.content.contains("images\":[\"") |
||||
? jsonDecode(article.content)["images"][0] |
||||
: article?.coverImg ?? "", |
||||
radius: BorderRadius.circular(2), |
||||
fit: BoxFit.fill, |
||||
width: 64, |
||||
height: 64, |
||||
errorSrc: "assets/image/default_2_1.webp", |
||||
fadeSrc: "assets/image/default_2_1.webp", |
||||
), |
||||
if(article?.content != null || article?.coverImg != null) |
||||
SizedBox(width: 7.w,), |
||||
Expanded(child: Text( |
||||
article?.mainTitle ?? "", |
||||
maxLines: 3, |
||||
overflow: TextOverflow.ellipsis, |
||||
style: TextStyle( |
||||
color: Color(0xFF4D4D4D), |
||||
fontSize:14.sp, |
||||
height: 1.4.h, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
),), |
||||
], |
||||
), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue