title: Flutter: Using Center widget overrides min width
body: <p>I want to center some text inside of a container. The container has min/maxWidth constraints. However, when I wrap the text with a Center, the container will max out its width no matter the length of the text. When there is less/no text, the container width does not shrink down to its min size.</p>
  <p>Here is the code</p>
  <pre class="lang-dart prettyprint-override"><code>import 'package:flutter/material.dart';
  import './constants.dart';
  
  void main() {
    runApp(ProviderScope(child: MyApp()));
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Home(),
        debugShowCheckedModeBanner: false,
      );
    }
  }
  
  class Home extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      devHeight = MediaQuery.of(context).size.height; //from constants.dart
      devWidth = MediaQuery.of(context).size.width; //from constants.dart
  
      return Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.greenAccent,
        ),
        body: Container(
          color: Colors.blueGrey[400],
          child: Column(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              MyCard(),
            ],
          ),
        ),
      );
    }
  }
  
  class MyCard extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Card(
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(devHeight * 0.03),
        ),
        elevation: 3,
        child: Column(
          children: [
            Row(
              children: [
                Padding(
                  padding: const EdgeInsets.all(4),
                  child: Container(
                    height: devHeight * 0.05,
                    decoration: BoxDecoration(
                      color: Colors.greenAccent,
                      border: Border.all(),
                      borderRadius: BorderRadius.circular(99999),
                    ),
                    constraints: BoxConstraints(
                      minWidth: 100,
                      maxWidth: 200,
                    ),
                    child: Padding(
                      padding: const EdgeInsets.all(2),
                      child: Center(
                        child: Text(
                          'asdf asdf'.toUpperCase(),
                          style: TextStyle(
                            fontWeight: FontWeight.bold,
                          ),
                          maxLines: 1,
                          textAlign: TextAlign.center,
                          overflow: TextOverflow.ellipsis,
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            )
          ],
        ),
      );
    }
  }
  
  </code></pre>
  <p>Wrapping the Text with Align instead of center also doesn't work, and neither does adding an alignment property to the container.</p>