Code Monkey home page Code Monkey logo

flutter_app_all_template's Introduction

快速开发flutterApp的工程模版

目录

[TOC]

提示

文档

https://gnu-xiaosong.github.io/flutter_quaker_app/

项目架构

img_4.png

特性

  • 统一管理器模块调度
  • 统一App参数配置
  • 统一组件化管理
  • 统一api管理
  • 统一页面化管理
  • 统一App路由管理
  • 统一Layous管理
  • 统一状态管理
  • 统一实体模型管理
  • 高度可定制化,模块化
  • 强解耦,强可插性
  • 封装了App基本结构,开发者只需专注于页面逻辑开发。

适用平台

  • Android
  • IOS
  • PC:Windows and Macos
  • web
  • Ipad
  • Embeding嵌入式

使用方法

  • 克隆该项目到本地

    git clone https://github.com/gnu-xiaosong/flutter_app_all_template.git
  • 安装相关依赖:切换至项目目录命令行运行

    flutter pub get

    💁‍♂️注意如果出现安装依赖出错,请自动修改相关依赖包以适配,后期我会进行修复。k

    需要修改包依赖如下

    • fancy_bottom_navigation: ^0.3.2 #注意: 这个包出现问题时,要修改:用 clipBehavior: Clip.none替换为overflow: Overflow.visible
    • bubble_bottom_bar: ^2.0.0 #注意要解决:Badge在Badge.dart和material.dart中命名冲突问题,解决方法:隐藏掉material.dart中的Badge 即:....hide Badge
  • 配置项目

​ 请在项目目录中lib/config中对应配置文件配置相关平台项目参数。

  • 运行启动项目

    flutter run -d 平台  

    或者直接运行

    flutter run

截图

  • Android端
  • Windows端 img.png
  • Macos端 img_1.png
  • 嵌入式端 img_3.png

开发环境

  • 语言:Dart
  • 框架:Flutter2

具体环境见pubspec.yaml文件

工程目录

├─.dart_tool
├─.idea
├─android                  ——————Android平台相关代码
├─assets                   ——————资源文件:img,font等
├─ios                      ——————IOS平台相关代码
├─lib                      ——————开发目录:flutter相关代码
│  ├─common                .........一些工具类,如通用方法类、网络接口类、保存全局变量的静态类等
│  ├─api                   .........api请求目录
│  ├─l10n                  .........国际化相关的类都在此目录下
│  ├─Layouts               .........App布局类都在此目录下
│  ├─boot                  .........各个平台启动目录
│  ├─models                .........Dart Model类会在此目录下
│  ├─config                .........配置文件目录
│  ├─pages                 .........页面存储目录:主要是构建App所需要的页面
│  ├─routes                .........存放所有路由页面类
│  ├─states                .........保存APP中需要跨组件共享的状态类
│  ├─widgets               .........APP内封装的一些Widget组件都在该目录下
│  └─main.dart             .........入口文件
├─linux                    ——————Linux平台相关代码
├─macos                    ——————MACOS平台相关代码
├─test                     ——————用于存放测试代码
├─web                      ——————Web平台相关代码
├─windows                  ——————Windows平台代码
├─analysis_options.yaml    ——————分析dart语法的文件,老项目升级成新项目有警告信息的话可以删掉此文件
└─pubspec.yaml             ——————配置文件,一般存放一些第三方库的依赖。

项目配置

在config目录下文件中配置APP相关参数。

image-20240118201408695

Rasperry for flutter 配置

提示:开发机器为windows 构建机器为ubuntu,运行机器为Raspberry

第一步:安装vmware虚拟机,自行百度。ubuntu系统为例

第二步:配置Flutter环境,snap进行安装flutter

地址:https://github.com/ardera/flutterpi_tool

第三步:Raspberry配置

安装flutter-pi工具(用于调起flutter应用)
  • 安装相关依赖

    sudo apt install cmake libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev ttf-mscorefonts-installer fontconfig libsystemd-dev libinput-dev libudev-dev  libxkbcommon-dev
    
    sudo fc-cache
  • clone源代码

    # github
    git clone https://github.com/ardera/flutter-pi
    # gitee
    git clone https://gitee.com/komatsu1134/flutter-pi.git
    # 切换至目录
    cd flutter-pi
  • 编译代码

    mkdir build && cd build
    cmake ..
    make -j`nproc`
  • 安装

    sudo make install
  • 启用

    flutter-pi 
配置Raspberry参数

第四步:启动项目

  • 克隆项目

    # github 推荐
    git clone https://github.com/gnu-xiaosong/flutter_app_all_template.git
    # gitee  更新可能不及时
    git clone https://gitee.com/komatsu1134/flutter_app_all_template1.git
  • 安装项目包依赖依赖

    flutter pub get
  • 安装flutterpi-tool工具统一管理编译

    flutter pub add flutterpi_tool
  • 激活flutterpi_tool

    flutter pub global activate flutterpi_tool
  • 编译资源包:采用flutterpi-tool

    • cd进入项目目录

      cd flutter_app_all_template
      
    • 运行flutterpi_tool build编译

      • ARM 32-bit debug mode

        flutterpi_tool build
        # or
        flutter pub global run flutterpi_tool build
      • 64-bit ARM, release mode, with a Raspberry Pi 4 tuned engine

        flutterpi_tool build --arch=arm64 --cpu=pi4 --release
        # or
        flutter pub global run flutterpi_tool build --arch=arm64 --cpu=pi4 --release

        注意:要将flutterpi_tool添加进环境变量中

        export PATH="$PATH:`pwd`/xxx/bin"
  • 发送打包资源给Raspberry:使用rsyncscp将捆绑包部署到Raspberry Pi

    # cd进入项目目录
    cd flutter_app_all_template
    # 使用rsync
    rsync -a --info=progress2 ./build/flutter_assets/ pi@raspberrypi:/home/pi/my_apps_flutter_assets
    # 或scp
    scp -r ./build/flutter_assets/ pi@raspberrypi:/home/pi/my_apps_flutter_assets

    如果连接不上则,用ip连接pi@raspberrypi

    注意:只需要将树莓派连接到同一个局域网内即可,运行该命令之后他会提示你输入密码,用于传输数据至树莓派

  • Raspebrry端启动项目:在Raspberry中执行

    sudo flutter-pi --release /home/pi/my_apps_flutter_assets

更新日志:

  • 2024.1.6 增加了notification本地化通知插件,并且进行了工具类封装,以及主题插件配置

  • 2024.1.7 增加下拉刷新以及微光效果,修改目录结构,以及登录注册页面

  • 2024.1.24 fix bottom sheet to gesture

    image-20240124082545122
  • 2024.1.28 add flutter embeding to Raspberry and exception catched handler

  • 2024.3.3 修复bottom底部样式9的bug以及垂直滑动弹窗点击和水平滑动时也弹出的bug

flutter_app_all_template's People

Contributors

gnu-xiaosong avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.