flutter_ssf是一个推崇使用Provider、Custom Router、dio结合的MVVM开发模式设计的Flutter应用生产级开发脚手架。

Overview

🔥 🔥 flutter_ssf 🔥 🔥

flutter_ssf是一个推崇使用Provider、Custom Router、dio结合的MVVM开发模式设计的Flutter应用生产级开发脚手架。

flutter_ssf只提供基本的参照组件,所以具备几乎所有业务场景中拿来即用的特性。

flutter_ssf凝聚了十几个实际业务APP后,结合社区经验一体所成。

🎉 如果你对此套框架有不同的更好见解,欢迎pr 👏

一、架构说明

经过多个项目实战总结,手机端开发采取MVVM模式开发,通过Provider使得页面UI与数据model和数据操作分离实现。

在我们实际开发中,这套模式涵盖了我们大部分的页面开发需求,有效的做到了代码结藕,同时在测试环节中我们可以快速的定位到我们问题所在,有效的提高了开发效率。

lib

| __ assets 存放icon、img等资源文件

| __ api 存放api配置文件夹

| __ config 存放项目基础配置,譬如生产版本、开发版本不同端口域名设置

| __ enums 存放枚举项目文件夹

| __ models 存放model文件,与page文件一一对应存放

| __ providers 存放provider文件,与page文件一一对应存放

| __ pages 存放项目中的所有page页面

	|__ components 存放公共页面,本文件夹只存放同级页面公用的page级文件,独属模块公用页面在自己页面文件夹中新开components文件夹存放

| __ pubs 存放插件文件夹,所有插件原则上需二次改造供业务使用

| __ routers 路由文件夹

| __ utils 公共工具文件夹,例如:ColorTo16转换Class

|__ common 。。。

	|__  page

	|__  widget

说明

  • model、provider、page在文件夹中一一对应。

  • 在一些简单(简单的单页面数据展示:详情页)的页面中,我们可以使用简单的原生开发(setstate),不必拘泥于要用provider而用provider导致页面过重,这样就得不偿失。

  • 在使用本套开发模式时,请深入了解Flutter的渲染机制、state机制、Provider插件的使用及注意事项。

二、插件使用规范

使用规范

建议所有的第三方插件都进行二次封装后放入pubs文件夹使用,有利于插件版本升级、更换,符合我们开发原则:“一处处理,多处实现”,降低我们的维护成本和开发成本。

插件汇总

Provider:数据动态管理插件

熟悉provider是如何调用build方法去通知页面更新,了解context挂载provider实例,如何通过context在element tree中获取到对应的provider实例。

dio:网络请求插件

熟悉dio基本配置,拦截网络请求做业务处理

flutter_screenutil:屏幕适配

了解屏幕适配的基本原理,如何调用全局context for root# flutter_ssf

三、学习资料汇总

四、实用技巧

  • 一键生成 Iconfont Dart类 新建一个浏览器标签,把下面 👇 复制到网站一行 保存后,打开Iconfont官网项目中,点击标签,自动下载Dart类,copy到自己的项目引入即可

       javascript:function download(filename, text) {  var element = document.createElement('a');  element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));  element.setAttribute('download', filename);  element.style.display = 'none';  document.body.appendChild(element);  element.click();  document.body.removeChild(element);}function toHump(name) {name = name.replace(/\s+/g,"-");    return name.replace(/\-(\w)/g, function(all, letter){        return letter.toUpperCase();    });}function getFlutterClass(){var str = "import 'package:flutter/widgets.dart';\r\n\r\n";str += "class IconFontIcons {\r\n";var arr = document.querySelectorAll(".icon-item");for (var i = arr.length - 1; i >= 0; i--) {var item = arr[i];var item_name = toHump(item.querySelectorAll(".icon-code")[1].textContent);var item_code = item.querySelectorAll(".icon-code")[0].textContent.replace(/\&\#/g,"0");item_code = item_code.replace(/\;/g,"");str += "    static const IconData "+item_name+" = IconData("+item_code+",fontFamily:'IconFontIcons');";str += "\r\n";}str += "}";return str;}  download("IconFontIcons.dart",getFlutterClass());
  • Flutter 版本管理工具 🔥 🔥 fvm 解决我们不通项目之间不通版本的问题

五、联系我

🎉 🎉 掘金博客

You might also like...

Flutter application to demonstrate use of mPin Animation with custom widget.

Flutter application to demonstrate use of mPin Animation with custom widget.

Flutter mPin Animation | Custom Widget mPin Widget to accept user input with nice animation. Tutorial 👇🏼👇🏼👇🏼 Flutter mPin Animation Tutorial ||

Dec 1, 2022

:bug: Flutter debug helper widget with common and custom actions

:bug: Flutter debug helper widget with common and custom actions

Debug Friend Flutter debug helper widget with common and custom actions This helps you reduce the development and testing time of new features Show so

Dec 7, 2022

This is a simple client of Reddit built with MVVM and Provider powered by a custom OAuth2.0 login

👷 🔧 🔩 Flutter Starter Architecture (MVVM + Hive) My custom starter project for Flutter apps. I was looking for a simple way to build Flutter app in

Oct 26, 2022

A library that makes it easy for you to create your own custom wizard.

A library that makes it easy for you to create your own custom wizard.

Flutter Wizard Author: Jop Middelkamp A library that makes it easy for you to create your custom wizard. You'll have 100% control over the appearance

Dec 2, 2022

This repo is for anything that can be reusable in flutter like custom widgets 🟥, animations 🌟and more

Ease This packa is for anything that can be reusable in flutter like custom widgets 🟥 , animations 🌟 and more. Features 1-custom text widget to ease

Dec 3, 2022

Custom calendar dialog widget for flutter with (multi select, single select, date range) mode

Custom calendar dialog widget for flutter with (multi select, single select, date range) mode

some calendar Custom calendar with Multi-select & range configurable calendar New Features Added View Mode Somecalendar #15 Help Maintenance I've take

Jan 3, 2023

A simple pair game made with Flutter, a custom library, BLoC and tunnel pattern.

A simple pair game made with Flutter, a custom library, BLoC and tunnel pattern.

Pair game A simple pair game created with Flutter. Article on Medium here: https://medium.com/@frmineoapps/a-simple-pair-game-made-with-flutter-a-cust

Jun 28, 2022

Turtle graphics for Flutter. It simply uses a custom painter to draw graphics by a series of Logo-like commands.

Turtle graphics for Flutter. It simply uses a custom painter to draw graphics by a series of Logo-like commands.

flutter_turtle flutter_turtle is a simple implementation of turtle graphics for Flutter. It simply uses a custom painter to draw graphics by a series

Dec 16, 2022

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter. Need help? Please do not submit an issue for a "

Jan 8, 2023
Releases(1.0.3)
Owner
Assrce
Become a batter self.
Assrce
Declaratively switch child widgets based on the current `Router` location.

Features Declaratively switch child widgets based on the current Router location. class SideBar extends StatelessWidget { Widget build(_){ re

gskinner team 7 Dec 12, 2022
A routing package that lets you navigate through guarded page stacks and URLs using the Router and Navigator's Pages API, aka "Navigator 2.0".

A Flutter package to help you handle your application routing and synchronize it with browser URL. Beamer uses the power of Router and implements all

Sandro Lovnički 485 Jan 7, 2023
Go Router example for @flutter

pub_packages Pub packages Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is yo

Plague Fox 4 May 6, 2022
Router_generator is a flutter library for router generation

Router_generator is a flutter library for router generation

Jelly Bean 20 Sep 27, 2022
best flutter / dart practices + Custom Painter + Sliver App Bar + Custom Scrollview

Weekly Budget Flutter App A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get yo

Mohamed Awnallah 4 Oct 21, 2021
A customizable carousel slider widget in Flutter which supports inifinte scrolling, auto scrolling, custom child widget, custom animations and built-in indicators.

flutter_carousel_widget A customizable carousel slider widget in Flutter. Features Infinite Scroll Custom Child Widget Auto Play Horizontal and Vertic

NIKHIL RAJPUT 7 Nov 26, 2022
Flutter package that provides you custom clippers to help you achieve various custom shapes.

flutter_custom_clippers Flutter package that provides you custom clippers to help you achieve various custom shapes. Usage To use this plugin, add flu

Damodar Lohani 291 Dec 23, 2022
FT-Custom-Widget - A Custom Widget Built With Flutter

Custom Widget Watch it on YouTube Product Screen Sample when you implement compl

Firgia 5 Mar 29, 2022
A customizable carousel slider for Flutter. Supports infinite sliding, custom indicators, and custom animations with many pre-built indicators and animations.

Flutter Carousel Slider A customizable carousel slider for flutter Screenshots Installing dependencies: flutter_carousel_slider: ^1.0.8 Demo Demo a

Udara Wanasinghe 23 Nov 6, 2022
Flutter custom carousel slider - A carousel slider widget,support custom decoration suitable for news and blog

flutter_custom_carousel_slider A carousel slider Flutter widget, supports custom

Emre 40 Dec 29, 2022