简体   繁体   English

使用 android studio 运行颤振应用程序时出现意外的双文本和黄线

[英]Unexpected double text and yellow lines running a flutter app with android studio

I got no errors, but I don't know why I'm facing double text to the left side, this is what I mean我没有错误,但我不知道为什么我面对左侧的双文字,这就是我的意思在此处输入图像描述

So, how to delete the unnecessary numbers to the left side, and why I have these yellow lines below?那么,如何删除左侧不必要的数字,为什么下面有这些黄线?

I tried uninstalling the application and running it again to see if this can solve the issue but no luck我尝试卸载该应用程序并再次运行它以查看这是否可以解决问题但没有运气

This is my code:这是我的代码:

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

class LineTitles {
  static GetTitleData() => FlTitlesData(
      show: true,
      bottomTitles: AxisTitles(
        sideTitles: SideTitles(
            showTitles: true,
            reservedSize: 35,
            getTitlesWidget: (value, meta) {
              switch (value.toInt()) {
                case 2:
                  return Text(
                    'MAR',
                    style: TextStyle(
                      color: Color(0xff68737d),
                      fontWeight: FontWeight.bold,
                      fontSize: 16,
                    ),
                  );
                case 5:
                  return Text(
                    'JUN',
                    style: TextStyle(
                      color: Color(0xff68737d),
                      fontWeight: FontWeight.bold,
                      fontSize: 16,
                    ),
                  );
                case 8:
                  return Text('SEP',
                      style: TextStyle(
                        color: Color(0xff68737d),
                        fontWeight: FontWeight.bold,
                        fontSize: 16,
                      ));
              }
              return Text(" ");
            }),

      ),
      leftTitles: AxisTitles(
          sideTitles: SideTitles(
              showTitles: true,
              reservedSize: 35,
              getTitlesWidget: (value, meta) {
                switch (value.toInt()) {
                  case 1:
                    return Text(
                      '10k',
                      style: TextStyle(
                        color: Color(0xff68737d),
                        fontWeight: FontWeight.bold,
                        fontSize: 15,
                      ),
                    );
                  case 3:
                    return Text(
                      '30k',
                      style: TextStyle(
                        color: Color(0xff68737d),
                        fontWeight: FontWeight.bold,
                        fontSize: 15,
                      ),
                    );
                  case 5:
                    return Text('50k',
                        style: TextStyle(
                          color: Color(0xff68737d),
                          fontWeight: FontWeight.bold,
                          fontSize: 15,
                        )
                    );

                }
                return Text(" ");
              },

          )));
}

Thank you in advance先感谢您

Your screen must have a Scaffold as a root widget, the screen you are rendering the chart in, grap what's inside the build function您的屏幕必须有一个Scaffold作为根小部件,您要在其中呈现图表的屏幕,掌握build功能中的内容

return Scaffold(
    body: //paste here,
);

You have to wrap your code in a Material() Widget,您必须将代码包装在Material()小部件中,

could be:可能:

1- 1-

Material( child: YOUR_WIDGET_HERE);

2- 2-

Scaffold(body: YOUR_WIDGET_HERE);

This happens because your Widget should have a Material() Widget as parent, in the Widget Tree发生这种情况是因为您的 Widget 在 Widget Tree 中应该有一个 Material() Widget 作为父级

Use Scaffold as your parent widget.使用Scaffold作为您的父小部件。

Scaffold(
  body: ///rest of your widgets here
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM