@@ -10,10 +10,7 @@ class TouchScreen extends StatefulWidget {
1010
1111class _TouchScreenState extends State <TouchScreen > {
1212 Map <Color , int > _counters = Colors .primaries.asMap ().map (
13- (key, value) => MapEntry (
14- value,
15- 0 ,
16- ),
13+ (key, value) => MapEntry (value, 0 ),
1714 );
1815
1916 bool forceAndroid = false ;
@@ -29,9 +26,7 @@ class _TouchScreenState extends State<TouchScreen> {
2926 @override
3027 Widget build (BuildContext context) {
3128 return Scaffold (
32- appBar: AppBar (
33- title: Text ('Touch' ),
34- ),
29+ appBar: AppBar (title: Text ('Touch' )),
3530 body: Center (
3631 child: ListView (
3732 children: [
@@ -67,33 +62,24 @@ class _TouchScreenState extends State<TouchScreen> {
6762 Text ('Is Dark' ),
6863 ],
6964 ),
70- Center (
71- child: Text (
72- 'You have pushed the buttons this many times:' ,
73- ),
74- ),
75- ..._counters.entries.map (
76- (entry) {
77- final color = entry.key;
78- final count = entry.value;
79- return Center (
80- child: TouchFeedBack (
81- onTapped: () {},
82- child: Text (
83- '0x${color .toARGB32 ().toRadixString (16 ).padLeft (8 , '0' )}: $count ' ,
84- style: Theme .of (context)
85- .textTheme
86- .headlineMedium!
87- .copyWith (color: color),
88- ),
65+ Center (child: Text ('You have pushed the buttons this many times:' )),
66+ ..._counters.entries.map ((entry) {
67+ final color = entry.key;
68+ final count = entry.value;
69+ return Center (
70+ child: TouchFeedBack (
71+ onTapped: () {},
72+ child: Text (
73+ '0x${color .toARGB32 ().toRadixString (16 ).padLeft (8 , '0' )}: $count ' ,
74+ style: Theme .of (
75+ context,
76+ ).textTheme.headlineMedium! .copyWith (color: color),
8977 ),
90- );
91- },
92- ),
78+ ),
79+ );
80+ } ),
9381 const SizedBox (height: 16 ),
94- Center (
95- child: _createButtons (_counters),
96- ),
82+ Center (child: _createButtons (_counters)),
9783 const SizedBox (height: 16 ),
9884 Padding (
9985 padding: EdgeInsets .all (16 ),
@@ -103,19 +89,13 @@ class _TouchScreenState extends State<TouchScreen> {
10389 TouchFeedBack (
10490 forcePlatform: _forcePlatform,
10591 onTapped: () {},
106- child: Icon (
107- Icons .plus_one,
108- size: 32 ,
109- ),
92+ child: Icon (Icons .plus_one, size: 32 ),
11093 ),
11194 const SizedBox (width: 8 ),
11295 TouchFeedBack (
11396 forcePlatform: _forcePlatform,
11497 onTapped: () {},
115- child: Text (
116- 'Tap me' ,
117- style: TextStyle (fontSize: 20 ),
118- ),
98+ child: Text ('Tap me' , style: TextStyle (fontSize: 20 )),
11999 ),
120100 const SizedBox (width: 8 ),
121101 ],
@@ -160,12 +140,11 @@ class _TouchScreenState extends State<TouchScreen> {
160140 color: counters.entries.first.key,
161141 padding: const EdgeInsets .all (16 ),
162142 child: _createButtons (
163- counters.entries.skip (1 ).toList ().asMap ().map (
164- (key, value) => MapEntry (
165- value.key,
166- value.value,
167- ),
168- ),
143+ counters.entries
144+ .skip (1 )
145+ .toList ()
146+ .asMap ()
147+ .map ((key, value) => MapEntry (value.key, value.value)),
169148 ),
170149 ),
171150 );
0 commit comments