当在TextField组件的suffixIcon设置点击事件时,因为键盘谈起的原因,导致调出的扫码界面黑屏。
version: qrcode: ^1.0.4
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.6 19G73, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] Connected device (1 available)
• No issues found!
代码:此处为TextField中的代码,其他没有键盘弹起的地方调用扫码界面,完全正常。
suffixIcon: InkWell(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () {
JumpReceive()
.jump(context, Routes.deliveryOrderScanQrPage)
.then((value) {
print('扫码结果》》》》' + value);
setState(() {
_codeController.text = value;
});
});
},
child: Container(
padding: EdgeInsets.only(
top: AutoLayout.instance.pxToDp(12),
bottom: AutoLayout.instance.pxToDp(12)),
width: ScreenUtil().setWidth(36),
child: Image.asset('images/search_scan_icon.png'),
),
),
结果:
I/CameraConfiguration(28320): Can set flash mode to: off
I/CameraConfiguration(28320): Flash mode already set to off
I/PreviewScalingStrategy(28320): Viewfinder size: 1722x1080
I/PreviewScalingStrategy(28320): Preview in order of preference: [1920x1080, 1440x1080, 1280x960, 1280x720, 800x480, 864x480, 720x480, 640x480, 640x360, 576x432, 480x320, 480x360, 352x288, 320x240, 176x144]
I/CameraManager(28320): Final camera parameters: ae-bracket-hdr=Off;ae-bracket-hdr-values=Off,AE-Bracket;antibanding=off;antibanding-values=off,60hz,50hz,auto;auto-exposure=frame-average;auto-exposure-lock=false;auto-exposure-lock-supported=true;auto-exposure-values=frame-average,center-weighted,spot-metering,center-weighted,spot-metering-adv,center-weighted-adv;auto-hdr-supported=true;auto-whitebalance-lock=false;auto-whitebalance-lock-supported=true;avtimer=disable;bokeh-blur-value=0;bokeh-mode=0;bokeh-mpo-mode=0;brightness-step=1;cache-video-buffers=enable;camera-mode=0;cds-mode-values=off,on,auto;contrast=5;contrast-step=1;denoise=denoise-on;denoise-values=denoise-off,denoise-on;dis=disable;dis-values=enable,disable;effect=none;effect-values=none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua,emboss,sketch,neon;exposure-compensation=0;exposure-compensation-step=0.166667;face-detection=on;face-detection-values=off,on;finetune-values=enable,disable;flash-mode=off;flash-mode-values=off,auto,on,torch;flip-mode-values=off,flip-v,flip-h,flip-vh;focal-length=3.82;focus-areas=(0, 0, 0, 0, 0);focus-distances=Infinity,Infinity,Infinity;focus-mode=auto;focus-mode-values=auto,infinity,fixed,macro,continuous-video,continuous-picture,manual;hdr-mode=hdr-mode-multiframe;hdr-mode-values=hdr-mode-sensor,hdr-mode-multiframe;hdr-need-1x=false;hdr-need-1x-values=false,true;hfr-size-values=1920x1080;histogram=disable;histogram-values=enable,disable;horizontal-view-angle=65.5;instant-aec-values=0,1,2;instant-capture-values=0,1,2;internal-restart=true;is-bokeh-mpo-supported=0;is-bokeh-supported=0;iso=auto;iso-values=auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800,ISO1600,ISO3200;jpeg-quality=85;jpeg-thumbnail-height=154;jpeg-thumbnail-quality=85;jpeg-thumbnail-size-values=256x154,240x160,320x320,320x240,256x144,240x144,176x144,240x320,144x176,0x0;jpeg-thumbnail-width=256;lensshade=enable;lensshade-values=enable,disable;long-shot=off;longshot-supported=true;luma-adaptation=3;manual-exposure-modes=off,exp-time-priority,iso-priority,user-setting;manual-focus-modes=off,scale-mode,diopter-mode;manual-wb-modes=off,color-temperature,rbgb-gains;max-brightness=6;max-contrast=10;max-exposure-compensation=12;max-exposure-time=59498.796800;max-focus-pos-dac=1023;max-focus-pos-diopter=11.1111;max-focus-pos-index=1023;max-focus-pos-ratio=100;max-iso=1600;max-num-detected-faces-hw=10;max-num-detected-faces-sw=10;max-num-focus-areas=1;max-num-metering-areas=10;max-saturation=10;max-sce-factor=100;max-sharpness=36;max-wb-cct=8000;max-wb-gain=4;max-zoom=199;mce=enable;mce-values=enable,disable;metadata-types=metadata-asd,metadata-fd,metadata-hdr,metadata-led-calib,metadata-rtb;metering-areas=(0, 0, 0, 0, 0);mi-hdr=false;min-brightness=0;min-contrast=0;min-exposure-compensation=-12;min-exposure-time=0.019681;min-focus-pos-dac=0;min-focus-pos-diopter=0;min-focus-pos-index=0;min-focus-pos-ratio=0;min-iso=100;min-saturation=0;min-sce-factor=-100;min-sharpness=0;min-wb-cct=2000;min-wb-gain=1;morpho-hht=false;num-retro-burst-per-shutter=0;num-snaps-per-shutter=1;ois=enable;ois-values=enable,disable;picture-format=jpeg;picture-format-values=jpeg,bayer-mipi-10rggb;picture-size=4032x3016;picture-size-values=4032x3016,4000x3000,4000x2250,3840x2160,2976x2976,3264x2448,3200x2400,2592x1944,2688x1512,2304x1728,2048x1536,1920x1080,1600x1200,1440x1080,1280x960,1280x768,1280x720,1024x768,800x600,864x480,800x480,720x480,640x480,640x360,480x360,480x320,352x288,320x240,176x144;preferred-preview-size-for-video=1920x1080;preview-flip=off;preview-format=yuv420sp;preview-format-values=yuv420sp,yuv420p,nv12-venus;preview-fps-range=7000,30000;preview-fps-range-values=(15000,15000),(20000,20000),(24000,24000),(7000,30000),(30000,30000),(10000,30000);preview-frame-rate=30;preview-frame-rate-values=7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30;preview-size-values=1920x1080,1440x1080,1280x960,1280x720,864x480,800x480,720x480,640x480,640x360,576x432,480x360,480x320,352x288,320x240,176x144;qc-max-num-requested-faces=10;raw-size=4032x3
I/CenterCropStrategy(28320): Preview: 1080x1920; Scaled: 1080x1920; Want: 1080x1722
W/Looper (28320): Slow Looper main: doFrame is 491ms late because of 7 msg
I/CameraPreview(28320): Starting preview
D/CameraInstance(28320): Starting preview
I/AutoFocusManager(28320): Current focus mode 'auto'; use auto focus? true
I/utter_data_vie(28320): Background concurrent copying GC freed 3937(530KB) AllocSpace objects, 10(11MB) LOS objects, 49% free, 11MB/23MB, paused 117us total 114.070ms
I/utter_data_vie(28320): Background concurrent copying GC freed 3952(494KB) AllocSpace objects, 10(11MB) LOS objects, 49% free, 11MB/23MB, paused 290us total 110.101ms
I/utter_data_vie(28320): Background concurrent copying GC freed 7730(837KB) AllocSpace objects, 20(23MB) LOS objects, 49% free, 14MB/29MB, paused 136us total 104.821ms
I/utter_data_vie(28320): Background concurrent copying GC freed 4025(495KB) AllocSpace objects, 10(11MB) LOS objects, 50% free, 16MB/33MB, paused 186us total 114.647ms
I/utter_data_vie(28320): Background concurrent copying GC freed 3979(399KB) AllocSpace objects, 10(11MB) LOS objects, 50% free, 17MB/34MB, paused 170us total 108.899ms
I/utter_data_vie(28320): Background concurrent copying GC freed 4127(463KB) AllocSpace objects, 10(11MB) LOS objects, 50% free, 16MB/33MB, paused 179us total 108.284ms
I/utter_data_vie(28320): Background concurrent copying GC freed 8253(898KB) AllocSpace objects, 20(23MB) LOS objects, 50% free, 11MB/23MB, paused 163us total 111.790ms
I/utter_data_vie(28320): Background concurrent copying GC freed 4123(498KB) AllocSpace objects, 10(11MB) LOS objects, 49% free, 11MB/23MB, paused 122us total 103.371ms
I/utter_data_vie(28320): Background concurrent copying GC freed 4138(498KB) AllocSpace objects, 10(11MB) LOS objects, 49% free, 14MB/29MB, paused 353us total 116.915ms
I/utter_data_vie(28320): Background concurrent copying GC freed 8203(930KB) AllocSpace objects, 20(23MB) LOS objects, 49% free, 11MB/22MB, paused 165us total 102.431ms
I/utter_data_vie(28320): Background concurrent copying GC freed 4170(494KB) AllocSpace objects, 10(11MB) LOS objects, 49% free, 14MB/29MB, paused 140us total 102.820ms
有时还会异常退出。
测试手机:小米Note3