| // Copyright 2018 The Fuchsia Authors. 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(new _MyApp()); |
| } |
| |
| class _MyApp extends StatelessWidget { |
| @override |
| Widget build(BuildContext context) { |
| return new MaterialApp( |
| title: 'Hello Material', |
| home: const _MyHomePage(title: 'Hello Material!'), |
| ); |
| } |
| } |
| |
| class _MyHomePage extends StatefulWidget { |
| const _MyHomePage({Key key, this.title}) : super(key: key); |
| |
| final String title; |
| |
| @override |
| _MyHomePageState createState() => new _MyHomePageState(); |
| } |
| |
| class _MyHomePageState extends State<_MyHomePage> { |
| int _counter = 0; |
| |
| void _incrementCounter() { |
| setState(() { |
| _counter++; |
| }); |
| } |
| |
| @override |
| Widget build(BuildContext context) { |
| return new Scaffold( |
| appBar: new AppBar( |
| title: new Text(widget.title), |
| ), |
| body: new Center( |
| child: new Text( |
| 'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.', |
| ), |
| ), |
| floatingActionButton: new FloatingActionButton( |
| onPressed: _incrementCounter, |
| tooltip: 'Increment', |
| child: new Image.asset('assets/logo.png'), |
| ), |
| ); |
| } |
| } |