如何在Flutter中添加垂直分隔线?

时间:2020-02-21 19:15:20

标签: flutter dart

我想将我的集装箱垂直分为两半,一面展示硬币,另一面展示票。我在某种程度上已经能够实现这一目标,但是当我尝试在其下面添加Text()时,我的所有约束都弄糟了。这是我所说容器的代码。

      Padding( 
                padding: const EdgeInsets.only(left: 8, right: 8, top: 15.0),
                child: Container(
                  decoration: BoxDecoration(
                    borderRadius: const BorderRadius.all(Radius.circular(16.0)),
                  ),
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(15.0),
                    child: Container(
                      decoration: BoxDecoration(
                        borderRadius:
                            const BorderRadius.all(Radius.circular(16.0)),
                        gradient: LinearGradient(
                          colors: [
                            const Color(0xFFFF8C3B),
                            const Color(0xFFFE524B)
                          ],
                          begin: Alignment.centerLeft,
                          end: Alignment.centerRight,
                        ),
                      ),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          SizedBox(
                            height: 5.0,
                          ),
                          Padding(
                            padding:
                                const EdgeInsets.symmetric(horizontal: 15.0),
                            child: Column(
                              // crossAxisAlignment: CrossAxisAlignment.stretch,
                              children: <Widget>[
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: <Widget>[
                                    Padding(
                                      padding:
                                          const EdgeInsets.only(bottom: 18.0),
                                      child: ClipRRect(
                                        borderRadius: BorderRadius.circular(5),
                                        child: Text(
                                          "Coins",
                                          style: TextStyle(
                                            fontFamily: "Netflix",
                                            fontWeight: FontWeight.w600,
                                            fontSize: 20,
                                            letterSpacing: 0.27,
                                            color: Colors.white,
                                          ),
                                        ),
                                      ),
                                    ),
                                    Container(
                                      height: 60.0,
                                      width: 2.0,
                                      color: Colors.white,
                                      margin: const EdgeInsets.only(
                                          top: 8, left: 60.0, right: 60.0),
                                    ),
                                    Column(
                                      children: <Widget>[
                                        Padding(
                                          padding: const EdgeInsets.only(
                                              bottom: 18.0),
                                          child: ClipRRect(
                                            borderRadius:
                                                BorderRadius.circular(5),
                                            child: Text(
                                              "Tickets",
                                              style: TextStyle(
                                                fontFamily: "Netflix",
                                                fontWeight: FontWeight.w600,
                                                fontSize: 20,
                                                letterSpacing: 0.27,
                                                color: Colors.white,
                                              ),
                                            ),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ],
                                ),

                              ],
                            ),
                          ),
                          SizedBox(
                            height: 15.0,
                          ),
                          Container(
                            decoration: BoxDecoration(
                              gradient: LinearGradient(
                                colors: [
                                  const Color(0xFFFF8C3B),
                                  const Color(0xFFFE524B)
                                ],
                                begin: Alignment.centerLeft,
                                end: Alignment.centerRight,
                              ),
                            ),
                          )
                        ],
                      ),
                    ),
                  ),
                ),
              ),

请帮助我,因为我是Flutter的新手,这将为您带来很多帮助……非常感谢!

1 个答案:

答案 0 :(得分:2)

您可以执行以下操作:

with open(file_name, 'r') as in_file:
    csv_lines = in_file.splitlines()

# Separate header from rest
headers, lines = csv_lines[0], csv_lines[1:]

for line in lines:
    print(csv_values(line))

实际结果如下:

Flutter Divider