Skip to content

Instantly share code, notes, and snippets.

@theindianappguy
Created May 17, 2020 07:32
Show Gist options
  • Save theindianappguy/6e0ce9300bcf7e36b27cae9981d54b10 to your computer and use it in GitHub Desktop.
Save theindianappguy/6e0ce9300bcf7e36b27cae9981d54b10 to your computer and use it in GitHub Desktop.
UI for meme generator app
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Container(
child: Column(
children: <Widget>[
SizedBox(
height: 50,
),
Image.asset(
"assets/memegenrator.png",
height: 70,
),
SizedBox(
height: 14,
),
RepaintBoundary(
key: globalKey,
child: Stack(
children: <Widget>[
_image != null
? Image.file(
_image,
height: 300,
fit: BoxFit.fitHeight,
)
: Container(),
Container(
width: MediaQuery.of(context).size.width,
height: 300,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Text(
headerText.toUpperCase(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 26,
shadows: <Shadow>[
Shadow(
offset: Offset(2.0, 2.0),
blurRadius: 3.0,
color: Colors.black87,
),
Shadow(
offset: Offset(2.0, 2.0),
blurRadius: 8.0,
color: Colors.black87,
),
],),
),
),
Spacer(),
Container(
padding: EdgeInsets.symmetric(vertical: 8),
child: Text(
footerText.toUpperCase(),
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 26,
shadows: <Shadow>[
Shadow(
offset: Offset(2.0, 2.0),
blurRadius: 3.0,
color: Colors.black87,
),
Shadow(
offset: Offset(2.0, 2.0),
blurRadius: 8.0,
color: Colors.black87,
),
],),
))
],
),
),
],
),
),
SizedBox(
height: 20,
),
imageSelected
? Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: <Widget>[
TextField(
onChanged: (val) {
setState(() {
headerText = val;
});
},
decoration: InputDecoration(hintText: "Header Text"),
),
SizedBox(
height: 12,
),
TextField(
onChanged: (val) {
setState(() {
footerText = val;
});
},
decoration: InputDecoration(hintText: "Footer Text"),
),
SizedBox(height: 20,),
RaisedButton(
onPressed: () {
//TODO
takeScreenshot();
},
child: Text("Save"),
)
],
),
)
: Container(
child: Center(
child: Text("Select image to get started"),
),
),
_imageFile != null ? Image.file(_imageFile) : Container(),
],
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
getImage();
},
child: Icon(Icons.add_a_photo),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment