Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. debugPaintSizeEnabled = true;
  2.  
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/rendering.dart';
  5.  
  6. void main()
  7. {
  8. runApp(MyApp());
  9. }
  10.  
  11. class MyApp extends StatelessWidget {
  12. // This widget is the root of your application.
  13.  
  14. @override
  15. Widget build(BuildContext context) {
  16. debugPaintSizeEnabled = true;
  17. return MaterialApp(
  18. title: 'Flutter Demo',
  19. theme: ThemeData(
  20. primarySwatch: Colors.blue,
  21. ),
  22. home: MyHomePage(title: 'Flutter Demo Home Page'),
  23.  
  24. );
  25. }
  26. }
  27. class MyHomePage extends StatefulWidget {
  28. MyHomePage({Key key, this.title}) : super(key: key);
  29. final String title;
  30.  
  31. @override
  32. _MyHomePageState createState() => _MyHomePageState();
  33. }
  34.  
  35. class _MyHomePageState extends State<MyHomePage> {
  36. int _counter = 0;
  37.  
  38. void _incrementCounter() {
  39. setState(() {
  40. _counter++;
  41. });
  42. }
  43.  
  44. @override
  45. Widget build(BuildContext context) {
  46. return Scaffold(
  47. appBar: AppBar(
  48. title: Text(widget.title),
  49. ),
  50. body: Center(
  51. child: Column(
  52.  
  53. mainAxisAlignment: MainAxisAlignment.center,
  54. children: <Widget>[
  55. Text(
  56. 'You have pushed the button this many times:',
  57. ),
  58. Text(
  59. '$_counter',
  60. style: Theme.of(context).textTheme.display1,
  61. ),
  62. ],
  63. ),
  64. ),
  65. floatingActionButton: FloatingActionButton(
  66. onPressed: _incrementCounter,
  67. tooltip: 'Increment',
  68. child: Icon(Icons.add),
  69. ),
  70. );
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement