Skip to content

Commit 4472d72

Browse files
committed
(scfAll) Creates a Scaffold containing an Appbar, BottomNavigationBar and FloatingActionButton
1 parent 8926a79 commit 4472d72

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ An Intellij & Android Studio plugin that adds Live Templates to your IDE saving
88
|`alertDialog`|[View Docs](https://docs.flutter.io/flutter/widgets/AlertDialog-class.html)|Creates a showDialog that returns with AlertDialog|
99
|`futureBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/FutureBuilder-class.html)|Creates a FutureBuilder|
1010
|`listViewBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/ListView.builder.html)|Creates a ListView.builder()|
11+
|`scfAll`|[View Docs](https://docs.flutter.io/flutter/material/Scaffold-class.html)|Creates a Scaffold containing an Appbar, BottomNavigationBar and FloatingActionButton|
1112
|`streamBldr`|[View Docs](https://docs.flutter.io/flutter/widgets/StreamBuilder-class.html)|Creates a StreamBuilder|
1213

resources/META-INF/plugin.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>com.herbert.george.flutter-snippets</id>
33
<name>Flutter Snippets</name>
4-
<version>0.1.0</version>
4+
<version>0.1.1</version>
55
<vendor>George Herbert</vendor>
66
<description><![CDATA[
77
Provides live templates for Flutter to save time writing boiler plate.<br><br>
@@ -23,6 +23,10 @@
2323
<tr>
2424
<td>listViewBldr</td>
2525
<td>Creates a ListView.builder()</td>
26+
</tr>
27+
<tr>
28+
<td>scfAll</td>
29+
<td>Creates a Scaffold containing an Appbar, BottomNavigationBar and FloatingActionButton</td>
2630
</tr>
2731
<tr>
2832
<td>streamBldr</td>
@@ -31,7 +35,7 @@
3135
</table>
3236
3337
]]></description>
34-
<change-notes>Initial release of Flutter Snippets to the plugin repository</change-notes>
38+
<change-notes>Add support for (scfAll) scaffold containing an Appbar, BottomNavigationBar and FloatingActionButton. Other scaffold templates will follow</change-notes>
3539
<idea-version since-build="141.0"/>
3640
<depends>com.intellij.modules.java</depends>
3741
<extensions defaultExtensionNs="com.intellij">

resources/liveTemplates/Flutter.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,17 @@
4343
<option name="DART_STATEMENT" value="true"/>
4444
</context>
4545
</template>
46+
<template name="scfAll" 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; floatingActionButton: FloatingActionButton(&#10; onPressed: () =&gt; setState(() {&#10; _index = 0;&#10; }),&#10; tooltip: 'Reset Navigation Index',&#10; child: Icon(Icons.clear), //Change Icon&#10; ),&#10; floatingActionButtonLocation: FloatingActionButtonLocation.endFloat, //Change for different locations&#10; );" description="New AlertDialog" toReformat="false" toShortenFQNames="true">
47+
<variable name="appbarTitle" expression="&quot;appbarTitle&quot;" defaultValue="" alwaysStopAt="true" />
48+
<variable name="navBarItem1Text" expression="&quot;navBarItem1Text&quot;" defaultValue="" alwaysStopAt="true" />
49+
<variable name="navBarItem2Text" expression="&quot;navBarItem2Text&quot;" defaultValue="" alwaysStopAt="true" />
50+
<context>
51+
<option name="DART_STATEMENT" value="true" />
52+
</context>
53+
</template>
54+
55+
56+
57+
58+
4659
</templateSet>

0 commit comments

Comments
 (0)