Flutter - Vertical Divider

后端 未结 10 2032
再見小時候
再見小時候 2021-01-01 08:37

In flutter, is there an option to draw a vertical line between components as in the image.

相关标签:
10条回答
  • 2021-01-01 09:10

    add this method anywhere.

      _verticalDivider() => BoxDecoration(
          border: Border(
            right: BorderSide(
              color: Theme.of(context).dividerColor,
              width: 0.5,
            ),
          ),
        );
    

    now wrap your content in container

    Container(
      decoration: _verticalDivider(),
      child: //your widget code
    );
    
    0 讨论(0)
  • 2021-01-01 09:14
    import 'package:flutter/material.dart';
    class VerticalDivider extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Container(
          height: 30.0,
          width: 1.0,
          color: Colors.white30,
          margin: const EdgeInsets.only(left: 10.0, right: 10.0),
        );
      }
    }
    
    0 讨论(0)
  • 2021-01-01 09:15

    You can use a vertical divider with a thickness of 1.

              VerticalDivider(
                thickness: 1,
                color: Color(0xFFF6F4F4),
              ),
    

    And if you can't se the vertical divider wrap the row a IntrinsicHeight widget.

    0 讨论(0)
  • 2021-01-01 09:21

    Try to wrap it inside the Container with some height as

    Container(height: 80, child: VerticalDivider(color: Colors.red)),
    
    0 讨论(0)
提交回复
热议问题