Skip to content

Instantly share code, notes, and snippets.

@Dviejopomata
Created February 10, 2020 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dviejopomata/d4ad12b5be93044b56189dcf711f483d to your computer and use it in GitHub Desktop.
Save Dviejopomata/d4ad12b5be93044b56189dcf711f483d to your computer and use it in GitHub Desktop.
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: ContadorWidget(),
);
}
}
class ContadorWidget extends StatefulWidget {
@override
_ContadorWidgetState createState() => _ContadorWidgetState();
}
class _ContadorWidgetState extends State<ContadorWidget> {
int _contador = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Kung Fu Academy"),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
print("Este botón ha sido pulsado");
setState((){
_contador++;
});
},
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Nuestra primera aplicacion Flutter'),
Text(
_contador.toString(),
style: Theme.of(context).textTheme.headline4,
),
Text('Hola que tal'),
],
)
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment