File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ import UIKit
2+ import Flutter
3+
4+
5+ @UIApplicationMain
6+ @objc class AppDelegate : FlutterAppDelegate {
7+ override func application(
8+ _ application: UIApplication ,
9+ didFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ] ?
10+ ) -> Bool {
11+ self . window. makeSecure ( ) // + add this line
12+ GeneratedPluginRegistrant . register ( with: self )
13+ return super. application ( application, didFinishLaunchingWithOptions: launchOptions)
14+ }
15+ }
16+
17+ // + add this section
18+
19+ extension UIWindow {
20+ func makeSecure( ) {
21+ let field = UITextField ( )
22+ field. isSecureTextEntry = true
23+ self . addSubview ( field)
24+ field. centerYAnchor. constraint ( equalTo: self . centerYAnchor) . isActive = true
25+ field. centerXAnchor. constraint ( equalTo: self . centerXAnchor) . isActive = true
26+ self . layer. superlayer? . addSublayer ( field. layer)
27+ field. layer. sublayers? . first? . addSublayer ( self . layer)
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ package com.example.test // replace your packageName
2+
3+ import android.view.WindowManager.LayoutParams
4+ import io.flutter.embedding.android.FlutterActivity
5+ import io.flutter.embedding.engine.FlutterEngine
6+
7+ class MainActivity : FlutterActivity () {
8+ override fun configureFlutterEngine (flutterEngine : FlutterEngine ) {
9+ window.addFlags(LayoutParams .FLAG_SECURE )
10+ super .configureFlutterEngine(flutterEngine)
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments