8.5 C
London
Sunday, February 11, 2024

It really works wonderful on Flutter Android, however the enter is stuttering or sluggish on iOS


I’m a Korean who’s making an app utilizing Flutter. This app is in Korean, and I wrote the code to mechanically replicate the search outcomes on to Listview.builder in line with the real-time API enter values when looking out (principally in Korean) throughout app improvement.
I checked with debugging mode to see if it labored effectively on the precise system, it labored very effectively on Android as I wished, however on iOS, I had an issue the place the worth did not seem within the checklist view despite the fact that I had enter.
Is that this an issue brought on by the totally different iOS processing strategies of Korean Alphabet? Additionally, while you take a real-time search phrase with Question, Hangeul seems effectively.

class FoundGroupPage extends StatefulWidget {
  const FoundGroupPage({tremendous.key});

  @override
  State<FoundGroupPage> createState() => _FoundGroupPageState();
}

class _FoundGroupPageState extends State<FoundGroupPage> {
  closing TextEditingController alertTextController = TextEditingController();
  closing TextEditingController groupSearchController = TextEditingController();
  late Checklist<Group> searchResults;
  bool isLoading = false;

  @override
  void initState() {
    tremendous.initState();
    searchResults = [];

    _loadInitialData();
    
    groupSearchController.addListener(_onSearchChanged);

    eventBus.on<TokenExpiredEvent>().hear((occasion) {
      Navigator.of(context)
          .pushNamedAndRemoveUntil('/login', (Route<dynamic> route) => false);
    });
  }

  void _onSearchChanged() {
    closing searchText = groupSearchController.textual content;
      if (searchText.trim().isEmpty) {
        _loadInitialData();
      } else {
        handleSearchCallBack(searchText);
      }
  }

  @override
  void dispose() {
    tremendous.dispose();
    _debounce?.cancel();
    alertTextController.dispose();
    groupSearchController.dispose();
  }

  Future<void> _loadInitialData() async {
    attempt {
      Checklist<Group> initialGroups = await getGroupList();
      setState(() {
        searchResults = initialGroups;
      });
    } catch (e) {
      setState(() {
        searchResults = [];
      });
      debugPrint('Error loading preliminary information: $e');
    }
  }

  Future<void> handleSearchCallBack(String searchText) async {
    if (searchText.isEmpty) {
      _loadInitialData();
    }

    attempt {
      Checklist<Group> outcomes = await searchGroups(searchText);
      setState(() {
        searchResults = outcomes;
      });
    } catch (e) {
      debugPrint('Error looking out teams: $e');
    }
  }

  @override
  Widget construct(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      physique: Container(
        coloration: mainBackgroundColor,
        youngster: SafeArea(
            prime: true,
            youngster: Heart(
              youngster: Column(
                youngsters: [
                  const SizedBox(height: 10),
                  Padding(
                    padding: const EdgeInsets.symmetric(horizontal: 16.0),
                    child: searchInput(
                        '그룹명을 입력하세요.', groupSearchController, handleSearchCallBack),
                  ),
                  const SizedBox(height: 40),
                  Padding(
                    padding: const EdgeInsets.only(left: 16.0),
                    child: Row(
                      children: [
                        Text(
                          '그룹 리스트',
                          style: TextStyle(
                            color: Colors.white.withOpacity(0.85),
                            fontSize: 24,
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ],
                    ),
                  ),
                  const SizedBox(peak: 20),
                  Expanded(
                    youngster: isLoading
                        ? Heart(
                            youngster: Platform.isIOS
                                ? const CupertinoActivityIndicator(
                                    coloration: Colours.white70)
                                : const CircularProgressIndicator(
                                    coloration: Colours.white70),
                          )
                        : searchResults.isEmpty
                            ? const Heart(
                                youngster: Textual content('검색 결과가 존재하지 않습니다.',
                                    type: TextStyle(coloration: Colours.white)))
                            : ListView.builder(
                                itemCount: searchResults.size,
                                itemBuilder: (context, index) {
                                  return Padding(
                                    padding: const EdgeInsets.symmetric(
                                        horizontal: 16.0, vertical: 12.0),
                                    youngster: groupButton(
                                      // take away `!`
                                      searchResults[index].groupName,
                                      () async {
                                        await openPasswordDialog(
                                          context,
                                          alertTextController,
                                          searchResults[index].groupId,
                                        );
                                      },
                                    ),
                                  );
                                },
                              ),
                  ),
                ],
              ),
            )),
      ),
    );
  }
}

Disconnect the search widget to make use of the search widget to make use of it for use as a double operate.Can you might have an issue on this nostril?

Widget searchInput(String placeHolder, TextEditingController controller, Future<void> Perform(String searchText) onSearchSubmitted) {
  return TextFormField(
    controller: controller,
    keyboardType: TextInputType.textual content,
    type: const TextStyle(coloration: Colours.white),
    autofocus: false,

    ornament: InputDecoration(
      hintText: placeHolder,
      hintStyle: const TextStyle(fontSize: 17, coloration: Colours.gray, fontWeight: FontWeight.daring),
      focusColor: Colours.white,
      border: InputBorder.none,
      prefixIcon: const Icon(Icons.search, coloration: Colours.white,),

      enabledBorder: const OutlineInputBorder(
        borderRadius: BorderRadius.all(Radius.round(40)),
        borderSide: BorderSide(coloration: Colours.gray),
      ),

      focusedBorder: const OutlineInputBorder(
        borderRadius: BorderRadius.all(Radius.round(40)),
        borderSide: BorderSide(coloration: Colours.gray),
      ),
    ),

    onFieldSubmitted: (searchText) {
      onSearchSubmitted(searchText);
    },
  );
}

I have not discovered any significant information on the web about the truth that it really works wonderful on Flutter Android however not on iOS.. please assist..!

Debugging Android and iOS Gadgets, Verifying Conduct in Simulator After Downgrading to iOS 16, Ask GPT-4 and googling

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here