Last active
June 17, 2021 16:20
-
-
Save yuva-dev/9c839ce2152920406fc0853cba982a1b to your computer and use it in GitHub Desktop.
Android Studio Template to create stateful classes in flutter with bells and whistles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set( $nameparts = $NAME.split("_")) | |
#set( $namepart = '') | |
#set( $classname = '') | |
#foreach( $namepart in $nameparts ) | |
#set( $classname = $classname + $namepart.substring(0, 1).toUpperCase() + $namepart.substring(1)) | |
#end | |
import 'package:flutter/material.dart'; | |
class ${classname} extends StatefulWidget { | |
const ${classname}(); | |
@override | |
_${classname}State createState() => _${classname}State(); | |
} | |
class _${classname}State extends State<${classname}> { | |
@override | |
void initState() { | |
super.initState(); | |
_onInit(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: getAppBar("AppBar"), | |
body: _getBody(), | |
); | |
} | |
Widget _getBody() { | |
return Container(); | |
} | |
Future<void> _onInit() async { | |
} | |
void refresh() { | |
if (this.mounted) setState(() {}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment