All Projects → ganeshrvel → pub-scaff

ganeshrvel / pub-scaff

Licence: MIT License
scaff, scaffold generator for Dart and Flutter

Programming Languages

dart
5743 projects
shell
77523 projects
Smarty
1635 projects

Projects that are alternatives of or similar to pub-scaff

flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+370.37%)
Mutual labels:  flutter-plugin, dart2
cross connectivity
A Flutter plugin for handling Connectivity and REAL Connection state in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.
Stars: ✭ 27 (+0%)
Mutual labels:  flutter-plugin, dart2
flutter google maps
A Flutter plugin for integrating Google Maps in iOS, Android and Web applications. It is a wrapper of google_maps_flutter for Mobile and google_maps for Web.
Stars: ✭ 86 (+218.52%)
Mutual labels:  flutter-plugin, dart2
http middleware
A middleware library for Dart's http library.
Stars: ✭ 38 (+40.74%)
Mutual labels:  flutter-plugin, dart2
flutter opencv
Flutter plug-in providing (a few) basic bindings to OpenCV-4.x. OpenCV methods implemented without the Core packages. WIP.
Stars: ✭ 119 (+340.74%)
Mutual labels:  flutter-plugin, pubdev
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+411.11%)
Mutual labels:  flutter-plugin, dart2
swipedetector
A Flutter package to detect up, down, left, right swipes.
Stars: ✭ 34 (+25.93%)
Mutual labels:  flutter-plugin, dart2
flutter nearby connections
Flutter plugin support peer-to-peer connectivity and the discovery of nearby devices for Android vs IOS
Stars: ✭ 51 (+88.89%)
Mutual labels:  flutter-plugin
flutter-elinux-plugins
Flutter plugins for embedded Linux (eLinux)
Stars: ✭ 21 (-22.22%)
Mutual labels:  flutter-plugin
flutter-nfc
Flutter Android plugin for NFC
Stars: ✭ 14 (-48.15%)
Mutual labels:  flutter-plugin
simple beacons flutter
A flutter plugin project to range & monitor iBeacons.
Stars: ✭ 29 (+7.41%)
Mutual labels:  flutter-plugin
nepali date picker
Material Style Date Picker with Bikram Sambat(Nepali) Calendar Support. Supports both Android and ios.
Stars: ✭ 30 (+11.11%)
Mutual labels:  flutter-plugin
flutter launch whatsapp
Plugin flutter to launch whatsapp
Stars: ✭ 46 (+70.37%)
Mutual labels:  flutter-plugin
flutter-devicelocale
A Flutter package to read and return the set device locales
Stars: ✭ 45 (+66.67%)
Mutual labels:  flutter-plugin
hasFlutterPassedReactNativeYet
🎯 A Dart Web App to compare ↔️ GitHub stars of Flutter and React Native
Stars: ✭ 17 (-37.04%)
Mutual labels:  dart2
appmetrica sdk
A Flutter plugin for Yandex AppMetrica SDK, a marketing platform for app install attribution, app analytics, and push campaigns.
Stars: ✭ 15 (-44.44%)
Mutual labels:  flutter-plugin
flutter-tunein
Dynamically themed Music Player built with flutter
Stars: ✭ 108 (+300%)
Mutual labels:  flutter-plugin
aeyrium-sensor
A Flutter sensor plugin which provide easy access to the Pitch and Roll on Android and iOS devices.
Stars: ✭ 57 (+111.11%)
Mutual labels:  flutter-plugin
lang table
lang_table is a dart plugin to generate string files from a source. Use a table to manage all multi-language resources. Inspired by fetch-mobile-localization-from-airtable
Stars: ✭ 17 (-37.04%)
Mutual labels:  flutter-plugin
awesome-pubdev
A curated list of awesome packages on pub.dev
Stars: ✭ 85 (+214.81%)
Mutual labels:  pubdev

Introduction

Scaffold Generator for Dart and Flutter.

scaff is a simple command-line utility for generating Dart and Flutter components from template files. It is a very tedious job to keep replicating the boilerplate codes every time you try to add a new component in your app. Using scaff, you can generate dart or flutter components from the custom-defined templates. You can even include template variables in the component files and directories name for easy and flexible scaffolding.

scaff uses 'Mustache templating library' variable schemes for defining and processing the template files.

Installation/Upgrade

$ pub global activate scaff

Usage

$ pub global run scaff

Example

Let us create a simple component. First of all, we need to create a working directory and it should contain a scaff.setup.json file. The scaff.setup.json file should contain all the template variables used in the working directory. The component subdirectories and files should be included inside the working directory. The files and directories name may contain template variables as well.

Template variable examples: {{var1}}, {{className}}Base, {{fileName}}_store

The example template directory structure:

component_templates
│   └── general_store_architecture
│       ├── scaff.setup.json
│       └── {{componentName}}
│           ├── {{componentName}}.dart
│           └── {{componentName}}_store.dart
  1. Create a new directory in the project root
$ mkdir -p component_templates/general_store_architecture
$ cd component_templates/general_store_architecture
  1. Create the component directory
$ mkdir {{componentName}}
$ cd {{componentName}}
  1. Create the component template file
$ touch {{componentName}}.dart
  1. Add the code to {{componentName}}.dart file
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../../data/mobx/{{componentName}}_store.dart';

class {{className}}Screen extends StatelessWidget {
  {{className}}Screen({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final {{componentName}} = Provider.of<{{className}}Store>(context);

    return Scaffold(
      body: Center(
        child: Column(),
      ),
    );
  }
}
  1. Create the store template file
$ touch {{componentName}}_store.dart
  1. Add the code to {{componentName}}_store.dart file
import 'package:mobx/mobx.dart';

abstract class {{className}}StoreBase with Store {
  @observable
  bool dummyValue = false;
}
  1. Create the scaff.setup.json file
$ cd ..
$ touch scaff.setup.json
  1. Add all the template variables used in the working directory to scaff.setup.json file as
{
  "variables": [
	"componentName",
	"className"
  ],
  "mappedVariables": {
	"componentName": "login",
	"className": "LoginScreen"
  }
}
  • variables holds a list of template variables. The CLI will prompt for the user input.
  • mappedVariables holds the values for the template variables. The generator will pick values from the mappedVariables automatically, if required.
  • You may use either of the one or in combination. CLI will skip the prompt if the value for a template variable is already available inside the mappedVariables.
  1. cd into general_store_architecture folder.
$ pwd # it should be pointing to =>  /path/component_templates/general_store_architecture
  1. Run scaff globally
$ pub global run scaff
  1. You will be prompted to:
Enter source directory (/path/component_templates/general_store_architecture) »
Enter destination directory (/path/component_templates/general_store_architecture/__component__) »
Enter template extension (dart) » 
Enter 'componentName' variable value » login
Enter 'className' variable value » Login
  1. The destination directory will have the newly generated component. The destination directory structure:
└── login
    ├── login.dart
    └── login_store.dart

Buy me a coffee

Help me keep the app FREE and open for all. Paypal me: paypal.me/ganeshrvel

Contacts

Please feel free to contact me at [email protected]

About

License

scaff | Scaffold Generator for Dart and Flutter. MIT License.

Copyright © 2018-Present Ganesh Rathinavel

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].