title: Most elegant/efficient way to refactor widgets in Flutter and Dart
body: <p>Searching online on "how to refactor Flutter widgets" I found that there exist two possible ways that are both functioning as per my testing, still very different from a structural standpoint. The second method, indeed includes and additional building instruction, which should bring a further burden on the app performances right?</p>
  
  <p>This is the code I want to refactor:</p>
  
  <pre><code>Container(
      child: Column(
          children: &lt;Widget&gt; [
              [long code to create a button with many properties],
              [long code to create a button with many properties],
              [long code to create a button with many properties],
              [long code to create a button with many properties],
          ],),);
  </code></pre>
  
  <p>These are the main ways I found:</p>
  
  <p>1):</p>
  
  <pre><code>Widget MyButton(Color color, String text) {
      return [long code to create a button with many properties];
  }
  </code></pre>
  
  <p>2):</p>
  
  <pre><code>class MyButton extends StatelessWidget {
      MyButton(this.color, this.text);
  
      final Color color;
      final String text;
  
      @override
      Widget build(BuildContext context) {
          return [long code to create a button with many properties];
      }
  }
  </code></pre>
  
  <p><strong>Which is the best method?</strong></p>