2022年10月28日星期五

flutter web XMLHttpRequest error

 1- Go to flutter\bin\cache and remove a file named: flutter_tools.stamp

2- Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart.

3- Find '--disable-extensions'

4- Add '--disable-web-security'

change android package name / bundle id



EDITED : 27-Dec-18

for package name just change in build build.gradle only

defaultConfig {
    applicationId "your.package.name"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

2022年10月14日星期五

flutter_html customRender custom Widget custom tag

 Widget html = Html(

  data: """
  <h3>Display bird element and flutter element <bird></bird></h3>
  <flutter></flutter>
  <flutter horizontal></flutter>
  """,
  customRender: {
      "bird": (RenderContext context, Widget child) {
        return TextSpan(text: "🐦");
      },
      "flutter": (RenderContext context, Widget child) {
        return FlutterLogo(
          style: (context.tree.element!.attributes['horizontal'] != null)
              ? FlutterLogoStyle.horizontal
              : FlutterLogoStyle.markOnly,
          textColor: context.style.color!,
          size: context.style.fontSize!.size! * 5,
        );
      },
    },
  tagsList: Html.tags..addAll(["bird", "flutter"]),
);

flutter_html - Remove Flutter HTML widget's default padding

 Html(

  data: newsVM.newsDetailResponse.data
.news.description,
style: {
"body": Style(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
)
},
),