shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
2.09k stars 124 forks source link

fix: ios patch scrolling behavior #2219

Open felangel opened 3 weeks ago

felangel commented 3 weeks ago

Flutter & Friends

replace settings_page.dart with:

import 'package:flutter/material.dart';
import 'package:flutter_and_friends/settings/settings.dart';
import 'package:flutter_and_friends/theme/theme.dart';
import 'package:flutter_and_friends/updater/updater.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:url_launcher/url_launcher_string.dart';

class SettingsPage extends StatelessWidget {
  const SettingsPage({super.key});

  static Route<void> route() {
    return MaterialPageRoute(builder: (_) => const SettingsPage());
  }

  @override
  Widget build(BuildContext context) {
    return BlocProvider(
      create: (_) => SettingsCubit()..init(),
      child: const SettingsView(),
    );
  }
}

class SettingsView extends StatelessWidget {
  const SettingsView({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    final headingStyle = theme.textTheme.titleMedium;
    return BlocListener<UpdaterCubit, UpdaterState>(
      listenWhen: (previous, current) =>
          previous.status != current.status &&
          current.status == UpdaterStatus.idle,
      listener: (context, state) {
        if (!state.updateAvailable) {
          ScaffoldMessenger.of(context)
            ..hideCurrentSnackBar()
            ..showSnackBar(
              const SnackBar(
                content: Text('No update available'),
              ),
            );
        }
      },
      child: Scaffold(
        appBar: AppBar(title: const Text('Settings')),
        body: ListView(
          padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
          children: [
            Text('Preferences', style: headingStyle),
            const ThemeToggle(),
            const SizedBox(height: 16),
            Text('About', style: headingStyle),
            ListTile(
              title: const Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [Text('Version'), Text('0.0.0')],
              ),
              onTap: () => context.read<UpdaterCubit>().checkForUpdates(),
            ),
            ListTile(
              title: const Text('Source Code'),
              subtitle: const Text('View the full source code on GitHub'),
              trailing: const Icon(Icons.chevron_right),
              onTap: () => launchUrlString(
                'https://github.com/felangel/flutter_and_friends',
              ),
            ),
            ListTile(
              title: const Text('Licenses'),
              subtitle: const Text('View the licenses of the libraries used'),
              trailing: const Icon(Icons.chevron_right),
              onTap: () => showLicensePage(
                context: context,
                applicationIcon: Image.asset('assets/logo.png', height: 120),
                applicationName: 'Flutter & Friends',
              ),
            ),
            ListTile(
              title: const Row(
                children: [
                  Text('Follow on'),
                  Icon(FontAwesomeIcons.xTwitter),
                ],
              ),
              subtitle: const Text('Formerly known as Twitter'),
              trailing: const Icon(Icons.chevron_right),
              onTap: () => launchUrlString(
                'https://twitter.com/FlutterNFriends',
              ),
            ),
            ListTile(
              title: const Text('Developed By Felix Angelov'),
              subtitle: const Text('Powered by Shorebird'),
              trailing: const Icon(Icons.chevron_right),
              onTap: () => launchUrlString('https://shorebird.dev'),
            ),
          ],
        ),
      ),
    );
  }
}

Note that when running the patch, scrolling behavior is broken. This was observed on the current stable release as well as tip of tree.

eseidel commented 3 weeks ago

I presume this is on top of https://github.com/felangel/flutter_and_friends/commit/bcde785061e382dbba095e238550b9a6f6c7a79f

felangel commented 3 weeks ago

I presume this is on top of felangel/flutter_and_friends@bcde785

yup that's correct 👍

icodelifee commented 3 weeks ago

I had the same issue with ListView, the scroll sort of rubberbands. Switched to SingleChildScrollView and scroll works fine

caseymdk commented 3 weeks ago

This is anecdotal, but I got similar behaviour with patches on iOS a few days ago. Scrolling froze in one case, and in another case scrolling reversed (swiping my finger downward caused scrolling to the bottom of the page). Only on iOS and with a patch.

I will see if I can reproduce with more concrete and helpful details.

felangel commented 3 weeks ago

Update: the link percentage improvements I’ve been working on appear to have fixed this. I’m not sure what the root cause was yet but the good news is I’m unable to reproduce this anymore when applying some of our performance optimizations (which we will hopefully release next week).

eseidel commented 3 weeks ago

Based on our past experience with linking, I doubt that they'd "fix" this so much as hide it. This seems likely to have a similar root cause (if different manifestation) to https://github.com/shorebirdtech/shorebird/issues/2237

felangel commented 3 weeks ago

Based on our past experience with linking, I doubt that they'd "fix" this so much as hide it. This seems likely to have a similar root cause (if different manifestation) to #2237

Yup still need to investigate and identify the root cause.

ismail-mufin commented 2 weeks ago

We are experiencing same problem with the latest version Shorebird and v3.22.2 Flutter. The scroll exhibits unexpected behavior on whole the app and causes the app to crash.

https://github.com/shorebirdtech/shorebird/issues/2237#issuecomment-2179454673

I saw 3 days ago that you fixed it, the version we patched was released earlier. I think we need to release a new version.

If you need more information about this crash I can send it to you via Discord.

eseidel commented 2 weeks ago

Thank you very much for the report, and apologies for any trouble. Felix has a release ready to go out tomorrow for some unrelated issues and then we plan to look at this again. Thank you for your patience.

Shady5095 commented 1 week ago

I have scroll issue(Lag , auto scroll , scroll inverted ) in all ListView in all app in after first patch in ios

eseidel commented 1 week ago

I have scroll issue(Lag , auto scroll , scroll inverted ) in all ListView in all app in after first patch in ios

This is definitely unexpected (although based on this bug, you're not alone). Felix and I will be looking at this later this week. Thank you for the report!

ismail-mufin commented 1 week ago

We had this problem again today, same with @Shady5095

eseidel commented 1 week ago

Felix and I are still finishing https://github.com/shorebirdtech/shorebird/issues/1892, but will look soon.

ismail-mufin commented 1 week ago

Thank you for update. I can understand your prioritization, but please note that this prevents us from using Shorebird.

Because even screens where we have not made changes are affected. The whole app starts to scroll issues and some screens freeze and crash.

It doesn't happen with every patch, but when the connection percentage is low. I don't understand exactly what this is about yet.

ismail-mufin commented 1 week ago

Today we just added one Text() and the screens that use ListView in the whole application became unclickable.

This means that making changes to any screen that uses ListView breaks the behavior of ListViews in the whole application.

We won't send patch to iOS until this issue is fixed. It's a serious inconvenience for iOS stable release.