Open wxpcl123 opened 3 years ago
similar issue: https://github.com/jonataslaw/getx/issues/737
my issue represent on emulator and meizu note 9
@jonataslaw, I confirmed that the problem happens and put a smaller code to reproduce below. I can only reproduce the problem (freezes the UI) after clicking approximately 15 times in each language.
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
translations: AppTranslations(),
locale: Get.deviceLocale,
fallbackLocale: Locale('en', 'US'),
defaultTransition: Transition.cupertino,
home: Home(),
);
}
}
class Home extends StatelessWidget {
@override
Widget build(context) {
return Scaffold(
appBar: AppBar(
title: Text("${'hello'.tr}"),
actions: [MyMenu()],
),
);
}
}
class MyMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
return PopupMenuButton(
icon: Icon(Icons.more_horiz),
offset: Offset(0, 30),
itemBuilder: (context) => <PopupMenuEntry>[
PopupMenuItem(
value: 'en',
child: Text('English'),
),
PopupMenuItem(
value: 'de',
child: Text('German'),
),
PopupMenuItem(
value: 'pt',
child: Text('Portuguese'),
),
],
onSelected: (value) {
switch (value) {
case 'en':
Get.updateLocale(Locale('en', 'US'));
break;
case 'de':
Get.updateLocale(Locale('de', 'DE'));
break;
case 'pt':
Get.updateLocale(Locale('pt', 'BR'));
break;
}
},
);
}
}
class AppTranslations extends Translations {
@override
Map<String, Map<String, String>> get keys => {
'en_US': {
'hello': 'Hello World',
},
'de_DE': {
'hello': 'Hallo Welt',
},
'pt_BR': {
'hello': 'Alo Mundo',
},
};
}
Okay, this looks like an error with the Flutter Engine. I need to know what devices this is on to investigate further, or open an issue in the official repository, because I cannot reproduce this on my devices.
I suppose the engine's lockEvents function is blocking the ring longer than necessary which gives the impression of locking on some devices. I just made a modification to access the hot reload api directly on the master, if you can test it, I would be grateful.
I tested using GetX on the master branch and the same problem occurs. I don't use an emulator, I test directly on a Samsung cell phone model Galaxy A01 (SM-A015M / DS). I made the video below to show the interface freeze
https://user-images.githubusercontent.com/9120528/103320868-d4ce7180-4a15-11eb-9b40-bba3c381240c.mp4
Same Issue found for me.
Same Issue. Has anybody got a solution?
Describe the bug It seems the function Get.updateLocal() has an apparent death bug.
I put a PopupMenuButton widget on the appbar, and add serveral PopupMenuItem inside to change language.
Mostly it works very well, but sometimes when I click the menu item, the total UI freezed.
I paster the key code and image below, hope you'll find the bug.
**code
Screenshots If applicable, add screenshots to help explain your problem.
Flutter Version: PS D:\Study\demo04> flutter --version Flutter 1.23.0-18.1.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 198df796aa (10 weeks ago) • 2020-10-15 12:04:33 -0700 Engine • revision 1d12d82d9c Tools • Dart 2.11.0 (build 2.11.0-213.1.beta)
Getx Version: get: ^3.23.1
Describe on which device you found the bug: web and google android simulator