Skip to content

Instantly share code, notes, and snippets.

@yuva-dev
Last active June 17, 2021 16:20
Show Gist options
  • Save yuva-dev/9c839ce2152920406fc0853cba982a1b to your computer and use it in GitHub Desktop.
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
#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