Skip to content

Instantly share code, notes, and snippets.

@karanahuja-android
Last active August 30, 2020 11:28
Show Gist options
  • Save karanahuja-android/f81606817894c6f6b3f17072a2bc0665 to your computer and use it in GitHub Desktop.
Save karanahuja-android/f81606817894c6f6b3f17072a2bc0665 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
main ()
{
runApp (HelloWorld ());
}
class HelloWorld extends StatefulWidget
{
@override
_HelloWorldState createState () => _HelloWorldState ();
}
class _HelloWorldState extends State <HelloWorld>
{
var message = "Hello World";
changeMyState ()
{
setState (()
{
this.message = "Goodbye World";
});
}
@override
Widget build (BuildContext context)
{
return MaterialApp(
home:Scaffold(
appBar:AppBar(
title:Text ("Hello World App")
),
body:Center (
child:GestureDetector(
onTap: changeMyState,
child:Text("$message")
),
),
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment