Last active
May 20, 2020 15:42
-
-
Save kdmatrosov/8741cccdbb1c07728524dba79f1140d0 to your computer and use it in GitHub Desktop.
Revisions
-
kdmatrosov revised this gist
May 20, 2020 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,11 @@ class _ExampleState extends State<Example> { child: Column( children: [ FlatButton( color: Colors.blue, child: Text( 'Счетчик: $_counter', style: TextStyle(color: Colors.white), ), onPressed: () { setState(() { _counter++; @@ -54,6 +58,7 @@ class _ExampleState extends State<Example> { class WeNeedItOnlyOnce extends StatelessWidget { const WeNeedItOnlyOnce(); @override Widget build(BuildContext context) { print('WeNeedItOnlyOnce'); -
kdmatrosov created this gist
May 20, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Example(), ), ); } } class Example extends StatefulWidget { @override _ExampleState createState() => _ExampleState(); } class _ExampleState extends State<Example> { int _counter = 0; Widget _weNeedItOnlyOnce() { print('_weNeedItOnlyOnce'); return Padding( padding: EdgeInsets.all(32), child: Text('Просто немного текста'), ); } @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.all(32), child: Column( children: [ FlatButton( child: Text('Счетчик: $_counter'), onPressed: () { setState(() { _counter++; }); }, ), _weNeedItOnlyOnce(), const WeNeedItOnlyOnce(), ], )); } } class WeNeedItOnlyOnce extends StatelessWidget { const WeNeedItOnlyOnce(); @override Widget build(BuildContext context) { print('WeNeedItOnlyOnce'); return Padding( padding: EdgeInsets.all(32), child: Text('Просто немного текста 2'), ); } }