Skip to content

Instantly share code, notes, and snippets.

@LH-CDT LH-CDT/main.dart
Last active Jun 11, 2018

Embed
What would you like to do?
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
// This widget is the root of your application.
@override
MyAppState createState() {
return new MyAppState();
}
}
class MyAppState extends State<MyApp> {
int _tapCount = 0;
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Material(
child: new Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text("Button tapped $_tapCount times."),
const SizedBox(
height: 8.0,
),
new GestureDetector(
child: new Container(
color: const Color(0xffcc6600),
child: new Center(
child: new Text("Tap me"),
),
height: 48.0,
),
onTap: _onTap,
),
],
),
),
);
}
void _onTap() {
setState(() {
_tapCount++;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.