Set Min Width and Min Height of a Container

In some cases, you may need to set a minimum width and height for a Container. These examples will show you how to do this using the minWidth and minHeight properties of the Container widget to limit the padding within a Container.

BoxConstraints is the class which defines min and max size for box layout.

Container(
          color: Colors.orange,
          constraints: BoxConstraints(
              minHeight: 200, minWidth: double.infinity),
          child: ListView(
            shrinkWrap: true,
            children: [
              ...List.generate(
                100,  
                (index) => Text(
                  'Text: ${index}'
                ),
              ),
            ],
          ),
        )
@override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.fromLTRB(0, 8.0, 0, 8.0),
      child: Container(
        padding: const EdgeInsets.all(8.0),
        decoration: BoxDecoration(
            color: MyTheme.cardColor,
            border: Border.all(
              color: MyTheme.cardColor,
            ),
            borderRadius: MyTheme.radius),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Expanded(
              flex: 9,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  RowField(
                      left: LabelValue(
                          label: "Qty",
                          value: _showQty(stockQuant!.purchase_qty,
                              stockQuant!.purchase_uom[1])),
                      right: LabelValue(
                          label: "Loose Qty",
                          value: _showQty(stockQuant!.loose_qty,
                              stockQuant!.product_uom[1])),
                      flexes: [5, 5]),
                  RowField(
                      left: LabelValue(
                          label: "Location", value: stockQuant!.location_id[1]),
                      right: LabelValue(
                          label: "Lot", value: stockQuant!.lot_id[1]),
                      flexes: [5, 5]),
                ],
              ),
            ),
            Expanded(child: IconButton(onPressed: () {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => ProductMovePage(product: product, stockQuant: stockQuant)),
              );
            }, icon: Icon(Icons.add_task , color: MyTheme.highlightColor)), flex: 1)
          ],
        ),
      ),
    );
  }

Similar Posts

  • Monetization Packages

    google_mobile_ads Google Mobile Ads may use the Flutter plugin, which supports banner, interstitial (full-screen), rewarded and native advertisements. unity_ads_plugin The Unity Ads plugin for Flutter Applications is a mobile game advertising platform. This plugin can show both Unity Banner Ads and Unity Video Ads. appodeal_flutter Appodeal is a Flutter plugin that displays advertisements on the…

  • Picture-in-Picture Packages

    A Picture-in-Picture (PIP) is a small, frame that floats out of the main video and stays on top of it. It can be used to display anything like: Knowing the different purposes behind PIP will help you understand which package suits your needs best. flutter_android_pip With the SDK 24 or above, you may integrate Picture-in-Picture…

  • Floating Action Button Packages

    simple_speed_dial A simple Flutter speed dial. You may add as many speed dial alternatives as you wish. Labels may be added beside the options. Every FAB’s color can be customized. draggable_fab The FAB wrapper widget may be dragged to any edge of the screen and is draggable. curved_nav_bar The left and right side of the…

  • Rich Text Editors

    flutter_markdown This package is a Markdown editor for Flutter. From plain text data formatted with simple Markdown tags, you may produce rich text output including text styles, tables, links, and more. markdown markdown is a Dart library that can convert Markdown to HTML. zefyr Flutter’s clean, minimalistic, and collaboration-ready rich text editor. zefyrka This editor…

  • Clipboard Packages

    A clipboard is one of the most important tools for a mobile phone user. A clipboard is a place where you can store information that you need quick access to or from. You can use those items to copy and paste them into a word processor, mail, chat program, or other function. clipboard This is…