@@ -23,40 +23,31 @@ class ViewHeaderCustomization extends StatefulWidget {
2323 _ViewHeaderCustomizationState ();
2424}
2525
26- List <String > _days = < String > ['S' , 'M' , 'T' , 'W' , 'T' , 'F' , 'S' ];
27- List <Icon > _icons = < Icon > [
28- Icon (
29- Icons .ac_unit,
30- color: Colors .black,
31- ),
32- Icon (Icons .wb_sunny, color: Colors .amber),
33- Icon (
34- Icons .wb_incandescent,
35- color: Color (0xFF0ba0000 ),
36- ),
37- Icon (Icons .wb_auto, color: Colors .orange),
38- Icon (Icons .wb_cloudy, color: Colors .grey),
39- Icon (Icons .wb_sunny, color: Colors .amber),
40- Icon (
41- Icons .wb_incandescent,
42- color: Color (0xFF0ba0000 ),
43- )
44- ];
45-
4626class _ViewHeaderCustomizationState extends State <ViewHeaderCustomization > {
47- double _width, _cellWidth;
48-
49- @override
50- void initState () {
51- _width = 0.0 ;
52- _cellWidth = 0.0 ;
53- super .initState ();
54- }
27+ final List <String > _days = < String > ['S' , 'M' , 'T' , 'W' , 'T' , 'F' , 'S' ];
28+ final List <Icon > _icons = < Icon > [
29+ Icon (
30+ Icons .ac_unit,
31+ color: Colors .black,
32+ ),
33+ Icon (Icons .wb_sunny, color: Colors .amber),
34+ Icon (
35+ Icons .wb_incandescent,
36+ color: Color (0xFF0ba0000 ),
37+ ),
38+ Icon (Icons .wb_auto, color: Colors .orange),
39+ Icon (Icons .wb_cloudy, color: Colors .grey),
40+ Icon (Icons .wb_sunny, color: Colors .amber),
41+ Icon (
42+ Icons .wb_incandescent,
43+ color: Color (0xFF0ba0000 ),
44+ )
45+ ];
5546
5647 @override
5748 Widget build (BuildContext context) {
58- _width = MediaQuery .of (context).size.width;
59- _cellWidth = _width / 9 ;
49+ final double width = MediaQuery .of (context).size.width;
50+ final double cellWidth = width / 9 ;
6051
6152 return Scaffold (
6253 body: SafeArea (
@@ -68,8 +59,8 @@ class _ViewHeaderCustomizationState extends State<ViewHeaderCustomization> {
6859 scrollDirection: Axis .horizontal,
6960 itemBuilder: (BuildContext ctxt, int index) {
7061 return Container (
71- padding: const EdgeInsets .only (left: 15 ,top: 5 ),
72- width: _cellWidth ,
62+ padding: const EdgeInsets .only (left: 15 , top: 5 ),
63+ width: cellWidth ,
7364 height: 5 ,
7465 color: Colors .lightGreen,
7566 child: Text (_days[index]),
@@ -82,7 +73,7 @@ class _ViewHeaderCustomizationState extends State<ViewHeaderCustomization> {
8273 itemBuilder: (BuildContext ctxt, int index) {
8374 return Container (
8475 padding: const EdgeInsets .only (left: 5 ),
85- width: _cellWidth ,
76+ width: cellWidth ,
8677 child: _icons[index],
8778 );
8879 }),
0 commit comments