Flutter代码开发规范

代码风格
标识符三种类型
大驼峰
类、枚举、typedef和类型参数

class SliderMenu { … }

class HttpRequest { … }

typedef Predicate = bool Function(T value);
包括用于元数据注释的类

class Foo {
const Foo([arg]);
}

@Foo(anArg)
class A { … }

@Foo()
class B { … }
使用小写加下划线来命名库和源文件
library peg_parser.source_scanner;

import ‘file_system.dart’;
import ‘slider_menu.dart’;

Read More

Flutter与小程序通讯全过程

正向传递:flutter 调用js js调用小程序代码

反向传递:小程序加载webview 通过url传参 和 路由

A.flutter dart调用js通讯
1.dart桥接文件

1
2
3
4
5
6
7
8
9
@JS()
library javascript_bundler;


import 'package:js/js.dart';

// @JS('confirm')
@JS('postMini’)//postMini是js的代码函数
external void showConfirm(String text);

Read More

学习Flutter的艰辛之谈

最近Flutter项目炒的很火,Flutter 是谷歌的移动 UI 框架,可以快速在 iOS 和 Android 上构建高质量的原生用户界面。 并且Flutter 可以与原生的代码一起工作,用起来简洁有方便。我们公司决定用它尝试一下,下面记录一下从零入手Flutter到项目成功上线踩过的一些坑

  1. 开发工具问题,本人使用的Android Studio,在开发调试过程中肯定会有很多莫名其妙的报错问题,有时候并不一定是代码上的问题,要相信自己不如重新启动下编译器,必要时重启电脑,重启手机,flutter clean,flutter doctor,pod install,invalidate caches,保留自己一个备用测试工程项目

    Read More

Flutter网络资源学习

经典知识点收藏

dart 中文文档
https://www.kancloud.cn/marswill/dark2_document/709091

flutter 中文网
https://flutterchina.club/tutorials/layout/

flutter 中文文档
https://book.flutterchina.club/chapter1/flutter_intro.html

flutter开发包库
https://pub.dev/packages/

flutter与原生混合开发:flutter集成进iOS工程
http://www.cocoachina.com/articles/464387

Flutter避免代码嵌套,写好build方法
https://segmentfault.com/a/1190000019757187

实例开源中国demo
https://github.com/yubo725/flutter-osc

Read More

2020苹果审核那些事

最近苹果审核越来越严,写此博客记录一下踩过的一些坑,下次就不会再遇到相同的问题了

  1. Guideline 4.2.3 - Design - Minimum Functionality

    We were required to install the WeChat app before we could log in via WeChat. Users should be able to log in with WeChat and access their accounts without having to install any additional apps.

    Next Steps

    If you would like to offer authentication through WeChat, please use a mechanism that allows users to log in with WeChat from within your app without first having to install an additional app.

    We recommend implementing the Safari View Controller API to display web content within your app. The Safari View Controller allows the display of a URL and inspection of the certificate from an embedded browser in an app so that customers can verify the webpage URL and SSL certificate to confirm they are entering their sign in credentials into a legitimate page.

    Resources

    For additional information on the Safari View Controller API, please review the What’s New in Safari webpage.

解决方案:

最好判断一下当前手机微信APP是否安装,安装显示微信登录入口,否则不显示入口

Read More