Browse Source

1.优化热榜加载

2.优化公共跳转添加data参数
3.优化图片分享
tags/0.0.7
“yanghuaxuan” 3 years ago
parent
commit
18a64ab081
13 changed files with 80 additions and 57 deletions
  1. +11
    -24
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java
  2. +7
    -10
      example/lib/main.dart
  3. +11
    -8
      lib/pages/goods_share_page/goods_share_image/goods_share_image.dart
  4. +1
    -1
      lib/pages/hot_ranking_page/hot_ranking_page_sk.dart
  5. +1
    -1
      lib/pages/mine_detail_page/mine_detail_page.dart
  6. +4
    -1
      lib/register.dart
  7. +3
    -1
      lib/widgets/custom/multi_nav/custom_quick_entry.dart
  8. +3
    -0
      lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart
  9. +1
    -1
      lib/widgets/home/home_goods/models/home_goods_list_style_model.dart
  10. +7
    -0
      lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart
  11. +8
    -8
      lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list_sk.dart
  12. +23
    -1
      lib/widgets/share/share_alert_select.dart
  13. +0
    -1
      pubspec.yaml

+ 11
- 24
example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java View File

@@ -85,39 +85,26 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN
view.addView(launchImageFrame, params);
}

Timer timer=new Timer();
Timer timer = new Timer();

///移除启动页
void removeLaunchView() {
//此处延时是为了不显示启动页往上顶
if(timer!=null){
timer.schedule(new TimerTask() {
@Override
public void run() {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (view != null && launchImageFrame != null) {
getWindow().getDecorView().setBackground(new ColorDrawable(Color.parseColor("#000000")));

if (view != null && launchImageFrame != null) {
getWindow().getDecorView().setBackground(new ColorDrawable(Color.parseColor("#000000")));
// Animation alphaAnimation = new AlphaAnimation(1, 1);
// alphaAnimation.setDuration(100);
// alphaAnimation.setFillAfter(true);
// launchImageFrame.startAnimation(alphaAnimation);
Log.d("----------------", "----------------------清除启动页---------------");
view.removeView(launchImageFrame);
launchImageFrame = null;
view = null;
}
}
});
timer=null;
}
},100);

Log.d("----------------", "----------------------清除启动页---------------");
view.removeView(launchImageFrame);
launchImageFrame = null;
view = null;
}

}


@Override
protected void onNewIntent(@NonNull Intent intent) {
super.onNewIntent(intent);
@@ -167,8 +154,8 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN
@Override
public Map getSetting() {
Map map = new HashMap();
map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989");
// map.put("domain", "http://api.zhios.cn/");45678910,
map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989");
// map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn68703914
map.put("master_id", "123456");
map.put("secret_key", "123456");
// map.put("token", "123465");


+ 7
- 10
example/lib/main.dart View File

@@ -119,18 +119,15 @@ class _MyAppState extends State<MyApp> {
print("change language ${locale.toString()}");
return locale;
},
home: GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
FocusManager.instance.primaryFocus.unfocus();
}
},
child: LaunchPage(
// builder: (context) => HomePage(),
),
home: LaunchPage(
// builder: (context) => HomePage(),
),
),
);
}
}

// FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
// FocusManager.instance.primaryFocus.unfocus();
// }

+ 11
- 8
lib/pages/goods_share_page/goods_share_image/goods_share_image.dart View File

@@ -27,6 +27,7 @@ import 'package:zhiying_base_widget/widgets/public/custom_button/custom_button_m
import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart';
import 'package:zhiying_base_widget/widgets/share/share_alert.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class GoodsShareImage extends StatefulWidget {
final Map<String, dynamic> model;
@@ -177,15 +178,15 @@ class _GoodsShareImageContentState extends State<_GoodsShareImageContent> with A
);

List<String> moreImageList = List();
try{
try {
moreImageList = List.from(widget?.params['image_url_list']).map((e) => e.toString()).toList();
}catch(e,s){
} catch (e, s) {
print(e);
print(s);
}

_style.customImage.addAll(moreImageList);
_style.customImage=_style.customImage.reversed.toList();
_style.customImage = _style.customImage.reversed.toList();
for (int index = 0; index < _style.customImage.length; index++) {
String image = _style.customImage[index];
// 分享图片
@@ -344,17 +345,16 @@ class _GoodsShareImageContentState extends State<_GoodsShareImageContent> with A
}

List<String> paths = await ImageDownloadUtil.download(images);
for(var item in paths){
for (var item in paths) {
Uint8List data = File(item).readAsBytesSync();
isSaveSuccess = await SaveImage.save(imageBytes: data);
}
if (isSaveSuccess) {
Fluttertoast.showToast(msg: '保存成功');
} else{
} else {
Fluttertoast.showToast(msg: '保存失败');
}


Loading.dismiss();
}

@@ -363,11 +363,14 @@ class _GoodsShareImageContentState extends State<_GoodsShareImageContent> with A
BuildContext buildContext = _globalKey.currentContext;
if (null != buildContext) {
RenderRepaintBoundary boundary = buildContext.findRenderObject();
ui.Image image = await boundary.toImage(pixelRatio: 1.5);
ui.Image image = await boundary.toImage(pixelRatio: 4);
// 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba
Loading.show(context);
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();
_shareModel.poster = pngBytes;
File file = await EncodeUtil.compressImage(context,images: pngBytes, size: 200);
Loading.dismiss();
_shareModel.poster = file.readAsBytesSync();
}
} else {
_shareModel.poster = null;


+ 1
- 1
lib/pages/hot_ranking_page/hot_ranking_page_sk.dart View File

@@ -35,7 +35,7 @@ class HotRankingPageSkeleton extends StatelessWidget {

_buildBottomListItem() {
List<Widget> listWidget = List();
for (var index = 0; index < 3; index++) {
for (var index = 0; index < 10; index++) {
listWidget.add(Container(
margin: EdgeInsets.only(left: 16, top: 10, bottom: 10),
child: Row(


+ 1
- 1
lib/pages/mine_detail_page/mine_detail_page.dart View File

@@ -316,7 +316,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> {
if (cropperFile == null) {
return;
}
File resultFile = await EncodeUtil.compressImage(cropperFile, 800);
File resultFile = await EncodeUtil.compressImage(context,file:cropperFile,size: 800);
Loading.show(context);
_bloc.uploadAvatar(resultFile);
}


+ 4
- 1
lib/register.dart View File

@@ -132,6 +132,10 @@ class BaseWidgetRegister {
Jdsdk.init(appKey: config.keys?.jdAndroid?.appkey ?? '', appSecret: config.keys?.jdAndroid?.secret ?? '');
}
SharesdkPlugin.regist(register);

///微信支付初始化
bool result = await SyFlutterWechat.register(config?.keys?.weixin?.appId);
print(result);
});

// MOB 秒验
@@ -200,7 +204,6 @@ class BaseWidgetRegister {
/// 反馈列表页
PageFactory.regist('pub.flutter.feedback_list', (model) => FeedbackRecordPage(model));


/// 提现页
PageFactory.regist('pub.flutter.cash_out', (model) => WithdrawPage(model));



+ 3
- 1
lib/widgets/custom/multi_nav/custom_quick_entry.dart View File

@@ -390,7 +390,9 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer>

return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _itemIconClick(item),
onTap: () {
_itemIconClick(item);
},
child: Container(
height: itemHeight,
width: 60,


+ 3
- 0
lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart View File

@@ -153,6 +153,7 @@ class ListStyle extends SkipModel{
String requiredTaobaoAuth;
String skipIdentifier;


ListStyle(
{this.img,
this.title,
@@ -173,6 +174,7 @@ class ListStyle extends SkipModel{
requiredLogin = json['required_login'];
requiredTaobaoAuth = json['required_taobao_auth'];
skipIdentifier = json['skip_identifier'];

}

Map<String, dynamic> toJson() {
@@ -185,6 +187,7 @@ class ListStyle extends SkipModel{
data['required_login'] = this.requiredLogin;
data['required_taobao_auth'] = this.requiredTaobaoAuth;
data['skip_identifier'] = this.skipIdentifier;

return data;
}
}


+ 1
- 1
lib/widgets/home/home_goods/models/home_goods_list_style_model.dart View File

@@ -33,7 +33,7 @@ class HomeGoodsListStyleModel {
});

HomeGoodsListStyleModel.fromJson(Map<String, dynamic> json) {
hotRankIconList = json['hot_rank_icon_list'].cast<String>();
hotRankIconList = json['hot_rank_icon_list']. cast<String>();
topMargin = json['top_margin'];
listColumn = json['list_column'];
leftRighMargin = json['left_righ_margin'];


+ 7
- 0
lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart View File

@@ -23,6 +23,8 @@ class HotRankingListBloc extends BlocBase {

bool isLoading = false;

bool isFirst=true;

@override
void dispose() {
_dataController.close();
@@ -35,6 +37,11 @@ class HotRankingListBloc extends BlocBase {
// return;
// }
// isLoading = true;
if(isFirst){
isFirst=false;
await Future.delayed(Duration(milliseconds: 300));
}

currentTypeId = typeId;
NetUtil.request('/api/v1/rec?pvd=taobao&category_id=' + typeId + '&page=' + page.toString(), method: NetMethod.GET, onCache: (data) {
complete();


+ 8
- 8
lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list_sk.dart View File

@@ -10,13 +10,13 @@ class HotRankingSkeleton extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
width: double.infinity,
margin: EdgeInsets.all(16),
height: 48,
child: Row(
children: _buildTopRow(),
)),
// Container(
// width: double.infinity,
// margin: EdgeInsets.all(16),
// height: 48,
// child: Row(
// children: _buildTopRow(),
// )),
Expanded(
child: Container(
child: Column(
@@ -30,7 +30,7 @@ class HotRankingSkeleton extends StatelessWidget {

_buildBottomListItem() {
List<Widget> listWidget = List();
for (var index = 0; index < 3; index++) {
for (var index = 0; index < 10; index++) {
listWidget.add(Container(
margin: EdgeInsets.only(left: 16,top: 10,bottom: 10),
child: Row(


+ 23
- 1
lib/widgets/share/share_alert_select.dart View File

@@ -106,10 +106,11 @@ class _ShareAlertSelectState extends State<ShareAlertSelect> {
if (null != buildContext) {
RenderRepaintBoundary boundary = buildContext.findRenderObject();
///pixelRatio是放大倍数
ui.Image image = await boundary.toImage(pixelRatio: 1);
ui.Image image = await boundary.toImage(pixelRatio: 5);
// 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();

_shareModel.poster = pngBytes;
} else {
_shareModel.poster = null;
@@ -370,6 +371,27 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
),
),
onTap: () async {

Loading.show(context);

await Future.delayed(Duration(seconds: 2));

if(_shareDataModel.image!=null){
for(var image in _shareDataModel.image){
File file = await EncodeUtil.compressImage(context,file: File(image), size: 200);
image=file.path;
}
Loading.dismiss();
}

if(_shareDataModel?.poster!=null){
File file = await EncodeUtil.compressImage(context,images: _shareDataModel?.poster, size: 200);
_shareDataModel.poster=file.readAsBytesSync();
Loading.dismiss();
}



//检查是否有存储权限
var status = await Permission.storage.status;
if (!status.isGranted) {


+ 0
- 1
pubspec.yaml View File

@@ -37,7 +37,6 @@ dependencies:
# 列表滑动删除
flutter_slidable: 0.5.7
# image_gallery_saver: ^1.6.0

permission_handler:
git:
ref: 0.0.1


Loading…
Cancel
Save