How to solve this. In flutter i have imported the import 'package:webview_flutter/webview_flutter.dart';
package but still the WebView is showing error :
The method 'WebView isn't defined for the type' Article PageState.:39
Related
I have a question about a reusable font awesome widget for Flutter that I am trying to create.
I am getting an error in Android Studio for Windows that, "The method 'FaIcon' isn't defined for the type 'IconContent'."
Below is how I set up the reusable widget. I found this advice but not sure how to implement: "Use the FaIcon Widget + FontAwesomeIcons class for the IconData"
https://gist.github.com/countrymusicfy/3c5aa155063b49bf5d07e89241bc637b
Any suggestions would be greatly appreciated!
You are missing import statement
You should include both in pubspec.yaml file and in your dart file.
Add import statement on your dart file
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Add dependecy on your pubspec.yaml
dependencies:
font_awesome_flutter: ^9.1.0
How to disable screenshot in flutter? I have Kotlin file instead of MainActivity.java file. Please suggest full code with path where I need to change for disable screenshot in my app.
package com.quotster.untitled
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
If you want to do that in Android only you can use flutter_windowmanager and add FLAG_SECURE.
await FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE);
In my flutter app, it supports the kotlin for android part. i can't find a code to prevent the screeenshot in app which is written in kotlin language. I searched over the google then i found the code that is written in java language but i require the kotlin code to prevent the screenshot.
package com.example.schoolbells
import io.flutter.embedding.android.FlutterActivity
import android.os.Bundle;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.FlutterEngine;
import android.view.WindowManager.LayoutParams;
class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,WindowManager.LayoutParams.FLAG_SECURE);
}
}
getting this error in onCreate method
[ERROR] :Unresolved reference: WindowManagerkotlin(UNRESOLVED_REFERENCE)
I tried this code in kotlin but getting error.
Is there any other way to prevent screenshot in flutter?
How to create (and is it a good practice) a Flutter app which shows Cupertino UI widgets at iOS and Material UI widgets at Android with same functionality?
Import import 'dart:io'
And then in your widget make if statement
if(Platform.isIOS){
...
} else {
...
}
I found Flutter Platform Widgets package, works fine
I would like to show the native date picker depending on the device. For example UIDatePicker if it's iOS.
I've tried to add SelectDateTextField inside my widget and it works, but it looks like the Android one. Does anyone have any recommendations?
You should check the Platform then need to write specific widgets as per your need.
Use the APIs provided by the Dart.
Example:
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
Your Widget
Platform.isIOS ? CupertinoWidget() : MaterialWidget()