Explorar el Código

Extract nested widget to a separate method

vishnukvmd hace 3 años
padre
commit
1b27724267
Se han modificado 1 ficheros con 28 adiciones y 24 borrados
  1. 28 24
      lib/ui/deduplicate_page.dart

+ 28 - 24
lib/ui/deduplicate_page.dart

@@ -92,30 +92,7 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
           child: ListView.builder(
             itemBuilder: (context, index) {
               if (index == 0) {
-                return Padding(
-                  padding: EdgeInsets.fromLTRB(16, 12, 16, 8),
-                  child: Column(
-                    children: [
-                      Text(
-                        "the following files were clubbed based on their sizes and creation times",
-                        style: TextStyle(
-                          color: Colors.white.withOpacity(0.6),
-                          height: 1.2,
-                        ),
-                      ),
-                      Padding(
-                        padding: EdgeInsets.all(4),
-                      ),
-                      Text(
-                        "please review and delete the items you believe are duplicates",
-                        style: TextStyle(
-                          color: Colors.white.withOpacity(0.6),
-                          height: 1.2,
-                        ),
-                      ),
-                    ],
-                  ),
-                );
+                return _getHeader();
               }
               return Padding(
                 padding: const EdgeInsets.only(top: 10, bottom: 10),
@@ -133,6 +110,33 @@ class _DeduplicatePageState extends State<DeduplicatePage> {
     );
   }
 
+  Padding _getHeader() {
+    return Padding(
+      padding: EdgeInsets.fromLTRB(16, 12, 16, 8),
+      child: Column(
+        children: [
+          Text(
+            "the following files were clubbed based on their sizes and creation times",
+            style: TextStyle(
+              color: Colors.white.withOpacity(0.6),
+              height: 1.2,
+            ),
+          ),
+          Padding(
+            padding: EdgeInsets.all(4),
+          ),
+          Text(
+            "please review and delete the items you believe are duplicates",
+            style: TextStyle(
+              color: Colors.white.withOpacity(0.6),
+              height: 1.2,
+            ),
+          ),
+        ],
+      ),
+    );
+  }
+
   Widget _getDeleteButton() {
     String text;
     if (_selectedFiles.isEmpty) {