Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何使代码看起来像图像?_Flutter_Dart - Fatal编程技术网

Flutter 如何使代码看起来像图像?

Flutter 如何使代码看起来像图像?,flutter,dart,Flutter,Dart,我目前正在做一个项目,对Flitter来说是个新手。我发现很难实现这种前景。如果您有任何帮助,我们将不胜感激。这是一个应用程序的头,这是我到目前为止所做的。多谢各位 class HeaderWiget extends StatelessWidget { final Color colors = Colors.amber; return Container( Colors: colors, padding: const EdgeInsets.only(

我目前正在做一个项目,对Flitter来说是个新手。我发现很难实现这种前景。如果您有任何帮助,我们将不胜感激。这是一个应用程序的头,这是我到目前为止所做的。多谢各位

class HeaderWiget extends StatelessWidget {
  final Color colors = Colors.amber;
return Container(
      Colors: colors, 
      padding: const EdgeInsets.only(
        top: 30,
        bottom: 10,
        left: 20,
        right: 20,
      ),
      decoration: BoxDecoration(
        color: CustomColor.uplanitBlue,
      ),
      child: Row(
        children: [`enter code here`
          Column(
            children: [
              Text('What do you do?',
                  style: GoogleFonts.workSans(
                    fontSize: 28,
                    fontWeight: FontWeight.w500,
                  )),
              Text('You can select multiple options',
                  style: GoogleFonts.workSans(
                    fontSize: 16,
                    fontWeight: FontWeight.w400,
                  ))
            ],
          ),
          FlatButton(
            onPressed: () {},
            child: Text(
              'Skip',
              style: GoogleFonts.workSans(
                color: Colors.white,
                decoration: TextDecoration.underline,
                fontSize: 16,
                fontWeight: FontWeight.w400,
              ),
            ),
          ),
        ],
      ),
    );
}

试试这段代码

 class HeaderWiget extends StatelessWidget {
      
        return Container(
           width: MediaQuery.of(context).size.width,
           height: 100,
           decoration: BoxDecoration(
             color: CustomColor.uplanitBlue,
             ),
           child: Column(
               mainAxisAlignment: MainAxisAlignment.center,
               crossAxisAlignment: CrossAxisAlignment.center,
               children: [
               Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                Column(
                    children: [
                    Text('What do you do?',
                       style: GoogleFonts.workSans(
                         fontSize: 28,
                         fontWeight: FontWeight.w500,
                         )),
                    Text('You can select multiple options',
                       style: GoogleFonts.workSans(
                         fontSize: 16,
                         fontWeight: FontWeight.w400,
                         ))
                    ],
                    ),
                FlatButton(
                    onPressed: () {},
                    child: Text(
                      'Skip',
                      style: GoogleFonts.workSans(
                        color: Colors.white,
                        decoration: TextDecoration.underline,
                        fontSize: 16,
                        fontWeight: FontWeight.w400,
                        ),
                      ),
                    ),
                ],
                ),
               ],
               ),
           );
    }

您可以使用以下代码:

class HeaderWiget extends StatelessWidget {
  final Color colors = Colors.amber;
return Container(
  padding: const EdgeInsets.only(
    top: 30,
    bottom: 10,
    left: 20,
    right: 20,
  ),
  decoration: BoxDecoration(
    color: CustomColor.uplanitBlue,
  ),
  child: Row(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Text('What do you do?',
              style: GoogleFonts.workSans(
                fontSize: 28,
                fontWeight: FontWeight.w500,
              )),
          Text('You can select multiple options',
              style: GoogleFonts.workSans(
                fontSize: 16,
                fontWeight: FontWeight.w400,
              ))
        ],
      ),
      FlatButton(
        onPressed: () {},
        child: Text(
          'Skip',
          style: GoogleFonts.workSans(
            color: Colors.white,
            decoration: TextDecoration.underline,
            fontSize: 16,
            fontWeight: FontWeight.w400,
          ),
        ),
      ),
    ],
  ),
);
}

非常感谢你。这对我来说非常有效