Skip to content

0.1.4 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ An Intellij & Android Studio plugin that adds Live Templates to your IDE saving
|`animBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/AnimationBuilder-class.html)|Creates an AnimationBuilder|
|`customScrollV`|[View Docs](https://api.flutter.dev/flutter/widgets/CustomScrollView-class.html)|Creates a CustomScrollView|
|`futureBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/FutureBuilder-class.html)|Creates a FutureBuilder|
|`importMat`|[View Docs](https://api.flutter.dev/flutter/material/material-library.html)|Adds Material Import|
|`importCup`|[View Docs](https://api.flutter.dev/flutter/cupertino/cupertino-library.html)|Adds Cupertino Import|
|`layoutBldr`|[View Docs](https://api.flutter.dev/flutter/widgets/LayoutBuilder-class.html)|Creates a LayoutBuilder|
|`listViewBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/ListView.builder.html)|Creates a ListView.builder()|
|`orienatatBldr`|[View Docs](https://api.flutter.dev/flutter/widgets/OrientationBuilder-class.html)|Creates a OrientationBuilder|
|`scfAll`|[View Docs](https://docs.flutter.io/flutter/material/Scaffold-class.html)|Creates a Scaffold containing an Appbar, BottomNavigationBar and FloatingActionButton|
|`scfAppBar`| |Creates a Scaffold containing an Appbar|
|`scfAppBarFab`| |Creates a Scaffold containing an Appbar and Floating Action Button|
|`scfAppBarBtmNav`| |Creates a Scaffold containing an Appbar and Bottom Navigation Bar|
|`singleChildScrollV`|[View Docs](https://api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html)|Creates a SingleChildScrollView|
|`streamBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/StreamBuilder-class.html)|Creates a StreamBuilder|
|`stfulBldr`|[View Docs](https://api.flutter.dev/flutter/widgets/StatefulBuilder/StatefulBuilder.html)|Creates a StatefulBuilder|

## Plugin Supports the Following IDEs:
* Android Studio
Expand Down
20 changes: 18 additions & 2 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<idea-plugin>
<id>com.herbert.george.flutter-snippets</id>
<name>Flutter Snippets</name>
<version>0.1.3</version>
<version>0.1.4</version>
<vendor>George Herbert</vendor>
<description><![CDATA[
<p>Provides live templates for Flutter to save time writing boilerplate.</p>
Expand Down Expand Up @@ -35,6 +35,18 @@ The following commands are supported:
<tr>
<td>listViewBldr</td>
<td>Creates a ListView.builder()</td>
</tr>
<tr>
<td>importMat</td>
<td>Adds Material Import</td>
</tr>
<tr>
<td>importCup</td>
<td>Adds Cupertino Import</td>
</tr>
<tr>
<td>orientatBldr</td>
<td>Creates a ListView.builder()</td>
</tr>
<tr>
<td>scfAll</td>
Expand All @@ -60,8 +72,12 @@ The following commands are supported:
<td>streamBldr</td>
<td>Creates a StreamBuilder</td>
</tr>
<tr>
<td>stfulBldr</td>
<td>Creates a StatefulBuilder</td>
</tr>
</table>]]></description>
<change-notes>Add support for customScrollV (CustomScrollView), layoutBldr (LayoutBuilder) and singleChildScrollV (SingleChildScrollView)</change-notes>
<change-notes>Add support for stfulBldr (StatefulBuilder), orienatatBldr (OrientationBuilder) and import shortcuts for Material (importMat) and Cupertino (importCup)</change-notes>
<idea-version since-build="141.0" />
<depends>com.intellij.modules.java</depends>
<extensions defaultExtensionNs="com.intellij">
Expand Down
27 changes: 26 additions & 1 deletion resources/liveTemplates/Flutter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,37 @@
</context>
</template>
<!-- New Scaffold with AppBar and Bottom Nav Bar-->
<template name="scfAppBarBtmNav" value="int _index = 0; // Make sure this is outside build(), otherwise every setState will chage the value back to 0 &#10;&#10;return Scaffold(&#10;appBar: AppBar(&#10;title: Text('$appbarTitle$'),&#10;),&#10;body: Center(&#10;child: Container(child: Text('You are looking at the message for bottom navigation item $_index')),&#10;),&#10;bottomNavigationBar: BottomNavigationBar(&#10;onTap: (tappedItemIndex) =&gt; setState(() {&#10;_index = tappedItemIndex;&#10; }),&#10;currentIndex: _index,&#10;items: [&#10;BottomNavigationBarItem(icon: Icon(Icons.av_timer), title: Text('$navBarItem1Text$')),&#10;BottomNavigationBarItem(icon: Icon(Icons.add), title: Text('$navBarItem2Text$'))&#10;])&#10;);" description="New Scaffold with AppBar &amp; Bottom Nav Bar" toReformat="false" toShortenFQNames="true">
<template name="scfAppBarBtmNav" value="int _index = 0; // Make sure this is outside build(), otherwise every setState will change the value back to 0 &#10;&#10;return Scaffold(&#10;appBar: AppBar(&#10;title: Text('$appbarTitle$'),&#10;),&#10;body: Center(&#10;child: Container(child: Text('You are looking at the message for bottom navigation item $_index')),&#10;),&#10;bottomNavigationBar: BottomNavigationBar(&#10;onTap: (tappedItemIndex) =&gt; setState(() {&#10;_index = tappedItemIndex;&#10; }),&#10;currentIndex: _index,&#10;items: [&#10;BottomNavigationBarItem(icon: Icon(Icons.av_timer), title: Text('$navBarItem1Text$')),&#10;BottomNavigationBarItem(icon: Icon(Icons.add), title: Text('$navBarItem2Text$'))&#10;])&#10;);" description="New Scaffold with AppBar &amp; Bottom Nav Bar" toReformat="false" toShortenFQNames="true">
<variable name="appbarTitle" expression="&quot;appbarTitle&quot;" defaultValue="" alwaysStopAt="true" />
<variable name="navBarItem1Text" expression="&quot;navBarItem1Text&quot;" defaultValue="" alwaysStopAt="true" />
<variable name="navBarItem2Text" expression="&quot;navBarItem2Text&quot;" defaultValue="" alwaysStopAt="true" />
<context>
<option name="DART_STATEMENT" value="true" />
</context>
</template>
<!-- StatefulBuilder-->
<template name="stfulBldr" value="StatefulBuilder(&#10;builder: (BuildContext context, StateSetter setState){&#10;return $widget$&#10;}&#10;)," description="New Stateful Builder" toReformat="false" toShortenFQNames="true">
<variable name="widget" expression="&quot;widget&quot;" defaultValue="" alwaysStopAt="true" />
<context>
<option name="DART_STATEMENT" value="true" />
</context>
</template>
<!-- OrientationBuilder-->
<template name="orientatBldr" value="OrientationBuilder(&#10; builder: (BuildContext context, Orientation orientation) {&#10;return GridView.count(&#10;// Create a grid with 2 columns in portrait mode, or 3 columns in&#10;// landscape mode.&#10;crossAxisCount: orientation == Orientation.portrait ? 2 : 3,&#10;);&#10;},&#10;);" description="New OrientationBuilder" toReformat="false" toShortenFQNames="true">
<context>
<option name="DART_STATEMENT" value="true" />
</context>
</template>
<!-- Add Material Package Import-->
<template name="importMat" value="import 'package:flutter/material.dart';" description="Import Material Package" toReformat="false" toShortenFQNames="true">
<context>
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
<!-- Add Cupertino Package Import-->
<template name="importCup" value="import 'package:flutter/cupertino.dart';" description="Import Cupertino Package" toReformat="false" toShortenFQNames="true">
<context>
<option name="DART_TOPLEVEL" value="true" />
</context>
</template>
</templateSet>