123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import 'dart:io';
- import 'package:fluro/fluro.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:provide/provide.dart';
- import 'package:flutter_note/routers/application.dart';
- import 'package:flutter_note/routers/routers.dart';
- import 'package:flutter_note/shop_app.dart';
- import 'package:flutter_note/provide/cart_count_provide.dart';
- import 'package:flutter_note/provide/cart_provide.dart';
- import 'package:flutter_note/provide/home_provide.dart';
- import 'package:flutter_note/provide/page_index_provide.dart';
- import 'package:flutter_note/provide/goods_detail_provide.dart';
- import 'package:flutter_note/provide/mall_goods_provide.dart';
- import 'package:flutter_note/provide/sub_category_provide.dart';
- //程序入口
- void main() {
- final providers = Providers()
- ..provide(Provider.function((_) => HomeProvide())) // 主页面
- ..provide(Provider.function((_) => PageIndexProvide())) // 主页面 tab 切换
- ..provide(Provider.function((_) => CartCountProvide())) // 详情页面购物车数量修改
- ..provide(Provider.function((_) => SubCategoryProvide())) // 分类页面切换
- ..provide(Provider.function((_) => MallGoodsProvide())) // 分类页面刷新加载
- ..provide(Provider.function((_) => GoodsDetailProvide())) // 商品详情页面
- ..provide(Provider.function((_) => CartProvide())); // 购物车持久化
- final Router router = Router();
- Routers.configureRouters(router);
- Application.router = router;
- // 强制竖屏
- SystemChrome.setPreferredOrientations([DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]).then((_) {
- runApp(ProviderNode(child: ShopApp(), providers: providers));
- // android 下透明状态栏
- if (Platform.isAndroid) {
- SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.transparent));
- }
- });
- }
|