Skip to content

Instantly share code, notes, and snippets.

@Luc2000
Created Sep 21, 2021
Embed
What would you like to do?
DDM6 - T5 PT3004252
// 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: 'DDMA6',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.green,
),
home: const MyHomePage(title: 'T5 - DDMA'),
);
}
}
class MyHomePage extends StatefulWidget {
final String title;
const MyHomePage({
Key? key,
required this.title,
}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String button = 'Hello!';
void _changedButton() {
setState(() {
button='Lucas Souza Annunziato';
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'$button',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _changedButton,
tooltip: 'Trocar Texto',
child: const Text('Clique Aqui'),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment