颤振布局-3列

时间:2020-05-06 20:47:21

标签: flutter flutter-layout

我正在尝试创建与附件图像相似的简历文档。需要有关顶层布局的帮助

会是:

container

   children

      column widget

          children

              container (header)

              container (body)

                 children

                     column

                        children

                           row (education)

                           row (experience)

还有,我将如何获得虚线?

感谢您的帮助

enter image description here

2 个答案:

答案 0 :(得分:0)

应该是:

container

   children

      column widget

          children

              container (header)

              container (body)

                 child

                     row

                        children

                           column (education)

                           column (experience)

对于破折号行,您可以使用以下插件Flutter Dash

另一种选择是:

column widget

     children

          Row (header)

          Row (body)

             children

                column (education)

                column (experience)

要在主体部分中获得准确的布局,您可能希望使用Expanded小部件来实现所需的内容。

column widget

     children

          Row (header)

          Row (body)

             children

                Expanded [Flex 1]

                     child

                           Container (education)

                Expanded [Flex 2]

                     child

                           Container (experience)

要让Dash工作:

您需要在pubspec.yaml中的flutter_dash: ^0.0.1下添加dependencies

import 'package:flutter/material.dart';
import 'package:flutter_dash/flutter_dash.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      routes: {
        '/': (BuildContext context) => MyApp2(),
      },
    );
  }
}

class MyApp2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Row(
          children: <Widget>[
            Container(
              height: MediaQuery.of(context).size.height / 3,
            )
          ],
        ),
        Dash(
            direction: Axis.horizontal,
            length: MediaQuery.of(context).size.width,
            dashLength: 12,
            dashColor: Colors.red),
        Row(
          children: <Widget>[
            Expanded(
              child: Text('Education'),
              flex: 1,
            ),
            Dash(
                direction: Axis.vertical,
                length: (2 *MediaQuery.of(context).size.height) / 3 - MediaQuery.of(context).padding.top,
                dashLength: 12,
                dashColor: Colors.red),
            Expanded(
              child: Text('Experience'),
              flex: 2,
            ),
          ],
        ),
      ],
    );
  }
}

答案 1 :(得分:0)

您也可以尝试以下方法:

/// <summary>
/// Allows to apply regex-replace operations to the same string.
/// For example:
/// SELECT dbo.ReplaceAgg(t.[text], w.badpattern, "...") 
/// FROM [Texts] t CROSS JOIN BadPatterns w
/// GROUP BY t.[text]
/// </summary>
[Serializable]
[Microsoft.SqlServer.Server.SqlUserDefinedAggregate(Format.UserDefined, 
    IsInvariantToDuplicates = true, IsInvariantToOrder = false, 
    IsInvariantToNulls = true, MaxByteSize = -1)]
public class RegexReplaceAgg : IBinarySerialize
{
    private string str;
    private string needle;
    private string replacement;
    public void Init()
    {
        str = null;
        needle = null;
        replacement = null;
    }
    public void Accumulate(SqlString haystack, SqlString needle, SqlString replacement)
    {
        // Null values are excluded from aggregate.
        if (needle.IsNull) return;
        if (replacement.IsNull) return;
        if (haystack.IsNull) return;
        str = str ?? haystack.Value;
        this.needle = needle.Value;
        this.replacement = replacement.Value;
        str = Regex.Replace(str, this.needle, this.replacement, RegexOptions.Compiled | RegexOptions.CultureInvariant);
    }

    public void Merge(RegexReplaceAgg group)
    {
        Accumulate(group.Terminate(), new SqlString(needle), new SqlString(replacement));
    }

    public SqlString Terminate() => new SqlString(str);

    public void Read(BinaryReader r)
    {
        str = r.ReadString();
        needle = r.ReadString();
        replacement = r.ReadString();
    }

    public void Write(BinaryWriter w)
    {
        w.Write(str);
        w.Write(needle);
        w.Write(replacement);
    }
}