1、permission_handler:權限處理
static const List<PermissionGroup> values = <PermissionGroup>[
calendar,
camera,
contacts,
location,
locationAlways,
locationWhenInUse,
mediaLibrary,
microphone,
phone,
photos,
reminders,
sensors,
sms,
speech,
storage,
ignoreBatteryOptimizations,
notification,
access_media_location,
unknown,
];
例:
Future requestPermission() async {
PermissionUtil.requestLocationPermission();
bool hasLocationPermission =
await PermissionUtil.requestLocationPermission();
if (hasLocationPermission) {
print("定位權限申請通過");
} else {
print("定位權限申請不通過");
}
}
2、webview
webview_flutter
WebView({
Key key,
this.onWebViewCreated, //WebView創建完成之后的回呼
this.initialUrl, // 初始化 URL
this.javascriptMode = JavascriptMode.disabled, //JS執行模式,默認是不呼叫
this.javascriptChannels, // JS可以呼叫Flutter 的通道
this.navigationDelegate, // 路由委托,可以使用它執行攔截操作
this.gestureRecognizers, // 手勢相關
this.onPageStarted, //開始加載頁面回呼
this.onPageFinished, // 頁面加載完成的回呼
this.onWebResourceError, //資源加載失敗回呼
this.debuggingEnabled = false,
this.gestureNavigationEnabled = false,
this.userAgent,
this.initialMediaPlaybackPolicy =
AutoMediaPlaybackPolicy.require_user_action_for_all_media_types,
})
3、dio:網路請求,這塊一般都需要自己專案中封裝
yhPost(url, {data, options, cancelToken}) async {
Response response;
try {
response = await _yhHttp.post(url,
data: data, options: options, cancelToken: cancelToken);
closeAllDialiog();
} on DioError catch (e) {
if (e.response != null) {
// toastUtil(e.response.statusMessage);
}
showLog('code ${e.response?.statusCode}');
var errorcode = e.response?.statusCode;
switch (errorcode) {
case UNAUTH:
Store.value<StoreLogin>().logout();
break;
}
showLog('postHttp exception: $e');
closeAllDialiog();
}
return response;
}
4、pull_to_refresh:下拉重繪,上拉加載庫,可定制性高
SmartRefresher(
controller: model.refreshController,
onRefresh: model.refresh,
onLoading: model.loadMore,
enablePullUp: true,
enablePullDown: true,
child: ListView.separated(
padding: EdgeInsets.all(Dimens.margin_normal),
separatorBuilder: (context, index) {
return Divider(
height: 10,
color: Colors.transparent,
);
},
itemCount: model.list.length,
itemBuilder: (ctx, index) {
OrderBean data = https://www.cnblogs.com/huangzhiwu/p/model.list[index];
return _buildItem(data);
}),
);
6、shared_preferences: ^0.5.3+4 (快取資料)
SharedPreferences prefs = await SharedPreferences.getInstance();
String counter = "1";
await prefs.setString('counter', counter);
6、path_provider:
用于獲取路徑,并沒有操作檔案和目錄的功能,因此,需要搭配Director和File等進行操作
7、Provider:狀態管理,很有用,多看看,簡化了監聽回呼,實際是內部自動注冊監聽了
8、flutter_swiper: 多種布局方式,無限輪播,Android和IOS雙端適配
9、fl_chart:折線圖
10、flutter_picker: 條件選擇,時間選擇
11、sprintf: 字串
12、url_launcher:打電話,ulr、超鏈接等
13、contact_picker: 聯系人選擇
14、logger:列印
logger.v("Verbose log")
logger.d("Debug log");
logger.i("Info log");
logger.w("Warning log");
logger.e("Error log");
logger.wtf("What a terrible failure log");
1. image_picker
一個可以從圖庫選擇圖片,并可以用相機拍攝新照片的flutter插件
2. flutter_image
使用NetworkImageWithRetry 代替Image.network 加載網路圖片可獲得重試能力,
3. barcode_scan
一個可以掃描二維碼和條形碼的flutter插件,
4. intl
該插件提供國際化和本地化設施,包括訊息翻譯,復數和性別,日期/數字格式和決議以及雙向文本,
5. sqflite
sqlite插件,同時支持ios和andriod
6. connectivity
這個插件允許Flutter應用程式發現網路連接并相應地進行自我配置,它可以區分蜂窩與WiFi連接,這個插件適用于iOS和Android,
7. cupertino_icons
Cupertino主題圖示集
8. location
這個插件 能夠處理Android和iOS設備的位置,它還提供位置更改時的回呼,
9. contact_picker
有了這個插件,Flutter應用程式可以要求其用戶從他/她的地址簿中選擇一個聯系人,并將與聯系人相關的資訊將回傳給應用程式,
10. sensors
通過這個插件 我們可以訪問加速度計與陀螺儀,
11. convert
該插件包含用于在不同資料表示之間轉換的編碼器和解碼器,它是dart:convert核心庫的外部物件,并且包含需要更靈活版本控制的中央API和API,
12.io
dart VM的工具集,可以對檔案進行讀取與寫入,
13.flutter_alipay
可以使用支付寶支付,
14.flutter_amap
高德地圖3d flutter組件,
15.amap_location
高德地圖定位flutter組件,
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/280213.html
標籤:iOS
