@@ -3,69 +3,67 @@ import 'package:flutter/material.dart';
33
44import 'camera_preview.dart' ;
55
6- void main () => runApp (
7- MyApp (),
8- );
6+ void main () => runApp (const MyApp ());
97
108class MyApp extends StatelessWidget {
9+ const MyApp ({Key ? key}) : super (key: key);
10+
1111 @override
1212 Widget build (BuildContext context) {
13- return MaterialApp (
13+ return const MaterialApp (
1414 title: "Draggable Home" ,
1515 home: HomePage (),
1616 );
1717 }
1818}
1919
2020class HomePage extends StatelessWidget {
21+ const HomePage ({Key ? key}) : super (key: key);
22+
2123 @override
2224 Widget build (BuildContext context) {
2325 return DraggableHome (
24- leading: Icon (Icons .arrow_back_ios),
25- title: Text ("Draggable Home" ),
26+ leading: const Icon (Icons .arrow_back_ios),
27+ title: const Text ("Draggable Home" ),
2628 actions: [
27- IconButton (onPressed: () {}, icon: Icon (Icons .settings)),
29+ IconButton (onPressed: () {}, icon: const Icon (Icons .settings)),
2830 ],
2931 headerWidget: headerWidget (context),
3032 headerBottomBar: headerBottomBarWidget (),
3133 body: [
3234 listView (),
3335 ],
3436 fullyStretchable: true ,
35- expandedBody: CameraPreview (),
37+ expandedBody: const CameraPreview (),
3638 );
3739 }
3840
39- Container headerBottomBarWidget () {
40- return Container (
41- child: Row (
42- mainAxisSize: MainAxisSize .max,
43- mainAxisAlignment: MainAxisAlignment .end,
44- crossAxisAlignment: CrossAxisAlignment .center,
45- children: [
46- Icon (
47- Icons .settings,
48- color: Colors .white,
49- ),
50- ],
51- ),
41+ Row headerBottomBarWidget () {
42+ return Row (
43+ mainAxisSize: MainAxisSize .max,
44+ mainAxisAlignment: MainAxisAlignment .end,
45+ crossAxisAlignment: CrossAxisAlignment .center,
46+ children: const [
47+ Icon (
48+ Icons .settings,
49+ color: Colors .white,
50+ ),
51+ ],
5252 );
5353 }
5454
55- Container headerWidget (BuildContext context) => Container (
56- child: Center (
57- child: Text ("Title" ,
58- style: Theme .of (context)
59- .textTheme
60- .headline2!
61- .copyWith (color: Colors .white70)),
62- ),
55+ Widget headerWidget (BuildContext context) => Center (
56+ child: Text ("Title" ,
57+ style: Theme .of (context)
58+ .textTheme
59+ .headline2!
60+ .copyWith (color: Colors .white70)),
6361 );
6462
6563 ListView listView () {
6664 return ListView .builder (
67- padding: EdgeInsets .only (top: 0 ),
68- physics: NeverScrollableScrollPhysics (),
65+ padding: const EdgeInsets .only (top: 0 ),
66+ physics: const NeverScrollableScrollPhysics (),
6967 itemCount: 20 ,
7068 shrinkWrap: true ,
7169 itemBuilder: (context, index) => Card (
@@ -74,8 +72,8 @@ class HomePage extends StatelessWidget {
7472 leading: CircleAvatar (
7573 child: Text ("$index " ),
7674 ),
77- title: Text ("Title" ),
78- subtitle: Text ("Subtitile" ),
75+ title: const Text ("Title" ),
76+ subtitle: const Text ("Subtitile" ),
7977 ),
8078 ),
8179 );
0 commit comments