Flutter入门商城02之入口开发
2020-12-07 本文已影响0人
有时有晌
flutter_mall_self
代码:
gitee : https://gitee.com/qobn/flutter_mall.git
github : https://github.com/a120476536/flutter_mall.git
电商
效果预览
初始环境配置好之后,配置商城入口,注意在配置之前需提前配置好相关路由
router.png
地图类可后期配置
import 'dart:io';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mall_self/router/application.dart';
import 'package:flutter_mall_self/router/routers.dart';
import 'package:flutter_stack_trace/flutter_stack_trace.dart';
import 'package:flutter_bmfbase/BaiduMap/bmfmap_base.dart' show BMFMapSDK, BMF_COORD_TYPE;
void main() {
// 百度地图sdk初始化鉴权
if (Platform.isIOS) {
BMFMapSDK.setApiKeyAndCoordType(
'请在此输入您在开放平台上申请的API_KEY', BMF_COORD_TYPE.BD09LL);
} else if (Platform.isAndroid) {
// Android 目前不支持接口设置Apikey,
// 请在主工程的Manifest文件里设置,详细配置方法请参考官网(https://lbsyun.baidu.com/)demo
BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL);
}
runApp(MallApp());
debugLog("test", isShowTime: false);
}
class MallApp extends StatelessWidget {
MallApp(){
final router = FluroRouter();
Routers.configureRoutes(router);
Application.router = router;
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "电商", /*home: MallPage(),*/
onGenerateRoute: Application.router.generator,
);
}
}
如上代码编写完成之后则商城执行入口以编辑完毕