날씨 라이브러리인 accuweather를 써보려는데 

사이트내에서 앱을 만들고 api키로 이것저것 써보려는데 401이 자꾸났다.

 

그럴땐 만든 앱의 셋팅값을 아래와 같이하면 된다 

 

https://github.com/home-assistant/core/issues/61812

반응형

ios

xcode - Runner-AppDelegate.swift에 들어간다 

 

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    self.window.makeSecure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
    override func applicationWillResignActive(
      _ application: UIApplication
    ) {
      self.window.isHidden = true;
    }
    override func applicationDidBecomeActive(
      _ application: UIApplication
    ) {
      self.window.isHidden = false;
    }

}
  extension UIWindow {
    func makeSecure() {
     let field = UITextField()
     field.isSecureTextEntry = true
     self.addSubview(field)
     field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
     field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
     self.layer.superlayer?.addSublayer(field.layer)
     field.layer.sublayers?.first?.addSublayer(self.layer)
   }
 }

 

빨간 부분을 추가하면 캡쳐서 검은화면으로 나온다.

 

 

android

https://pub.dev/packages/flutter_windowmanager/example

라이브러리 설치 후 main에 넣는다

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE);
  runApp(MyApp());
}

 

캡처시 문구가뜬다.

 

 

참고:
https://stackoverflow.com/questions/52317217/flutter-disable-screenshot-capture-for-app

https://stackoverflow.com/questions/72380810/how-to-prevent-taking-screen-shoot-in-flutter-ios

반응형

일단 Scaffold에 appbar를 사용안한다면  AnnotatedRegion설정으로 해결

AnnotatedRegion(
  // status icon and text color, dark:black  light:white
  value: SystemUiOverlayStyle.dark,
  child: Scaffold(
     // statusbar color
     backgroundColor: Colors.white,
     body : SafeArea(****)
  )
}

 

AppBar를 사용한다면 

 @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        systemOverlayStyle: SystemUiOverlayStyle.dark, # or light
        backgroundColor: Colors.red, # status bar color
      ),
    );
  }

 

 

 

 

참고:https://stackoverflow.com/questions/50501799/flutter-how-to-set-status-bar-color-when-appbar-not-present,https://stackoverflow.com/questions/55209774/flutter-change-status-bar-brightness-to-dark

반응형

'flutter > etc' 카테고리의 다른 글

accuweather 401 error 날때  (0) 2023.08.07
flutter app screenshot disable 스크린샷 막기  (0) 2023.02.22
svg 안열리는 문제  (0) 2022.03.05

디자이너나 인터넷상에 있는 svg를 받아서 flutter에 넣었는데 아무것도 안뜰시 or 너무 코드가 길때 

 

 

https://iconly.io/tools/svg-cleaner

사이트에 svg파일올리면 알아서 정리해준다 

 

or

 

 

svgcleaner를 사용하자

 

https://github.com/RazrFalcon/svgcleaner-gui/releases

들어가서 버전에 맞는것 다운로드 후 

 

 

파일or폴더 불러와서 

 

 

 

경로 지정 후 실행버튼 누르면 끝 

 

 

참고:https://stackoverflow.com/questions/58567864/im-trying-use-flutter-svg-but-load-with-black-svg

 

 

 

 

반응형

+ Recent posts