title: Best way to programmatically return widget wrapped by a parent widget
body: <p>I wan't to disable iOS dynamic type completely for my Flutter app as it completely destroys some of my layouts when the user sets the global text size too high.</p>
  
  <p>I asked the question on how to accomplish this <a href="https://github.com/flutter/flutter/issues/25587" rel="nofollow noreferrer">here</a> and got this answer that I would like to implement.</p>
  
  <pre><code>return MediaQuery(
    child: your-widget-here,
    data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
  );
  </code></pre>
  
  <p>Just curious about the best way to implement that using DRY principles so that I can re-use it throughout my code. At the moment, I have simply created a Utils class written a method like so</p>
  
  <pre><code>Widget unscaledWidget(Widget widget, BuildContext context){
    return MediaQuery(
      child: widget,
        data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
    );
  }
  </code></pre>
  
  <p>and then in the build methods of the pages in my app instead of calling</p>
  
  <pre><code>return Scaffold(...);
  </code></pre>
  
  <p>doing</p>
  
  <pre><code>Scaffold scaf = Scaffold(...);
  return Utils().unscaledWidget(scaf, context);
  </code></pre>
  
  <p>Is there a better way I should be accomplishing this? Just not sure this is Dart best practice.</p>